Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#3258 closed Bug (fixed)

1.93 sends "stopped"+"started" before "completed" if an incomplete-dir is used

Reported by: disco Owned by: charles
Priority: High Milestone: 2.00
Component: libtransmission Version: 1.93
Severity: Major Keywords: backport-1.9x
Cc:

Description

I've noticed negative session download speed statistics on trackers and decided to investigate what's going on.

Transmission 1.93 doesn't announce properly when torrent finishes downloading. Instead of sending "completed" event with proper counters, it sends "stop" with proper counters, resets counters to zero (this is actually ok as counters are session based), moves torrent from incoming to destination directory, sends "started" event and then after all this it sends "completed" event with zeroed counters (this is definitely NOT ok).

GET /announce.php?passkey=...&info_hash=...&peer_id=-TR1930-...&port=...&uploaded=0&downloaded=103732515&left=0&numwant=0&key=...&compact=1&supportcrypto=1&event=stopped HTTP/1.1

GET /announce.php?passkey=...&info_hash=...&peer_id=-TR1930-...&port=...&uploaded=0&downloaded=0&left=0&numwant=200&key=...&compact=1&supportcrypto=1&event=started HTTP/1.1

GET /announce.php?passkey=...&info_hash=...&peer_id=-TR1930-...&port=...&uploaded=0&downloaded=0&left=0&numwant=200&key=...&compact=1&supportcrypto=1&event=completed HTTP/1.1

Completed event must be sent first, before counters are reset. Proper order would be:

  1. send completed event
  2. send stopped event
  3. reset counters
  4. move files or whatever it has to be done
  5. send started event

Change History (14)

comment:1 Changed 12 years ago by charles

I'm not seeing this at all. Here's what I saw in my test just now:

When I add a torrent, I get the first announce:

GET /announce?info_hash...&peer_id=-TR193Z-...&port=...&uploaded=0&downloaded=0&left=211779363&numwant=80&key=...&compact=1&supportcrypto=1&event=started HTTP/1.1

Then when it's complete, the second announce happens:

GET /announce?info_hash=...&peer_id=-TR193Z-...&port=...&uploaded=0&downloaded=211779363&left=0&numwant=80&key=...&compact=1&supportcrypto=1&corrupt=327680&event=completed HTTP/1.1

Then if I stop the torrent manually, I get the third announce:

GET /announce?info_hash=...&peer_id=-TR193Z-...&port=...&uploaded=0&downloaded=211779363&left=0&numwant=0&key=...&compact=1&supportcrypto=1&corrupt=327680&event=stopped HTTP/1.1

which is as it ought to be.

What OS, and which Transmission GUI, are you using?

comment:2 follow-up: Changed 12 years ago by charles

  • Milestone changed from None Set to 2.00

I'm betting this is on Mac, right?

comment:3 follow-up: Changed 12 years ago by howl

charles he is talking about reports that happens automatically at torrent completed, when Transmission is set to move completed to another place. With completed and downloading torrents in the same folder the only thing done is an event completed but when transmission have completed torrents to be moved, it first move the file (stopped event + move of the file) and then it starts the torrent again and tells it's completed (started and completed events). What disco says is to alter the order to be say it's completed, then move the torrent (stopped + move the file) and then start it again.

The stop start process seems to be part of the move data function of transmission so I don't think that could be avoided to happen and send only a completed event and move the file.

Anyway the actual situation described by disco should not make negative speed to appear in tracker statistics, the tracker should check the way he calculates the speed to manage this.

If changing the order of events makes that tracker stat speed right and doesn't have any other effects for transmission could be right to do this, if not, this should be invalid as is a bug of the tracker.

comment:4 in reply to: ↑ 2 Changed 12 years ago by disco

Replying to charles:

I'm betting this is on Mac, right?

Nah, it's on Linux, Fedora 12 x86_64.

I think howl is right and this happens only when transmission is moving files to destination directory. The stop/move/start procedure is unavoidable but "completed" event should be sent first while counters are still non-zero.

comment:5 in reply to: ↑ 3 Changed 12 years ago by disco

Replying to howl:

If changing the order of events makes that tracker stat speed right and doesn't have any other effects for transmission could be right to do this, if not, this should be invalid as is a bug of the tracker.

I'm pretty sure changing the order of events would fix it. Yeah, I know it's technically an issue on the trackers but you can't really expect them to fix it just because transmission sends events in the wrong order. :) When they see there's anything wrong with client's announces they just ban it, at least on the private trackers.

comment:6 Changed 12 years ago by charles

Confirmed. When the incomplete dir is enabled, the announce sequence is started, stopped+started, completed.

comment:7 Changed 12 years ago by charles

  • Summary changed from Transmission 1.93 doesn't announce properly on torrent completion to Transmission 1.93 sends "stopped"+"started" announce instead of "completed" if the incomplete-dir is enable

comment:8 follow-up: Changed 12 years ago by charles

I think this is fixed now in r10716. Since this is a last-minute change for 2.00 I'd like to get confirmation -- could you give that build a try?

comment:9 Changed 12 years ago by charles

  • Severity changed from Critical to Major
  • Summary changed from Transmission 1.93 sends "stopped"+"started" announce instead of "completed" if the incomplete-dir is enable to Transmission 1.93 sends "stopped"+"started" before "completed" if an incomplete-dir is used

comment:10 Changed 12 years ago by charles

  • Owner set to charles

comment:11 Changed 12 years ago by charles

  • Keywords backport-1.9x added

comment:12 in reply to: ↑ 8 Changed 12 years ago by disco

Replying to charles:

I think this is fixed now in r10716. Since this is a last-minute change for 2.00 I'd like to get confirmation -- could you give that build a try?

Confirmed. r10716 sends "completed" before "stopped" and "started". Thanks.

comment:13 Changed 12 years ago by charles

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

Thanks disco

comment:14 Changed 11 years ago by charles

  • Component changed from Transmission to libtransmission
  • Summary changed from Transmission 1.93 sends "stopped"+"started" before "completed" if an incomplete-dir is used to 1.93 sends "stopped"+"started" before "completed" if an incomplete-dir is used
Note: See TracTickets for help on using tickets.