Skip to content

adapter: fix unknown-connection panic on abandoned failed startup - #37988

Merged
ggevay merged 1 commit into
MaterializeInc:mainfrom
ggevay:repro-terminate-unknown-conn
Jul 31, 2026
Merged

ggevay merged 1 commit into
MaterializeInc:mainfrom
ggevay:repro-terminate-unknown-conn

Conversation

@ggevay

@ggevay ggevay commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Fixes a Coordinator panic seen in incident-1183 (https://materializeinc.slack.com/archives/C0BLZBH1SEA):

unknown connection: Dynamic(IdHandleInner { id: ..., .. })

A connection is registered in active_conns only when startup succeeds. The cleanup guard in Client::startup sent a Terminate command whenever the startup response was left unobserved, including when it was an error, which happens when a client abandons a startup that failed (realistically via the HTTP endpoint, whose handler futures are dropped when the client disconnects or times out). The Coordinator then hit the "unknown connection" assertion in handle_terminate and aborted.

The fix sends Terminate only when the unobserved response was a successful startup. A failed startup leaves no per-connection state anywhere in the Coordinator, so there is nothing to clean up. This invariant is now documented on handle_startup_inner, and the related comments on the startup error path, handle_terminate, and the Command::Startup dispatch site state it as well.

Testing

  • Extended test_concurrent_id_reuse (renamed to test_termination_races, nextest override updated) with a deterministic second phase on the same server: it abandons a failed startup and asserts the Coordinator survives. Without the fix, the phase fails with the exact production panic. It adds no measurable runtime to the test.
  • environmentd::Server now exposes the adapter client for tests, gated behind the test feature.

🤖 Generated with Claude Code

The cleanup guard in Client::startup sent a Terminate command whenever
the startup response was left unobserved, including when it was an
error. A failed startup never registers the connection in active_conns,
so the Coordinator panicked on such a Terminate with "unknown
connection" (incident-1183).

Send Terminate only for an unobserved successful startup, document the
no-state-on-failed-startup invariant, and extend
test_concurrent_id_reuse (renamed to test_termination_races) with a
deterministic regression test.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018fo6yH9ymTx8Fwnfa5JpUt
@ggevay ggevay added the A-ADAPTER Topics related to the ADAPTER layer label Jul 31, 2026
@ggevay
ggevay marked this pull request as ready for review July 31, 2026 15:56
@ggevay
ggevay requested review from a team as code owners July 31, 2026 15:56

@SangJunBak SangJunBak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for the test!

@ggevay
ggevay merged commit 443b75e into MaterializeInc:main Jul 31, 2026
129 checks passed
bosconi pushed a commit that referenced this pull request Aug 4, 2026
Adds the rc.2 increment to the v26.36.0 section of the releases index: one
bug fix (#37988), a coordinator panic when a client abandoned a connection
attempt that had already failed.

Dates are unchanged — the provisional Cloud 2026-08-06 / Self-Managed
2026-08-07 pair is still the first Thursday strictly after the rc.1 tag
commit, so the operator-compatibility YAML needs no edit this snapshot.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ADAPTER Topics related to the ADAPTER layer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants