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: urllib hangs when closing connection
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Chris Beaumont, Ivan.Pozdeev, giampaolo.rodola, orsenthil, python-dev
Priority: normal Keywords: patch

Created on 2016-05-05 00:25 by Chris Beaumont, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
urllib.patch Chris Beaumont, 2016-05-05 00:28 review
Messages (5)
msg264868 - (view) Author: Chris Beaumont (Chris Beaumont) * Date: 2016-05-05 00:25
http://bugs.python.org/issue16270 identified an issue with ftpwrapper.endtransfer that causes ftp fetches to hang in certain situations. A fix was applied to python 3. I see the same issue on python 2.7, and the patch from 16270 fixes it. Is there a reason this fix hasn't been backported to 2.7?

To reproduce:

import urllib
url = "ftp://ftp.fu-berlin.de/pub/misc/movies/database/ratings.list.gz"
fp = urllib.urlopen(url)
fp.close()  # hangs
msg265226 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-05-10 08:13
New changeset 44d02a5d59fb by Senthil Kumaran in branch '2.7':
Closes issue26960.
https://hg.python.org/cpython/rev/44d02a5d59fb
msg265228 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-05-10 08:29
New changeset 3388e249389d by Senthil Kumaran in branch '2.7':
Add NEWS entry for issue26960.
https://hg.python.org/cpython/rev/3388e249389d
msg265229 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2016-05-10 08:30
Thanks for raising this issue, Chris Beaumont.
Fixed in 2.7.x
msg282850 - (view) Author: Ivan Pozdeev (Ivan.Pozdeev) * Date: 2016-12-10 13:21
This fix has caused issue25458 to manifest itself in `urllib', too. AFAICS, it's impossible to fully fix `urllib' to correctly handle end-of-transmission response without fixing `ftplib' first.
History
Date User Action Args
2022-04-11 14:58:30adminsetgithub: 71147
2016-12-10 13:21:31Ivan.Pozdeevsetnosy: + Ivan.Pozdeev
messages: + msg282850
2016-05-10 08:30:10orsenthilsettype: behavior

messages: + msg265229
nosy: + orsenthil
2016-05-10 08:29:42python-devsetmessages: + msg265228
2016-05-10 08:13:07python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg265226

resolution: fixed
stage: resolved
2016-05-05 00:28:01Chris Beaumontsetfiles: + urllib.patch
keywords: + patch
2016-05-05 00:25:54Chris Beaumontcreate