Commit 5bdb1f8
test: fix flaky test-watch-mode-inspect timeout
This test randomly times out (~120s) on CI due to a race condition
between child-process restart (triggered by touching the watched file)
and the second inspector-session connection.
The old code used an interval-based restart (write every 500ms) and
a 'gettingDebuggedPid' flag to pause writes during a session. This
still left a race window where getDebuggedPid() would attempt to
connect the inspector via HTTP GET /json/list + WebSocket upgrade
either before the new child was ready (empty target list) or after
the old session was being destroyed, causing the promise to hang.
Fix: Replace the interval with a single write that triggers exactly
one restart, then wait for the restarted child's 'safe to debug now'
stdout line before connecting the second inspector session. This
eliminates the race by ensuring the new child process and its
inspector session are fully ready before any connection attempt.
Removes the now-unused gettingDebuggedPid flag and the pending
setTimeout delay that was needed as a backstop for the interval.
Fixes: #44898
Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: #63361
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>1 parent 9a394ba commit 5bdb1f8
1 file changed
Lines changed: 12 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
15 | | - | |
16 | | - | |
17 | 14 | | |
18 | | - | |
19 | 15 | | |
20 | 16 | | |
21 | 17 | | |
| |||
25 | 21 | | |
26 | 22 | | |
27 | 23 | | |
28 | | - | |
29 | 24 | | |
30 | 25 | | |
31 | 26 | | |
32 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
33 | 36 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 37 | + | |
40 | 38 | | |
41 | 39 | | |
| 40 | + | |
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
| |||
51 | 50 | | |
52 | 51 | | |
53 | 52 | | |
54 | | - | |
| 53 | + | |
55 | 54 | | |
56 | | - | |
57 | 55 | | |
58 | | - | |
59 | 56 | | |
60 | 57 | | |
61 | 58 | | |
| |||
0 commit comments