Eric Hohenstein <ehohenst...@imvu.com> added the comment:

I have ported the changes related to this problem from the 3.2 branch to the 
2.6 version of socketmodule.c. The changes are attached as a diff from Python 
2.6.2. The changes apply to all platforms but I've only tested them on Windows.

The _PyTime_gettimeofday method is not available in 2.6 which is why the 
changes in 3.2 weren't originally back ported. I admit to adding a disgusting 
hack which was to copy some of the _PyTime_gettimeofday interface code from 3.2 
to the socketmodule.c file and implement it using the time.time() method, 
falling back to the crt time() method. It's not as efficient as the 
implementation in 3.2 but I believe it should be equally correct.

The motivation for doing this was that I continued to see 10035 errors 
happening using Python 2.6 though in different code paths. Specifically, errors 
were being thrown when uploading a file using a PUT request using httplib which 
calls sendall(). It's noteworthy that analysing the changes made for this issue 
to Python 3.2 revealed that no change was made to the sendall() method. 
sendall() is actually problematic in that the timeout on the socket may 
actually be exceeded without error if any one call to select() doesn't exceed 
the socket's timeout but in aggregate the calls to select do wait longer than 
the timeout. The same generic solution that was applied to the other socket 
methods is not appropriate for sendall(). I elected to continue this behavior 
by just checking for EAGAIN and EWOULDBLOCK if the socket has a positive 
timeout value and the call to send failed and continuing the select/send loop 
in that case. As far as I can tell, sendall() will still fail with these r
 ecoverable errors in Python 3.2. I won't feel bad if this patch is rejected 
for 2.6 but the changes to sendall() should really be considered for the 3.2 
branch.

----------
resolution: fixed -> 
status: closed -> open
versions: +Python 2.6 -Python 3.2
Added file: http://bugs.python.org/file20142/socket_10035.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9090>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to