[issue11199] urllib hangs when closing connection
report at bugs.python.org
Tue Feb 22 08:40:28 CET 2011
Charles-Francois Natali <neologix at free.fr> added the comment:
> rg3 <sarbalap+freshmeat at gmail.com> added the comment:
> I have to correct myself. I applied the patch manually to my Python 2.6 installation. In Python 2.6, the line you moved is number 961, and I did the same change.
OK. For information, you can apply it using the Unix "patch" command,
who can most of the time do all the work for you.
> With your change, the connection can be closed, but you have to wait for the file to be completely transferred. As I was throttling to 1 KB/sec initially, I thought it was still hanging because it takes more than 1 minute for the test file to be sent. Still, the connection isn't immediately closed when you request to close it.
That's expected, it's a consequence of this point I raised earlier:
> Note that I'm not sure why we need to wait for a further message on the control channel (maybe it's part of an RFC or something...).
The current code explicitely waits for the end of transfer before
closing the data channel.
Don't ask me why, I don't have a clue. I wrote a 2-line patch to
disable this behaviour which seems to work fine, but since I'm not
sure why the code is doing this right now, I'd like some feedback
before doing the change.
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list