HomePhabricator

Recover from rare EINTR signal interruptions during "stream_select(..., 0)"

Description

Recover from rare EINTR signal interruptions during "stream_select(..., 0)"

Summary:
Fixes T13243. This is generally a mess, but this patch seems like it's a step forward and refines our handling of possible conditions here.

I think this can only hurt us if there's some error condition where all of these are true:

  • fwrite() returns 0.
  • stream_select() errors.
  • The stream is legitimately in a dead/error/failures state and should not be retried.

Ideally, this shouldn't exist. But it's hard to be terribly confident that this is actually true.

(I'll hold this until after the release cut.)

Test Plan: In T13243, blocked a pipe to sleep 15, then interrupted a stream_select() by sending SIGHUP to the writing process. Saw 0 from fwrite() plus false from stream_select().

Reviewers: amckinley

Reviewed By: amckinley

Subscribers: joshuaspence

Maniphest Tasks: T13243

Differential Revision: https://secure.phabricator.com/D20083