Repository navigation
Commit 15922df
Keep the process alive while the request-timeout stub waits to be abandoned
The previous commit fixed a real defect in this stub and not the one that was
breaking CI. The tests were still cancelled, identically, and the reason it
looked like a loaded-runner race was that it reproduces on Node 22 *in
isolation on an idle machine* — CI runs Node 22 to match apps/*/Dockerfile,
while local development is on Node 24.
`AbortSignal.timeout()` schedules an **unref'd** timer. That is deliberate: a
pending deadline must not hold a program open. Verified identical on both
versions — a script whose only pending work is such a deadline exits in 1ms
under 22 and 24 alike.
In production nothing notices, because the real in-flight fetch holds a socket
open and the loop stays alive until the deadline fires. A stub that returns a
promise and does nothing else gives the loop no reason to stay awake at all, so
it drains and the runner reports "Promise resolution is still pending but the
event loop has already resolved" and cancels the file. Node 24's test runner
happens to keep the loop alive and Node 22's does not, which is the whole of
the difference between green locally and red in CI.
So the stub now holds a ref'd timer for the life of the request it is standing
in for, cleared on every exit. Verified on both: 4 passed, 0 cancelled under
Node 22 and Node 24, and the full workspace suite is clean under Node 22.
The `aborted` check from the previous commit stays. It was a genuine fault —
a listener added after the event has fired never hears it — and would have bitten
as soon as a deadline beat the stub to its first line.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 7dff2b3 commit 15922df
1 file changed
Lines changed: 31 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
24 | 31 | | |
25 | 32 | | |
26 | 33 | | |
| |||
29 | 36 | | |
30 | 37 | | |
31 | 38 | | |
32 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
33 | 53 | | |
34 | | - | |
| 54 | + | |
35 | 55 | | |
36 | 56 | | |
37 | | - | |
| 57 | + | |
38 | 58 | | |
39 | 59 | | |
40 | 60 | | |
| |||
0 commit comments