Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#912 closed Bug (fixed)

Resume file parsed twice on startup

Reported by: KyleK Owned by: charles
Priority: Normal Milestone: 1.20
Component: Transmission Version: 1.11
Severity: Normal Keywords:
Cc:

Description

The functions torrentRealInit and tr_torrentStart are both executed upon startup of transmission-daemon. Both call function tr_torrentLoadResume, which reads the content of the resume file. I added some debug messages to narrow down this issue:

Transmission 1.11+ (5749) started
Found 5 torrents in "/mnt/USB/.transmission/torrents"
[loadstate] start
[loadstate] opentor
[opentor] tr_torrentNew
[tr_torrentNew] before torrentRealInit(XXX)
[torrentRealInit] before tr_torrentLoadResume(XXX)
Read resume file "/mnt/USB/.transmission/resume/XXX.6b29fc357e912cfc.resume"
Loaded 47 peers from resume file
Resume file found 98 files marked for download
[torrentRealInit] before tr_bencSaveFile()
tr_bencSaveFile saved "/mnt/USB/.transmission/torrents/XXX.6b29fc357e912cfc.torrent"
[loadstate] torrent NOT paused -> tr_torrentStart
[tr_torrentStart] before tr_torrentLoadResume(XXX)
Read resume file "/mnt/USB/.transmission/resume/XXX.6b29fc357e912cfc.resume"
[loadstate] opentor
[opentor] tr_torrentNew
[tr_torrentNew] before torrentRealInit(YYY)
[torrentRealInit] before tr_torrentLoadResume(YYY)
Read resume file "/mnt/USB/.transmission/resume/YYY.b32dafc65d6195a9.resume"
Loaded 50 peers from resume file
Resume file found 1 files marked for download
[torrentRealInit] before tr_bencSaveFile()
tr_bencSaveFile saved "/mnt/USB/.transmission/torrents/YYY.b32dafc65d6195a9.torrent"
[loadstate] torrent NOT paused -> tr_torrentStart
[tr_torrentStart] before tr_torrentLoadResume(YYY)
Read resume file "/mnt/USB/.transmission/resume/YYY.b32dafc65d6195a9.resume"
[loadstate] end
tr_bencSaveFile saved "/mnt/USB/.transmission/resume/XXX.6b29fc357e912cfc.resume"
tr_bencSaveFile saved "/mnt/USB/.transmission/resume/YYY.b32dafc65d6195a9.resume" 

Also, tr_bencSaveFile is executed twice per torrent (once within torrentRealInit and once somewhen after the call to loadstate).

Change History (8)

comment:1 Changed 14 years ago by charles

  • Component changed from Daemon to libtransmission
  • Owner changed from SoftwareElves to charles

comment:2 Changed 14 years ago by charles

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

fixed in r5750.

This fixes both the duplicate tr_torrentLoadResume() and also the excess tr_bencSaveFile() calls.

comment:3 Changed 14 years ago by Robby

Is this a regression from 1.1x?

comment:4 Changed 14 years ago by KyleK

  • Resolution fixed deleted
  • Status changed from closed to reopened

The fix somewhat reduces the calls to tr_bencSaveFile(), but the double resume seems not fixed:

For torrents that are not paused tr_torrentLoadResume() is still called twice:

  1. Through opentor() -> tr_torrentNew() -> torrentRealInit() -> tr_torrentLoadResume()

(This happens for all torrents)

  1. loadstate() checks whether the torrent is paused, if not it calls tr_torrentStart() which again calls tr_torrentLoadResume()

Also, tr_bencSaveFile() is called twice for non-paused torrents (once within torrentRealInit() and once after loadstate(), I haven't found the correct spot yet)

Again attached a logfile (this time with 2 paused and 2 unpaused torrents)

comment:5 Changed 14 years ago by charles

Robby: this seems to be in 1.1x as well.

comment:6 Changed 14 years ago by charles

  • Component changed from libtransmission to Transmission
  • Resolution set to fixed
  • Status changed from reopened to closed

KyleK: looks like r5750 fixed a different variation on this bug in the gtk+ client. r5755 has the daemon fix.

comment:7 Changed 14 years ago by charles

  • Milestone changed from None Set to 1.20

KyleK: also, your phrase "somewhat reduces the calls to tr_bencSaveFile()" is ambiguous. It appears to me to be fixed, so if that's not what you're seeing you should say so. :)

comment:8 Changed 14 years ago by KyleK

Well, my comment was regarding to 2 calls to tr_bencSaveFile() per (non-paused) torrent while I would expect just once. I mentioned this at the end of my last comment.

To be honest though, I couldn't figure out so far what exactly this function saves. Is additional information added to the original .torrent file?

Also: the trac page for r5755 looks weird. The Message: field holds the same message dozens of times.

Note: See TracTickets for help on using tickets.