[issue8493] socket's send can raise errno 35 under OS X, which causes problems in sendall

Charles-Francois Natali report at bugs.python.org
Mon Apr 26 11:22:46 CEST 2010

Charles-Francois Natali <neologix at free.fr> added the comment:

> That's what I thought at first too. But the user's sockets were set to blocking.

That's one broken networking stack...

> In fact, I think it's a little silly that OS X raises the error rather than just saying that 0 bytes were sent (which is what I suppose that other OSes do).

"Normal" OS just block inside the send() call whenever socket buffers are full (unless there're set to non-blocking). So you can resume sending as soon as buffer space is available, and you don't have to resort to this send()/fail/sleep/re-send() scheme... 

> But I think it's also not ideal that Python's socket.sendall() can't be used with confidence under OS X because it can fail under pretty normal circumstances.

Agreed, but it's really a OS X issue here. How would you circumvent this problem anyway ? Add a timeout option to sendall() as a hint to how much we should wait before retrying when errno 35 is returned ? It would be really hacky...

Maybe the user could try increasing SO_SNDBUF, but this won't necessarily solve his problem...

@exarkun: ideas on this ?


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list