burke/zeus — pull request #410 by antifuchs (2013-10-02 20:30:32+00:00)
Title: Fix Linux command spawning deadlock

This fixes #408:

On Linux, the way we send the PTY FD across the command UNIX domain socket doesn't seem to work with SOCK_STREAM sockets. The result is that the ruby command process waits for the PTY FD to come down the command socket, while the client handler waits for the ruby command process to send its PID down the command socket. Both hang, waiting for each other. Ouch.

Besides this bug, no Linux systems expert could tell me how the semantics for sending an FD down a stream sockets would actually work - I guess they would have to be out of band?

Note that this pull req is not really completed yet - since DGRAM sockets' message sizes are limited by their SO_SNDBUF, we should probably adjust that to be larger than x + the command line argument size (which is the one arbitrarily-long thing that goes down the command socket). An alternative would be to open a second (stream) socket and send the command line args down that. I think conceptual-purity wise, the two-sockets option might work best, so I'll try both and push the better one.