Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughSubscription result forwarding now checks the execution context before each send. A regression test verifies that cancelling a blocked subscription closes the result channel and exits the producer. ChangesSubscription cancellation handling
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change makes subscription producers stop cleanly when their context is cancelled and adds a regression test; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
ExecuteSubscription sent every result with a bare send on an unbuffered channel. A subscriber that cancels its context and stops reading left the producer blocked on that send forever: one leaked goroutine per affected subscription, and the result channel never closed. gwag's runSubscription does exactly this, returning as soon as its context is cancelled. Upstream graphql-go#760 guards only the event-loop send. The single-value send and every error-path send leak the same way; the new tests reproduce all three before this change. Every send now goes through one send closure that selects on p.Context.Done(). A result not yet received when the context is cancelled is dropped. Refs: graphql-go#758, graphql-go#760 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KVsL7BDZ2pGA9BkjvND96p
Records graphql-go#758/graphql-go#760 (subscription leak, adapted), graphql-go#757 (BindFields integer kinds, adapted in part) and graphql-go#756 (parser depth cap, already here as c3e2c2c). Also corrects the graphql-go#754 entry, which still called the depth cap open after c3e2c2c landed it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KVsL7BDZ2pGA9BkjvND96p
The producer in ExecuteSubscription sent results with a bare unbuffered send that did not select on p.Context.Done(). When a subscriber unsubscribes or disconnects and stops reading resultChannel, the producer blocks forever on the send; cancelling the context cannot unblock it because the goroutine is not in a select at that moment. This leaks one goroutine per unsubscribed subscription.
Wrap the send in a select that also observes p.Context.Done(), so a cancelled context lets the producer exit and close resultChannel even with no active receiver.
Add TestProducerExitsOnContextCancel as a regression test.
Summary by CodeRabbit
Bug Fixes
Tests