Skip to content

Return an error when runtime shutdown cancels address resolution - #76

Merged
mystenmark merged 2 commits into
mainfrom
mlogan-resolve-cancel
Oct 8, 2026
Merged

mystenmark merged 2 commits into
mainfrom
mlogan-resolve-cancel

Conversation

@mystenmark

@mystenmark mystenmark commented Oct 8, 2026 •

Copy link
Copy Markdown

Description

Address::resolve ran DNS resolution with spawn_blocking(..).await.unwrap(). spawn_blocking is fallible: when a process drops its tokio runtime, the blocking pool cancels new tasks while async tasks can still be polled briefly, so the unwrap panicked during graceful shutdown. A cancelled task now returns an Interrupted io::Error, which resolve's callers already handle; a panic in the resolver is resumed.

Found by Sui simtests that model graceful shutdown (runtime drop) in mysten-sim.

A second commit allows clippy::result_large_err, which clippy 1.99 (used by CI's stable) reports for functions returning anemo::rpc::Status by value. Boxing Status would change the public and generated APIs, so the lint is allowed on the two rpc functions and in the generated client and server modules.

Test plan

New unit test resolves an address on a runtime whose blocking pool is shut down and expects Interrupted; it fails with the old unwrap.

🤖 Generated with Claude Code

spawn_blocking is fallible: dropping the tokio runtime cancels new
blocking tasks while async tasks can still be polled briefly. resolve()
unwrapped the JoinError and panicked; it now returns an Interrupted
io::Error and resumes panics from the closure.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@mystenmark
mystenmark requested a review from bmwill October 8, 2026 16:58
Clippy 1.99 flags functions returning anemo::rpc::Status by value. Boxing
it would change the public and generated APIs, so allow the lint on the
two rpc functions and in the generated client and server modules, which
downstream crates compile.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@mystenmark
mystenmark merged commit 845a9b5 into main Oct 8, 2026
4 checks passed
@mystenmark
mystenmark deleted the mlogan-resolve-cancel branch October 8, 2026 17:07
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.

3 participants