Skip to content

common/interrupt: close connections outside group lock#4329

Open
embogomolov wants to merge 1 commit into
SagerNet:testingfrom
embogomolov:fix/interrupt-group-deadlock
Open

common/interrupt: close connections outside group lock#4329
embogomolov wants to merge 1 commit into
SagerNet:testingfrom
embogomolov:fix/interrupt-group-deadlock

Conversation

@embogomolov

Copy link
Copy Markdown

Remove matching connections from the group while holding the mutex, then close them after releasing it. This prevents lock inversion between nested interrupt groups.

Added a regression test that deadlocks on the current code and passes with this change. go test ./common/interrupt passes across 100 repeated runs.

Fixes #4328

@nekohasekai
nekohasekai force-pushed the testing branch 10 times, most recently from 03c3bf4 to f60f372 Compare July 25, 2026 14:58
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.

Nested interrupt groups can deadlock during connection interruption

1 participant