Commit ac1f652
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 b4e4b59 commit ac1f652
1 file changed
Lines changed: 10 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 | | |
| |||
162 | 165 | | |
163 | 166 | | |
164 | 167 | | |
| 168 | + | |
| 169 | + | |
165 | 170 | | |
166 | 171 | | |
167 | 172 | | |
| |||
174 | 179 | | |
175 | 180 | | |
176 | 181 | | |
| 182 | + | |
| 183 | + | |
177 | 184 | | |
178 | 185 | | |
179 | 186 | | |
| |||
185 | 192 | | |
186 | 193 | | |
187 | 194 | | |
| 195 | + | |
| 196 | + | |
188 | 197 | | |
189 | 198 | | |
190 | 199 | | |
| |||
0 commit comments