Commit d30278c
committed
Fix EventletConnection close() race causing EBADF errors (#614)
EventletConnection.close() uses blocking kill() which mostly prevents
races, but if close() is called from a non-eventlet thread the
greenthread may not be interrupted as expected.
- Add is_closed/is_defunct guards in handle_read() and handle_write()
error paths to silently exit during shutdown
- Set last_error in close() when connected_event is not yet set to
prevent factory() from returning a dead connection
- Set last_error on server-initiated close (EOF) in handle_read()1 parent f348637 commit d30278c
1 file changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
152 | 155 | | |
153 | 156 | | |
154 | 157 | | |
| |||
185 | 188 | | |
186 | 189 | | |
187 | 190 | | |
| 191 | + | |
| 192 | + | |
188 | 193 | | |
189 | 194 | | |
190 | 195 | | |
| |||
0 commit comments