Skip to content

parser: pass on a split line that never ends once its first part is old - #37

Merged
mayankpande88 merged 1 commit into
mainfrom
fix/partial-line-max-age
Oct 23, 2026
Merged

mayankpande88 merged 1 commit into
mainfrom
fix/partial-line-max-age

Conversation

@reckless-sherixx

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #36 (review point on split lines that never end).

A split line holds back acknowledgements for its whole source until its last part arrives. A line that keeps growing without a newline (a progress bar) never got there: each new part reset its expiry, so the source's offset could never advance.

  • A pending split line is now also passed on once its first part is 10 multiline timeouts old (partialLineMaxAge), even while parts keep arriving. Its later parts start a new line.
  • LogEntry.Offset doc: offsets must only increase within a source (a reader that restarts a file keeps them increasing, e.g. a generation in the high bits).

No API change.

Test plan

  • go test ./... and go vet ./... pass (6 full runs).
  • New TestEndlessSplitLineDoesNotBlockAcknowledgements: stdout keeps growing while a stderr line waits; the stderr line must be acknowledged. It fails without the first-part cutoff; TestPartialLines covers the cutoff directly. Timing-sensitive tests pass 30 repeats.

A line the runtime splits that keeps growing without a newline (a progress
bar) stayed pending for good, since each new part reset its expiry, and while
any line is pending no offset of its source can be acknowledged. Such a line
is now passed on once its first part is 10 multiline timeouts old; its later
parts start a new line.

Also documents that LogEntry.Offset must only increase within a source.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a mechanism to prevent endless split lines (such as progress bars written without a newline) from staying pending indefinitely and blocking acknowledgements for other streams. It adds a first timestamp to pendingLine to track when the first part of a line arrived, and updates the expired method to also remove lines that exceed a maximum age (partialLineMaxAge). Corresponding unit tests have been added to verify this behavior. There are no review comments to evaluate, and the changes look solid.

@mayankpande88
mayankpande88 merged commit 38071d9 into main Oct 23, 2026
1 check passed
mayankpande88 pushed a commit to nudgebee/node-agent that referenced this pull request Oct 24, 2026
…408)

Pins logparser 38071d9 (nudgebee/logparser#37). A container that writes
a line split across log records and never ends it no longer holds back
acknowledgements, so positions for its file keep advancing.
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.

2 participants