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 23 times, most recently from 2dea956 to 4ebd113 Compare August 10, 2026 10:43
@nekohasekai
nekohasekai force-pushed the testing branch 7 times, most recently from 4902660 to 14cca98 Compare August 12, 2026 05:41
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