Skip to content

Fix stale StreamBuffer timer callbacks flushing newer batches - #1

Draft
AngelP17 wants to merge 2 commits into
NginxL:mainfrom
AngelP17:fix/streambuffer-stale-timer
Draft

AngelP17 wants to merge 2 commits into
NginxL:mainfrom
AngelP17:fix/streambuffer-stale-timer

Conversation

@AngelP17

@AngelP17 AngelP17 commented Dec 5, 2026

Copy link
Copy Markdown

Problem

A timer callback may already be dispatched when a synchronous flush cancels its timer. If a new batch starts before that callback acquires the lock, the stale callback can flush the new batch early and cancel its timer.

Changes

  • Associate each scheduled callback with a generation and ignore stale callbacks under the existing lock.
  • Preserve event ordering and existing flush behavior.
  • Add a deterministic mocked-timer regression test (no timing-dependent sleeps in the new test).

Validation

  • Focused regression fails against the original implementation and passes with the fix.
  • All three focused StreamBuffer tests passed locally using the retrieved source files.
  • Full repository checks and CI remain pending.

This is a narrowly scoped follow-up related to roadmap item S7, not the full timer-thread redesign.

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.

1 participant