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 kristjan.jonsson
Recipients kristjan.jonsson
Date 2011-03-30.12:17:21
SpamBayes Score 3.7359e-14
Marked as misclassified No
Message-id <>
I found this defect at PyCon 2011 after spending a lot of type fidgeting with ssl.  The unittest was using timeout on accept sockets and it was working fine there, but not with the code I was working out.  Turns out that resets the timeout state of sockets, but not regular sockets.

In short:  If you have a socket with settimeout(1), then accept a connection on it, the new socket will have gettimeout()==None, but its state will still (internally) be non-blocking.  The attached script demonstrates the issue.

This is an issue with all versions of python from 2.5 upwards.

There are basically two things we can do to fis this:
1) retain gettimeout()=None but internally make sure we set the resulting socket to blocking mode
2) have the accepted socket inherit the timeout properties of the parent socket properly, and so inherit its timeout value too.

Number 2 is more in line with expected BSD socket behaviour that sockets at least inherit the non-blocking attribute of their parent socket.
Date User Action Args
2011-03-30 12:17:22kristjan.jonssonsetrecipients: + kristjan.jonsson
2011-03-30 12:17:22kristjan.jonssonsetmessageid: <>
2011-03-30 12:17:21kristjan.jonssonlinkissue11721 messages
2011-03-30 12:17:21kristjan.jonssoncreate