diff options
| author | Cameron Finucane <eep@google.com> | 2024-08-23 12:10:38 -0700 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2024-08-30 07:15:14 +0000 |
| commit | 5a19ffc1cb98d3d80cf39020c48c1c44173f223c (patch) | |
| tree | 6b143177e1e3d21b4ef9e892b0dc1cf2ef3d0909 /executor | |
| parent | ee2602b8aa3e172d05dbaff914a78720b3dd04f9 (diff) | |
executor: retry pselect() when interrupted
Occasionally a SIGCHLD would cause EINTR to be returned by pselect(),
and then the runner would become hung by attempting to read a socket
that was not in fact ready.
Diffstat (limited to 'executor')
| -rw-r--r-- | executor/conn.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/executor/conn.h b/executor/conn.h index e3d601326..e1f3f7d0d 100644 --- a/executor/conn.h +++ b/executor/conn.h @@ -209,7 +209,10 @@ public: void Wait(int ms) { timespec timeout = {.tv_sec = ms / 1000, .tv_nsec = (ms % 1000) * 1000 * 1000}; - if (pselect(max_fd_ + 1, &rdset_, nullptr, nullptr, &timeout, nullptr) < 0) { + for (;;) { + if (pselect(max_fd_ + 1, &rdset_, nullptr, nullptr, &timeout, nullptr) >= 0) + break; + if (errno != EINTR && errno != EAGAIN) fail("pselect failed"); } |
