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 25 times, most recently from 39f0941 to 4902660 Compare August 11, 2026 04:01
@nekohasekai
nekohasekai force-pushed the testing branch 5 times, most recently from cae3903 to c82b9b8 Compare August 17, 2026 09:08
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