[ python-Bugs-1038591 ] Python 2.3+ socket._fileobject handles EAGAIN with data loss

SourceForge.net noreply at sourceforge.net
Fri Oct 1 18:56:05 CEST 2004


Bugs item #1038591, was opened at 2004-10-01 11:56
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1038591&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jon Nelson (jnelson)
Assigned to: Nobody/Anonymous (nobody)
Summary: Python 2.3+ socket._fileobject handles EAGAIN with data loss

Initial Comment:

If one has a non-blocking socket, 'sock', and uses
'sock.makefile()' to create file-like object out of it,
there exists the possibility (even probability) of data
loss in the event of an EAGAIN error.

The code that comprises _fileobject in socket does not
try to catch EAGAIN.  In the event that the read()
operation does not encounter EOF, but *has* read data
(and then gets an EAGAIN) such as when there is less
than 8KB of data to read, the socket.error traceback is
handed back to the caller of read and the read data is
discarded.  This is horrible. The _fileobject read
routine (and probably write, too) should catch
socket.error and check it for EAGAIN, and in that case,
return what it has already read (if anything). 

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1038591&group_id=5470


More information about the Python-bugs-list mailing list