Commit b3cf697
committed
Fix deadlock on Ctrl+C in server mode
The INT/TERM trap handler called shutdown, which closed the TCP server
socket from the same thread blocked on accept, causing a
ThreadError (deadlock; recursive locking).
Replace the trap-based shutdown with rescue Interrupt around the
accept loop. Move cleanup into an ensure block so it runs on any
exit path.1 parent 3c6f5f6 commit b3cf697
2 files changed
Lines changed: 3 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
546 | 546 | | |
547 | 547 | | |
548 | 548 | | |
549 | | - | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | 549 | | |
554 | 550 | | |
555 | 551 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
95 | | - | |
96 | 94 | | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
103 | 98 | | |
104 | 99 | | |
105 | 100 | | |
| |||
0 commit comments