taf2/curb — pull request #135 by VivienBarousse (2012-11-08 15:10:09+00:00)
Title: Fix for issue 117, exception raised when process is signaled

We ran into issue 117 recently when migrating a Rails application to Unicorn. Our Rails application communicates with back-end services using Curb. The situation we ran into is the following:
- When shutting down Unicorn (in order to deploy a new version of our app, for example), Unicorn sends a SIGQUIT signal to all its workers to tell them to shutdown gracefully.
- If any of those worker is waiting on a select() call inside curb, the signal interrupts the system call, and curb raises a Ruby exception, that interrupts the request.

This is caused by the kernel interrupting the select() calls when processes running curb are signaled. The select() calls returns -1, with an errno equal to EINTR. The correct behaviour in that case should be to retry the select() call.

The commit in this PR changes this behaviour, by ignoring errors if and only if the errno is set to EINTR. In all other cases, the error still raises an exception.