Skip to content

fix(events): end a reliable subscription when its context is cancelled - #56

Merged
arepala-uml merged 1 commit into
mainfrom
fix/reliable-subscribe-interrupt
Nov 26, 2026
Merged

arepala-uml merged 1 commit into
mainfrom
fix/reliable-subscribe-interrupt

Conversation

@arepala-uml

@arepala-uml arepala-uml commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Closes #55

  • Once response headers arrive, the HTTP/2 transport checks the request context only while writing the request body. A reliable subscriber that has sent all its acks leaves that writer parked on the empty request pipe, so cancelling the context did not end the blocked Receive until the server sent another message.
  • runReliable now registers context.AfterFunc to close the request and response halves of the stream on cancel; RunEventStream still returns nil, so signalExit keeps the 128+signal exit status.
  • runPlain is unchanged: its request body is closed after the single request, so the transport already watches the context.
  • Adds TestRunEventStreamReliableCancelWhileIdle: the server sends two events, takes both acks, and goes quiet; the test cancels and requires RunEventStream to return nil within 2s. It failed 5/5 before the change.

Checks: make build, make vet, gofmt -s -l, golangci-lint run (0 issues), go test -race ./..., new test with -race -count=30.


Summary by cubic

Fixes reliable subscriptions so cancelling their context ends a blocked Receive instead of stalling until the server sends again. Closes #55.

Once response headers arrive, the HTTP/2 transport checks the request context only while writing the request body. A reliable subscriber that has sent all its acks leaves the writer parked on the empty request pipe, so a cancel didn't end the stream until the next server message. runReliable now registers context.AfterFunc to close both request and response halves on cancel; RunEventStream still returns nil, so the 128+signal exit status is kept. runPlain is unchanged.

Adds TestRunEventStreamReliableCancelWhileIdle, which sends two events, takes both acks, and goes quiet; cancelling must return nil within 2s. The test failed before the change.

Written for commit 5912da4. Summary will update on new commits.

View guided diff Turn on auto-fix

Signed-off-by: Akhil Repala <arepala@blinklabs.io>
@arepala-uml arepala-uml self-assigned this Nov 26, 2026
@coderabbitai

coderabbitai Bot commented Nov 26, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c34e976b-2d11-4dfe-91bc-ba2c56731b11
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@arepala-uml
arepala-uml merged commit 80506d4 into main Nov 26, 2026
22 checks passed
@arepala-uml
arepala-uml deleted the fix/reliable-subscribe-interrupt branch November 26, 2026 20:54
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.

events subscribe --reliable can ignore SIGINT and stay blocked in Receive

2 participants