rakshasa / rtorrent

rTorrent BitTorrent client
https://github.com/rakshasa/rtorrent/wiki
GNU General Public License v2.0
4.2k stars 415 forks source link

Download registered as completed, but hash check returned unfinished chunks. #630

Closed jewsh closed 7 years ago

jewsh commented 7 years ago

I am trying to move finished torrents to directories based on their watch directory. The wiki contains an entry for just this exact usecase.

schedule2 = watch_directory_1, 10, 10,"load.start=~/.rtorrent/watch/foo_watch/*.torrent,d.custom1.set=~/.rtorrent/download/foo_dl"
schedule2 = watch_directory_2, 10, 10,"load.start=~/.rtorrent/watch/bar_watch/*.torrent,d.custom1.set=~/.rtorrent/download/bar_dl"
method.insert = d.get_data_full_path, simple, "branch=((d.is_multi_file)),((cat,(d.directory))),((cat,(d.directory),/,(d.name)))"
method.set_key =event.download.finished,move_complete,"d.directory.set=~/.rtorrent/download ;execute=mv,-u,$d.get_data_full_path=,$d.custom1="

Based on the wiki entry here

This will move the file to the right location but leave a 0 byte file in the original location. In rtorrent itself the error message "Download registered as completed, but hash check returned unfinished chunks." will be displayed.

chros73 commented 7 years ago

Well, the last line isn't from that page :) The problem is, you don't update the d.directory property properly: it should be d.custom1 So, the whole line should look like this:

method.set_key = event.download.finished,move_complete,"d.directory.set=$d.custom1= ;execute=mv,-u,$d.get_data_full_path=,$d.custom1="
jewsh commented 7 years ago

Applying that line results in the same error plus new errors. Now when the download finishes the log in rtorrent displays : Event 'event.download.finished' failed: Bad return code.

Additionally the logfile displays:

---
^@mv: cannot stat â/home/user/.rtorrent/download/foo_dl/debian-9.1.0-amd64-netinst.isoâ: No such file or directory
chros73 commented 7 years ago

/home/user/.rtorrent/download/foo_dl/

Do you have this directory?

jewsh commented 7 years ago

Yes, all the directories exist and have appropriate permissions set.

chros73 commented 7 years ago

This will move the file to the right location but leave a 0 byte file in the original location.

Err... Can you try out adding this at the end of the last line of your original version? ;d.stop=;d.start=

Stopping and restarting the download is necessary to get its 'base path' updated. So:

method.set_key =event.download.finished,move_complete,"d.directory.set=~/.rtorrent/download ;execute=mv,-u,$d.get_data_full_path=,$d.custom1=;d.stop=;d.start="

If this works, then try to add back the previously mentioned d.custom1 variable.

And if all works, can you also update the wiki page? :)

jewsh commented 7 years ago

method.set_key =event.download.finished,move_complete,"d.directory.set=~/.rtorrent/download ;execute=mv,-u,$d.get_data_full_path=,$d.custom1=;d.stop=;d.start="

Has the same effect as the original, e.g. moves the file but a 0 byte file remains in the original location and rtorrent reports missing chunks.

method.set_key = event.download.finished,move_complete,"d.directory.set=$d.custom1= ;execute=mv,-u,$d.get_data_full_path=,$d.custom1=;d.stop=;d.start="

Results in Event 'event.download.finished' failed: Bad return code. and the missing chunks error, also does not move the file properly as before.

pyroscope commented 7 years ago

This is again using the wrong dir AFTER the change. And again, put the handler into its own method, call that and pass the path as an argument, use "$argument.0=" which is frozen.

jewsh commented 7 years ago

@pyroscope which handler should be put into its own method and how? Can you either elaborate your answer or tell us where you get your info from?

pyroscope commented 7 years ago

In #625 that you duped.

someone fix the damn wiki.

jewsh commented 7 years ago

After some testing i think i made it work. Proper documentation would be nice though.

delize commented 6 years ago

@jewsh can you either update the wiki with what you did, or post it here to have someone else update the wiki?

awsms commented 1 year ago

still looking for an answer 6 years later :/

SR-G commented 1 year ago

@awsms The project seems dead : i switched (because of that kind of issues) to Transmission now (docker image - also in daemon mode).

kannibalox commented 1 year ago

I just tested the snippet in the wiki and it appears to work as expected. Posting your config and the exact issue you're getting would help to narrow it down, but basically this ends up happening whenever data isn't where rtorrent expects it to be when re-starting a completed torrent, which can be for a myriad of reasons when user-defined events are involved.

The project seems dead : i switched (because of that kind of issues) to Transmission now (docker image - also in daemon mode).

Comments such as these help no one.