[Twisted-Python] linux kernel 2.6.11-rc broke twisted process pipes
andrea at cpushare.com
Mon Feb 28 23:15:36 EST 2005
On Mon, Feb 28, 2005 at 10:40:00PM -0500, James Y Knight wrote:
> Right. Twisted treats all of POLLERR/HUP/NVAL the same, anyways.
> Nope -- Notice that rpipe and wpipe are backwards for the read and
> write fds. "rpipe" on the write fd won't ever have any data in it.
> (Except of course that pipes in BSD are bidirectional!). In BSD,
I didn't know it was bidirectional, I thought the peer pointer pointed
to the other side of the pipe like in linux, and not the other direction
of the same side.
> Yes, it will get called, because linux returns (returned?)
> POLLERR|POLLIN when the other side is closed. pollreactor doesn't
It return_ed_ POLLERR|POLLIN, correct.
Now it returns only POLLERR for a wronly fd and only POLLHUP for a
rdonly fd which seems even more correct since it will prevent the
suprious doRead call with pollreactor.
> assume the connection was lost immediately when POLLERR/etc is set, if
> POLLIN is also set, because POLLIN|POLLHUP means there is more data
> available to be read from the kernel buffer that was sent before the
> connection closed. And, since normal transport implementations of
Yep, except that's a wronly fd so calling doRead can only detect a
disconnect that is already detected thanks to the pollerr.
> doRead actually do try to read, if it was lying about POLLIN, that's
> okay: the read syscall will fail, and CONNECTION_LOST will be returned
> from doRead.
Ok. So I'll take the exception path. The exception should be ValueError:
filedescriptor out of range in select(). Anyway with the new patched
kernel I'm running and with latest 2.6.11 this shouldn't happen anymore
because POLLIN isn't set ;).
Thanks a lot for all the help, this clarified many things.
More information about the Twisted-Python