Commit 1722fb1
committed
gh-109047: concurrent.futures catches PythonFinalizationError
concurrent.futures: The 'executor manager thread' now catches PythonFinalizationError, it calls terminate_broken(). The exception occurs while Python is being finalized when adding an item to the 'call queue' tries to create a new 'queue feeder' thread. Add test_python_finalization_error() to test_concurrent_futures. concurrent.futures._ExecutorManagerThread changes: * terminate_broken() no longer calls shutdown_workers() since the queue is no longer working anymore (read and write ends of the queue pipe are closed). * terminate_broken() now terminates child processes. * wait_result_broken_or_wakeup() now uses the short form of traceback.format_exception(). multiprocessing.Queue changes: * Add _terminate_broken() method. * _start_thread() sets _thread to None on exception to prevent leaking "dangling threads" even if the thread was not started yet.1 parent 6d969f3 commit 1722fb1
File tree
4 files changed
+65
-17
lines changed- Lib
- concurrent/futures
- multiprocessing
- test/test_concurrent_futures
- Misc/NEWS.d/next/Library
4 files changed
+65
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
344 | | - | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
345 | 350 | | |
346 | 351 | | |
347 | 352 | | |
| |||
425 | 430 | | |
426 | 431 | | |
427 | 432 | | |
428 | | - | |
429 | | - | |
| 433 | + | |
| 434 | + | |
430 | 435 | | |
431 | 436 | | |
432 | 437 | | |
| |||
515 | 520 | | |
516 | 521 | | |
517 | 522 | | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
| 523 | + | |
525 | 524 | | |
526 | 525 | | |
527 | | - | |
| 526 | + | |
528 | 527 | | |
529 | 528 | | |
530 | 529 | | |
| |||
567 | 566 | | |
568 | 567 | | |
569 | 568 | | |
570 | | - | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
571 | 574 | | |
572 | 575 | | |
573 | 576 | | |
| |||
576 | 579 | | |
577 | 580 | | |
578 | 581 | | |
| 582 | + | |
| 583 | + | |
579 | 584 | | |
580 | 585 | | |
581 | 586 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
161 | 174 | | |
162 | 175 | | |
163 | 176 | | |
| |||
169 | 182 | | |
170 | 183 | | |
171 | 184 | | |
172 | | - | |
| 185 | + | |
| 186 | + | |
173 | 187 | | |
174 | | - | |
175 | 188 | | |
176 | | - | |
177 | | - | |
178 | | - | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
179 | 196 | | |
180 | 197 | | |
181 | 198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
187 | 188 | | |
188 | 189 | | |
189 | 190 | | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
190 | 212 | | |
191 | 213 | | |
192 | 214 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
0 commit comments