This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Justin.Cappos
Recipients Justin.Cappos, bbangert, exarkun, giampaolo.rodola, loewis, ned.deily, nicdumz, pitrou, ronaldoussoren, roysmith
Date 2010-11-21.19:26:16
SpamBayes Score 9.97598e-11
Marked as misclassified No
Message-id <1290367578.28.0.784774582897.issue7995@psf.upfronthosting.co.za>
In-reply-to
Content
> Apparently, the designers of BSD thought differently. Remember that
> it is them who defined the socket API in the first place, so they
> have the right that their design decisions are considered.

I think there is a bit of confusion here.   The 'bug' isn't with different socket semantics on different OSes.   The bug is that the programmer who wrote the wrapper for sockets on Python assumed the OS semantics weren't the BSD style.   


Here is the issue (put plainly):

Python sockets support a notion of timeout  (note this notion is not reflected in the OS socket API).

The python socket implementation of timeouts uses the underlying OS / socket API to provide this by setting the socket to nonblocking and setting a timeout value in a Python object that holds socket info.

This implementation assumes that the OS sets any socket it receives via accept to nonblocking.   (this is a false assumption on BSD)

The end result is that the OS has a nonblocking socket and the Python object thinks it is blocking.   This is why the socket object in Python has timeout=None yet calling fcntl shows the socket is nonblocking.

Calling code paths that handle timeouts and expect the socket to block causes bugs like I described in my code.   This behavior is clearly wrong under any interpretation!


You can debate whether the right patch is to use what I proposed or instead change new Python sockets to inherit the timeout / blocking setting on BSD.   However, what is implemented now is clearly broken.
History
Date User Action Args
2010-11-21 19:26:18Justin.Cappossetrecipients: + Justin.Cappos, loewis, ronaldoussoren, exarkun, roysmith, pitrou, giampaolo.rodola, ned.deily, nicdumz, bbangert
2010-11-21 19:26:18Justin.Cappossetmessageid: <1290367578.28.0.784774582897.issue7995@psf.upfronthosting.co.za>
2010-11-21 19:26:16Justin.Capposlinkissue7995 messages
2010-11-21 19:26:16Justin.Capposcreate