Skip to content

Shut-down handles report UNAVAILABLE - #147

Merged
csvance merged 2 commits into
mainfrom
shutdown-unavailable
Oct 26, 2026
Merged

csvance merged 2 commits into
mainfrom
shutdown-unavailable

Conversation

@csvance

@csvance csvance commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Bug fix: close(grpc) (grpc_shutdown) cleaned up in-flight requests without setting an exception, so grpc_async_await returned whatever was buffered (usually an empty response) as a success. The same applied to response streams cut off by shutdown. In-flight requests now fail with UNAVAILABLE. This is the fix released in 1.1.2.

Behaviour change: a request submitted to a handle that is not running, or queued for a max_streams slot when the handle shuts down, now raises UNAVAILABLE instead of FAILED_PRECONDITION. A shut-down handle is usually being reset (grpc_shutdown then grpc_init), so the call is retryable; gRPC's status guidance reserves FAILED_PRECONDITION for "do not retry until state is fixed". grpc-java uses UNAVAILABLE for calls on a shut-down channel. A caller racing a reset now sees one retryable code whether its request was in flight, queued, or new.

An uninitialized handle shares the code, since the handle cannot distinguish it from a shut-down one; the message still names grpc_init().

Changes

  • src/Curl.jl: set UNAVAILABLE on unfinished requests in close; use UNAVAILABLE at the three shut-down submission and queue sites
  • Tests: new testset for in-flight unary calls and submission after shutdown; the stalled-consumer shutdown test and the queued-request test now expect UNAVAILABLE
  • Docs and skills: exception contract and status tables updated; the skills table's claim that shutdown produced CANCELLED was incorrect and is removed

Callers matching on FAILED_PRECONDITION for a shut-down handle need to update; worth a line in the 1.2 release notes.

🤖 Generated with Claude Code

csvance and others added 2 commits October 26, 2026 13:29
A request submitted to a handle that is not running, or queued for a
max_streams slot when the handle shuts down, raised FAILED_PRECONDITION.
By gRPC's status code guidance that tells the caller not to retry until the
system state is explicitly fixed. A shut-down handle is usually mid-reset
(grpc_shutdown then grpc_init, as a caller does to drop a wedged
connection), so the call can simply be retried. grpc-java reports calls on
a shut-down channel as UNAVAILABLE for the same reason.

This also makes the shutdown path consistent: in-flight requests already
fail with UNAVAILABLE (previous commit), so a caller racing a reset now
sees one retryable code whether its request was in flight, queued or new.
A load balancer forwarding through such a handle can fail over on it
instead of returning an error to its client.

The uninitialized-handle case shares the code because the two states are
indistinguishable on the handle; the message still names grpc_init().

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PuqQwzW8mJkyABmduLBbi1
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.72%. Comparing base (f9b4443) to head (7b5f783).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #147   +/-   ##
=======================================
  Coverage   92.72%   92.72%           
=======================================
  Files           8        8           
  Lines         948      949    +1     
=======================================
+ Hits          879      880    +1     
  Misses         69       69           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@csvance
csvance merged commit 6fe8550 into main Oct 26, 2026
14 of 15 checks passed
csvance referenced this pull request Oct 27, 2026
Tag 1.2.0 + DocumenterLandingPage+CodeBlocks
@csvance
csvance deleted the shutdown-unavailable branch October 27, 2026 15:57
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