Opened 13 years ago

Closed 13 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)

deluge-core-core.py.patch (474 bytes) - added by geoffk 13 years ago.
Patch for core/core.py:add_torrent_url to use download_file with force_filename=True to fix a temporary file race condition

Download all attachments as: .zip

Change History (4)

Changed 13 years ago by geoffk

Patch for core/core.py:add_torrent_url to use download_file with force_filename=True to fix a temporary file race condition

comment:1 Changed 13 years ago by Cas

  • Milestone changed from Future to 1.3.2

comment:2 Changed 13 years ago by Cas

  • Owner set to Cas
  • Status changed from new to accepted

comment:3 Changed 13 years ago by Cas

  • Resolution set to fixed
  • Status changed from accepted to closed

1.3-stable: efd2762255

Note: See TracTickets for help on using tickets.