Commit 4e24efa
committed
fix(envd): fix EndEvent delivery race when process is killed with orphan children
After cmd.Wait() reaps the child, use SetReadDeadline on the pipe
read-ends so readers drain any buffered data (reads with available
data return instantly) then exit on deadline instead of blocking
forever when an orphan grandchild holds the write-end open. Readers
treat the deadline timeout the same as EOF — clean exit, no data
loss.
Add a dedicated readersDone channel that closes when stdout/stderr
reader goroutines actually exit, replacing the outCtx/outCancel
mechanism which is no longer needed.
Fixes TestStart_OrphanGrandchildDoesNotHangStream and the
TestCommandKillNextApp CI failure.1 parent abb4404 commit 4e24efa
1 file changed
Lines changed: 21 additions & 34 deletions
Lines changed: 21 additions & 34 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
| 54 | + | |
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
| |||
173 | 172 | | |
174 | 173 | | |
175 | 174 | | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | 175 | | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
190 | 184 | | |
191 | 185 | | |
192 | 186 | | |
| |||
267 | 261 | | |
268 | 262 | | |
269 | 263 | | |
270 | | - | |
| 264 | + | |
271 | 265 | | |
272 | 266 | | |
273 | 267 | | |
| |||
316 | 310 | | |
317 | 311 | | |
318 | 312 | | |
319 | | - | |
| 313 | + | |
320 | 314 | | |
321 | 315 | | |
322 | 316 | | |
| |||
343 | 337 | | |
344 | 338 | | |
345 | 339 | | |
346 | | - | |
| 340 | + | |
347 | 341 | | |
348 | | - | |
| 342 | + | |
349 | 343 | | |
350 | 344 | | |
351 | 345 | | |
| |||
364 | 358 | | |
365 | 359 | | |
366 | 360 | | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | 361 | | |
372 | 362 | | |
373 | 363 | | |
| |||
473 | 463 | | |
474 | 464 | | |
475 | 465 | | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
487 | 472 | | |
488 | 473 | | |
| 474 | + | |
| 475 | + | |
489 | 476 | | |
490 | 477 | | |
491 | 478 | | |
| |||
0 commit comments