Skip to content

fix: end the stream when replay fails instead of leaking - #9

Merged
Marsup merged 1 commit into
mainfrom
fix/replay-failure-leak
Oct 21, 2026
Merged

Marsup merged 1 commit into
mainfrom
fix/replay-failure-leak

Conversation

@damusix

@damusix damusix commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

If replay fails, the session now closes and the stream ends with a 200, and the error is reported through request.log(). An error status would make EventSource stop reconnecting for good. An ended stream makes it reconnect after retry, and the normal cleanup runs: onUnsubscribe fires and the maxSessions slot is freed.

publish(), broadcast() and the built-in replayers' record() now reject event ids containing a null character, so a bad id can't get into the replay buffer.

Closes #8

@Marsup Marsup self-assigned this Oct 7, 2026
@Marsup Marsup added the bug Bug or defect label Oct 7, 2026
@Marsup Marsup added this to the 1.1.1 milestone Oct 7, 2026
@Marsup Marsup modified the milestones: 1.1.1, 1.2.0 Oct 21, 2026
Base automatically changed from fix/marshal-response to main October 21, 2026 07:48
An error status stops EventSource for good; an ended stream makes it
retry and runs the normal cleanup. Null-character ids are rejected
before they reach the replay buffer.

Closes #8
@damusix
damusix force-pushed the fix/replay-failure-leak branch from 0275976 to 51bfed5 Compare October 21, 2026 15:46
@Marsup
Marsup merged commit 40df47a into main Oct 21, 2026
3 checks passed
@Marsup
Marsup deleted the fix/replay-failure-leak branch October 21, 2026 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bug or defect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A throwing replay() leaks the session and its maxSessions slot

2 participants