Skip to content

RotatingStreamWriter: failed rotation causes repeated retry on every subsequent write #418

@Christophe-Rogiers

Description

@Christophe-Rogiers

Description

In src/Servy.Core/IO/RotatingStreamWriter.cs (lines 374-409), if log rotation fails permanently (e.g., UnauthorizedAccessException on network paths), the writer is left as null. The next write re-creates the writer on the same oversized file, triggering the rotation check again — and failing again. This creates an infinite loop of failed rotations on every log line.

Impact

CPU overhead on every log write after a permanent rotation failure. Log file grows unbounded.

Suggested fix

Set a _rotationDisabled flag after permanent failure and log a warning.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions