Skip to content

fix(shard-distributor): prevent context cancellation in streaming WatchNamespaceState RPC#7474

Merged
jakobht merged 1 commit intocadence-workflow:masterfrom
jakobht:fixStreamRPCCancel
Nov 24, 2025
Merged

fix(shard-distributor): prevent context cancellation in streaming WatchNamespaceState RPC#7474
jakobht merged 1 commit intocadence-workflow:masterfrom
jakobht:fixStreamRPCCancel

Conversation

@jakobht
Copy link
Member

@jakobht jakobht commented Nov 24, 2025

What changed?
Added sharddistributorClient.WatchNamespaceState to the noTimeoutAPIs list in the timeout wrapper template and regenerated the wrapper code.

Why?
The timeout wrapper was immediately cancelling the context for streaming RPCs, causing WatchNamespaceState streams to fail with "context canceled" errors. For streaming RPCs, the context must remain alive for the stream's entire lifetime, not just the initial call.

How did you test it?
Verified locally that WatchNamespaceState streams now remain open without premature cancellation.

Potential risks
Low risk. This only affects the WatchNamespaceState streaming RPC, allowing it to stay open as intended rather than being cancelled immediately.

Release notes

Documentation Changes
None

The timeout wrapper was immediately cancelling the context for streaming
RPCs, causing the stream to fail with "context canceled" errors. For
streaming RPCs, the context must remain alive for the stream's entire
lifetime, not just the initial call.

Changes:
- Add sharddistributorClient.WatchNamespaceState to noTimeoutAPIs list
- Regenerate timeout wrapper without defer cancel() for this method

Signed-off-by: Jakob Haahr Taankvist <jht@uber.com>
@jakobht jakobht merged commit ad55a1c into cadence-workflow:master Nov 24, 2025
44 checks passed
@jakobht jakobht deleted the fixStreamRPCCancel branch March 2, 2026 11:30
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