◐ Shell
clean mode source ↗

Message 136090 - Python tracker

> Thus,
> Connection.recv_bytes() will be called:
> 
>     def _recv_bytes(self, maxsize=None):
>         buf = self._recv(4)
>         size, = struct.unpack("=i", buf.getvalue())
>         if maxsize is not None and size > maxsize:
>             return None
>         return self._recv(size)
> 
> The first _recv() will succeed, since the length is in the Pipe.
> The second one, however, will remain stuck on the read from the
> pipe/unix socket, because there's no more data.
> This can be reproduced easily by adding a short sleep right after the
> sending of the length of the buffer inside send_bytes(), and then
> sending a SIGKILL to a worker process.

That's true. We would need to insert a select() before each raw read().