Commit acf2793
fix(test): prevent watcher_integration leaking threads/tempdirs on panic
Root-caused the 'all-languages' CI job's flaky/multi-hour hangs: each of
the 3 tests in watcher_integration.rs spawns a background watcher thread,
then does `ready_rx.recv_timeout(10s).expect(...)` before its later
`ct.cancel(); handle.join(); remove_dir_all(...)` cleanup. Under the heavy
parallel CPU/IO load the all-languages job creates (12 opt-in language
grammars + scip-overlay + lsp-overlay compiled/tested together), the
watcher's arm+initial-reconciliation step can miss that 10s window; the
resulting panic unwinds past the cleanup lines entirely, leaking a live
watcher thread and its temp project dir for the rest of the process's
life. Reproduced locally under this same load (watcher_hot_reloads_
coverage_file_change failed with exactly this timeout).
Adds a WatchGuard (Drop-based RAII) so cancel/join/cleanup always run,
panic or not, and widens the ready-wait from 10s to 30s to match the
other bounded waits already used in this file. This does not change
crates/calm-server/src/watch_supervisor.rs's actual arm+reconcile
behavior -- that's a separate, bigger design question (signal armed
before vs. after reconciliation) intentionally left for a follow-up.
Verified: cargo test -p calm-server --test watcher_integration (3/3
pass), cargo clippy -p calm-server --all-targets -- -D warnings clean.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent e42a5d0 commit acf2793
1 file changed
Lines changed: 50 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
12 | 38 | | |
13 | 39 | | |
14 | 40 | | |
| |||
76 | 102 | | |
77 | 103 | | |
78 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
79 | 111 | | |
80 | 112 | | |
81 | 113 | | |
82 | 114 | | |
83 | | - | |
84 | | - | |
| 115 | + | |
| 116 | + | |
85 | 117 | | |
86 | 118 | | |
87 | 119 | | |
| |||
91 | 123 | | |
92 | 124 | | |
93 | 125 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | 126 | | |
99 | 127 | | |
100 | 128 | | |
| |||
157 | 185 | | |
158 | 186 | | |
159 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
160 | 194 | | |
161 | | - | |
162 | | - | |
| 195 | + | |
| 196 | + | |
163 | 197 | | |
164 | 198 | | |
165 | 199 | | |
| |||
186 | 220 | | |
187 | 221 | | |
188 | 222 | | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | 223 | | |
194 | 224 | | |
195 | 225 | | |
| |||
274 | 304 | | |
275 | 305 | | |
276 | 306 | | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
277 | 313 | | |
278 | | - | |
279 | | - | |
| 314 | + | |
| 315 | + | |
280 | 316 | | |
281 | 317 | | |
282 | 318 | | |
| |||
288 | 324 | | |
289 | 325 | | |
290 | 326 | | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | 327 | | |
296 | 328 | | |
297 | 329 | | |
| |||
0 commit comments