Jean Spector
Jean Spector

Reputation: 1116

epoll_wait hangs after a large write to a dead process' non-blocking pipe returns EAGAIN

Scenario:

It looks like the difference between the successful and the hung runs is this:

Successful runs: write attempt fails with errno=EPIPE, which is then handled

Failed runs: the first 64K are written successfully (presumably filling the buffer), next write returns -1 with errno=EAGAIN, then epoll_wait is called with EPOLLOUT without a timeout (to wait for the buffer to clear under normal circumstances) - AND it never returns

I tried:

Note 1: This seems to be an epoll's quirk, and if so - I'd appreciate a recommended workaround

Note 2: I have a solution that works around the hang, but I'm not sure it's a great one - so will hold off sharing it to not skew the answers

Upvotes: 1

Views: 53

Answers (0)

Related Questions