From 5a19ffc1cb98d3d80cf39020c48c1c44173f223c Mon Sep 17 00:00:00 2001 From: Cameron Finucane Date: Fri, 23 Aug 2024 12:10:38 -0700 Subject: 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. --- executor/conn.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'executor') 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"); } -- cgit mrf-deployment