Opened 12 years ago
Closed 12 years ago
#1507 closed patch (Fixed)
Fix for temporary file race condition in Deluge 1.3.x's core/core.py:add_torrent_url
Reported by: | geoffk | Owned by: | Cas |
---|---|---|---|
Priority: | minor | Milestone: | 1.3.2 |
Component: | Core | Version: | 1.3.1 |
Keywords: | Cc: |
Description
Hi,
I've found (and fixed) a temporary file race condition in the use of httpdownloader.py:download_file from the core/core.py:add_torrent_url method in Deluge 1.3.x.
By default, download_file will not use the temporary file name supplied by add_torrent_url - it will use the filename suggested by the given URL. When using two Deluge processes started at the same time on the same torrent, this leads to an IO error at random as download_file (depending on ordering) clobbers or removes the downloaded torrent file with the same name that the other process is also attempting to download simultaneously.
(This can be seen in particular using add_torrent_url with an Ubuntu ISO torrent - http://torrent.ubuntu.com:6969/file?info_hash=%60%D5%D8%23%28%B4Tu%11%FD%EA%C9%BFM%01%12%DA%A0%CE%00)
The supplied patch fixes this by making add_torrent_url call download_file with the force_filename option set to True, forcing download_file to always use the unique mkstemp-generated filename supplied from add_torrent_url.
Kind regards,
Geoff Kassel.
Attachments (1)
Change History (4)
Changed 12 years ago by geoffk
comment:1 Changed 12 years ago by Cas
- Milestone changed from Future to 1.3.2
comment:2 Changed 12 years ago by Cas
- Owner set to Cas
- Status changed from new to accepted
comment:3 Changed 12 years ago by Cas
- Resolution set to fixed
- Status changed from accepted to closed
1.3-stable: efd2762255
Patch for core/core.py:add_torrent_url to use download_file with force_filename=True to fix a temporary file race condition