Skip to content

GH-909: Fix KexOutputHandler self-deadlock on inline write failure during shutdown#910

Open
zimmermq wants to merge 1 commit into
apache:dev_3.0from
zimmermq:GH-909-kexoutputhandler-deadlock
Open

GH-909: Fix KexOutputHandler self-deadlock on inline write failure during shutdown#910
zimmermq wants to merge 1 commit into
apache:dev_3.0from
zimmermq:GH-909-kexoutputhandler-deadlock

Conversation

@zimmermq

Copy link
Copy Markdown

Fixes #909.

When a write started under the read lock in writeOrEnqueue() fails inline, the session close re-enters KexOutputHandler.shutdown()updateState()`, which tries to take the write lock on the same thread — an illegal read-to-write upgrade that self-deadlocks.

Fix: in shutdown(), when the current thread already holds the read lock (getReadHoldCount() > 0), update the state without acquiring the write lock. The read lock already excludes writers, so it stays consistent; KEX write-ordering is unchanged.

Includes a deterministic regression test (hangs without the fix, passes with it).

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.

1 participant