Skip to content

🧵 Fix deadlock in #disconnect#686

Merged
nevans merged 1 commit into
masterfrom
fix-disconnect-deadlock
Jun 4, 2026
Merged

🧵 Fix deadlock in #disconnect#686
nevans merged 1 commit into
masterfrom
fix-disconnect-deadlock

Conversation

@nevans

@nevans nevans commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

#disconnect could deadlock when called inside the mutex, because the receiver thread could be signaling a condition variable and it would thus be unable to resume until the current thread releases its lock.

Also, #disconnect shouldn't raise IO#shutdown exceptions on the receiver thread prior to closing the socket, when it is being called from the receiver thread. The exception is still raised, after the socket is closed.

`#disconnect` could deadlock when called inside the mutex, because the
receiver thread could be signaling a condition variable and it would
thus be unable to resume until the current thread releases its lock.

Also, `#disconnect` shouldn't raise `IO#shutdown` exceptions on the
receiver thread prior to closing the socket, when it is being called
from the receiver thread.  The exception is still raised, _after_ the
socket is closed.
@nevans nevans added the bug Something isn't working label Jun 4, 2026
@nevans nevans merged commit aab64f9 into master Jun 4, 2026
39 checks passed
@nevans nevans deleted the fix-disconnect-deadlock branch June 4, 2026 17:08
nevans added a commit that referenced this pull request Jun 9, 2026
`#disconnect` could deadlock when called inside the mutex, because the
receiver thread could be signaling a condition variable and it would
thus be unable to resume until the current thread releases its lock.

Also, `#disconnect` shouldn't raise `IO#shutdown` exceptions on the
receiver thread prior to closing the socket, when it is being called
from the receiver thread.  The exception is still raised, _after_ the
socket is closed.
nevans added a commit that referenced this pull request Jul 2, 2026
`#disconnect` could deadlock when called inside the mutex, because the
receiver thread could be signaling a condition variable and it would
thus be unable to resume until the current thread releases its lock.

Also, `#disconnect` shouldn't raise `IO#shutdown` exceptions on the
receiver thread prior to closing the socket, when it is being called
from the receiver thread.  The exception is still raised, _after_ the
socket is closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

1 participant