Skip to content

Reset the log reader when the tailed file shrinks - #45

Open
fedonman wants to merge 1 commit into
mainfrom
fixed/stale-log-after-truncation
Open

fedonman wants to merge 1 commit into
mainfrom
fixed/stale-log-after-truncation

Conversation

@fedonman

@fedonman fedonman commented Sep 6, 2026

Copy link
Copy Markdown
Owner

IncrementalReader seeked to its remembered offset without checking how long the file actually was, so once a log was truncated or rewritten shorter the offset sat past the end, every read came back empty, and the pane kept re-sending the buffer it had built before the truncation. It now compares the length against the offset and starts over when the file has shrunk. Three tests cover it: appending still reads incrementally, a rewritten file replaces the buffer, and an emptied file empties the pane.

Closes #9

IncrementalReader seeked to a remembered offset without ever checking
the file length, so a truncated or rewritten log left the offset past
the end. The read returned nothing and the reader re-sent the buffer it
had built before the truncation, forever. Compare the length against the
offset first and start over when the file is shorter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Log panes keep showing old content after a log is truncated

1 participant