Skip to content

Commit

Permalink
executor: handle EINTR when reading from control pipe
Browse files Browse the repository at this point in the history
Handle EINTR errors. Sometimes I see them happenning when running in debug mode.
Before the previous commit, each such error was printed to output and detected
as a bug. Without debug these should be retried by restarting the process,
but still better to handle w/o restarting the process (may be expensive).
  • Loading branch information
dvyukov committed Jul 8, 2024
1 parent e03bdbc commit cde64f7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions executor/executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -721,11 +721,11 @@ void receive_handshake()
void receive_execute()
{
execute_req req = {};
ssize_t n = read(kInPipeFd, &req, sizeof(req));
ssize_t n = 0;
while ((n = read(kInPipeFd, &req, sizeof(req))) == -1 && errno == EINTR)
;
if (n != (ssize_t)sizeof(req))
failmsg("control pipe read failed", "read=%zd want=%zd", n, sizeof(req));
if (req.magic != kInMagic)
failmsg("bad execute request magic", "magic=0x%llx", req.magic);
request_id = req.id;
flag_collect_signal = req.exec_flags & (1 << 0);
flag_collect_cover = req.exec_flags & (1 << 1);
Expand Down

0 comments on commit cde64f7

Please sign in to comment.