Skip to content

common/interrupt: close connections outside group lock - #4329

Open
embogomolov wants to merge 232 commits into
SagerNet:testingfrom
embogomolov:fix/interrupt-group-deadlock
Open

common/interrupt: close connections outside group lock#4329
embogomolov wants to merge 232 commits 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 15 times, most recently from fcd1c18 to 3429352 Compare July 28, 2026 01: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.

Nested interrupt groups can deadlock during connection interruption

6 participants