select(2) is just a hint (Was: Re: [Twisted-Python] ENOBUF and Twisted)

Andrew Bennetts andrew-twisted at puzzling.org
Fri Aug 20 05:25:46 EDT 2004


On Fri, Aug 20, 2004 at 10:30:21AM +0300, Tommi Virtanen wrote:
> Andrew Bennetts wrote:
> >Well, the problem is that currently the select reactor assumes that if
> >select says a socket is writeable, then it is writeable, i.e it is safe
> >to attempt to write any amount of data to it (with the understanding that
> >being non-blocking it might only be able to accept some of that data
> >immediately).  Apparently this assumption is not quite accurate.
> 
> That's not a safe assumption under UNIX. select(2) is just a hint; writing
[...]
> 
> 	Process 1			Process 2
> 	select() says fd 4 writable
> 					select() says fd 4 writable
> 	write(4, ...) success
> 					write(4, ...) = -1, EAGAIN

In this case, at least, I believe the Twisted select reactor still does the
right thing, because accepting no data is just an extreme case of accepting
only some data ;)

-Andrew.





More information about the Twisted-Python mailing list