Commit 7fbedef
committed
Fix GC-induced thread hang on macOS with Python 3.14
Python 3.14 sets the gen-2 GC threshold to 0, so long-lived objects
(like SChunk instances in pytest fixtures) never get auto-collected.
Each SChunk carries 2×nthreads OS pthreads via its cctx/dctx. During
pytest teardown, thousands of accumulated SChunks hit macOS's 6144
thread limit, causing an indefinite hang on gc.collect().
Three fixes applied:
- Release the GIL during blosc2_schunk_free() in SChunk.__dealloc__
to prevent GIL deadlock when mass finalization triggers pthread_join
- Add periodic gc.collect() every 50 tests in conftest.py to prevent
thread accumulation past the macOS ceiling
- Cap ThreadPoolExecutor in lazyexpr.py to os.cpu_count() workers
(fixes #556)
Closes #5561 parent 2ca5eeb commit 7fbedef
3 files changed
Lines changed: 31 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
476 | 476 | | |
477 | 477 | | |
478 | 478 | | |
479 | | - | |
| 479 | + | |
480 | 480 | | |
481 | 481 | | |
482 | 482 | | |
| |||
2339 | 2339 | | |
2340 | 2340 | | |
2341 | 2341 | | |
| 2342 | + | |
2342 | 2343 | | |
2343 | 2344 | | |
2344 | 2345 | | |
2345 | 2346 | | |
2346 | 2347 | | |
2347 | 2348 | | |
2348 | 2349 | | |
2349 | | - | |
| 2350 | + | |
| 2351 | + | |
| 2352 | + | |
| 2353 | + | |
| 2354 | + | |
| 2355 | + | |
| 2356 | + | |
| 2357 | + | |
| 2358 | + | |
2350 | 2359 | | |
2351 | 2360 | | |
2352 | 2361 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1182 | 1182 | | |
1183 | 1183 | | |
1184 | 1184 | | |
1185 | | - | |
| 1185 | + | |
1186 | 1186 | | |
1187 | 1187 | | |
1188 | 1188 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
17 | 29 | | |
18 | 30 | | |
19 | 31 | | |
| |||
49 | 61 | | |
50 | 62 | | |
51 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
0 commit comments