Repository navigation
Commit 6412396
authored
ci(bun): restore the worker idle memory limit and end a Bun worker from itself (#21646)
* ci(bun): restore the worker idle memory limit
The limit bounds each worker thread's heap; without it the suite grows until the
runner is out of memory. Dropping it in #21629 traded Bun's segfault for an OOM.
* ci(bun): end a Bun worker from itself instead of terminating it
Bun segfaults when jest terminates a worker thread from the parent on an
idle-memory restart, a different wild address each time and workers_terminated
short of workers_spawned. Sending the end message jest already uses for shutdown
lets the worker leave on its own. Guarded on Bun, so Node and Deno still
terminate. Reproduced with a low limit: terminate crashes 5/5, ending 3/3 passes.
* ci(bun): exit a Bun worker once it has ended, so the pool replaces it
Ending a worker only removes its message listener; the thread leaves only if
that was its last handle. A jest worker that leaked one therefore stayed alive
in the RESTARTING state forever — reproduced with a worker holding a timer:
the idle-memory limit tripped (1.63 MB over a 1 MB limit), the restart was
requested, and the next task still ran on the same thread. The limit had
become a no-op for that worker, which is the one thing it exists to do.
The worker now exits itself after teardown, on Bun only. Same reproduction:
the state returns to `ok` and the next task runs on a new thread.1 parent 1b246ec commit 6412396
3 files changed
Lines changed: 39 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
342 | 343 | | |
343 | 344 | | |
344 | 345 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
1 | 20 | | |
2 | | - | |
| 21 | + | |
3 | 22 | | |
4 | 23 | | |
5 | 24 | | |
| |||
16 | 35 | | |
17 | 36 | | |
18 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
0 commit comments