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.

classification
Title: socket.recv() raises correct code with the misleading description 'BlockingIOError: [Errno 11] Resource temporarily unavailable'
Type: Stage:
Components: Versions: Python 3.5, Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: animus, benjamin.peterson
Priority: normal Keywords:

Created on 2015-10-25 11:37 by animus, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
s1.py animus, 2015-10-25 11:37
Messages (2)
msg253425 - (view) Author: Alexey Gorshkov (animus) Date: 2015-10-25 11:37
(in continuation to bug https://bugs.python.org/issue25471 )

socket.recv() raises 'BlockingIOError: [Errno 11] Resource temporarily unavailable' in case, if setblocking(False) on socket returned by non-blocking socket's .accept() method and client does not sending data and didn't disconnected yet.

Not sure if I'm correct, but reading glibc doc on recv(), I think raised exception should be corrected: while code 11 correctly corresponds to EWOULDBLOCK, the misleading description 'Resource temporarily unavailable', probably, should be changed:
---
'EWOULDBLOCK'
          Nonblocking mode has been set on the socket, and the read
          operation would block.  (Normally, 'recv' blocks until there
          is input available to be read.)
---

attached file with testing server corrected for this issue
msg253449 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2015-10-26 01:53
This is simply the way glibc defines the error messages.

% python3
Python 3.4.3 (default, Sep 27 2015, 15:15:25) 
[GCC 4.8.5] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import errno, os
>>> errno.EAGAIN, errno.EWOULDBLOCK
(11, 11)
>>> os.strerror(errno.EAGAIN)
'Resource temporarily unavailable'
History
Date User Action Args
2022-04-11 14:58:23adminsetgithub: 69659
2015-10-26 01:53:08benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg253449

resolution: not a bug
2015-10-25 11:37:55animuscreate