Commit c3d94a5
committed
Fix pipe read race in exec_service server
SetReadDeadline(time.Now()) can fire before the read loop consumes
buffered pipe data. Go's poller checks the deadline before attempting
syscall.Read, so ErrDeadlineExceeded is returned and buffered output
is silently dropped.
Fix: kill the process group after cmd.Wait() so background children
close their inherited pipe fds, letting the read loop reach EOF
without any deadline. A 100ms deadline fallback handles the rare case
of children that escaped the process group (e.g. via setsid).
Reproducer (fails 10/10 without the fix):
bazel test //exec_service/cmd/exec_client:exec_client_test \
--test_arg=-test.run=TestStderrOutput \
--test_arg=-test.count=500 \
--test_arg=-test.cpu=1 \
--runs_per_test=10 --local_test_jobs=101 parent 14c6373 commit c3d94a5
1 file changed
+8
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
66 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
70 | | - | |
| 73 | + | |
| 74 | + | |
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
| |||
0 commit comments