Opened 3 years ago

Closed 3 years ago

#3478 closed bug (Fixed)

Magnets without metadata not restored from state.

Reported by: mhertz Owned by:
Priority: minor Milestone: 2.0.4
Component: Core Version: develop
Keywords: Cc:

Description

As title, magnets without metadata aren't restored from state upon restart, when using libtorrent 1.2.11 and above, because of change in resume-saving logic of libtorrent i.e. resume-data saved for magnets even without metadata now, which breaks restoring them upon restart in deluge.

I personally fixed it by this:

diff -urN a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py
--- a/deluge/core/torrentmanager.py	2021-04-21 12:44:14.000000000 +0200
+++ b/deluge/core/torrentmanager.py	2021-07-20 19:38:41.819231547 +0200
@@ -1029,6 +1029,7 @@
                 tid
                 for tid, t in self.torrents.items()
                 if t.handle.need_save_resume_data()
+                if t.has_metadata
             )
 
         def on_torrent_resume_save(dummy_result, torrent_id):

Easy quick way to reproduce, is to add a magnet with non-existing info-hash and restart deluge, and as said, need to use libtorrent 1.2.11 or above. (e.g. "magnet:?xt=urn:btih:85bbba4035cca750f681284857f53e405eb41f8d" )

Tested on deluge-2.0.4.dev56 and libtorrent-1.2.14 on arch-linux.

Thanks in advance.

Change History (7)

comment:1 Changed 3 years ago by Reiver

Testing this to see if resolves the corresponding forum topic Deluge not remembering some torrents that were added (any torrents with 0 Bytes) this patch prevents adding any new magnets as an URL (with current git dev67). Not tested adding with normal torrent file.

(I often add magnets in paused state as bookmark to be downloaded later but deluge is forgetting them on restart.)

comment:2 Changed 3 years ago by mhertz

Yes, my patch fixes the issue of said forum topic, and I just retested it now also on latest dev67 and I cannot reproduce your issue of not being able to add magnets following, and my code added simply just blocks magnets without metadata from being saved into fastresume file, as is otherwise now done on libtorrent 1.2.11+ and causing this issue, so cannot see neither how should block anything.

Last edited 3 years ago by mhertz (previous) (diff)

comment:3 Changed 3 years ago by Reiver

Hmm, I'd did multiple tests adding a magnet as url, ticking "Add in paused state" and then adding but it then disappearing (or rather never appearing). I didn't test adding normal torrent files or magnet url not in a paused state (IIRC).

comment:4 Changed 3 years ago by mhertz

I also did multiple tests, and just did again with having the "add in paused state" option ticket, as didn't before, and same result. I have tested magnets and torrents, but mostly magnets, as that's main issue here, as not sure if torrents even is possible to be without metadata(atleast normally is with metadata - I haven't looked at the "metadata from peers" extension spec much and very long ago, and just guessed it was only for magnets).

I tested with a clean profile.

Make sure to have restarted after applying fix.

I know of other issue unrelated to this, where when starting deluge then your torrents/magnets are in the session but hidden for some reason(but can be seen loaded into session from the left side 'States' menu, where under 'All' list a number other than zero), and comes up again after a restart usually or if fiddling with the UI littlebit, but not sure if ever seen that issue happen after adding torrent/magnet and not restarting, but if that, then is seperate issue than this, where the magnets aren't hidden in session but actually simply not restored upon restart, so gone(so neither shown under 'States' to the left under 'All').

Sorry if not working for you, and I cannot understand why, since I neither can reproduce, nor see how that code-addition should be able to do such, so honestly I think is unrelated to that, and would suggest running with debug logging and check if any clues off why happens.

comment:5 Changed 3 years ago by mhertz

  • Component changed from Unknown to Core
  • Version changed from 2.0.0 to develop

comment:6 Changed 3 years ago by Cas

Thanks for reporting and looking into this, it is definitely an lt bug that Deluge will need to workaround:

https://github.com/arvidn/libtorrent/issues/6420

https://github.com/arvidn/libtorrent/issues/6421

I apply the fix soon

Last edited 3 years ago by Cas (previous) (diff)

comment:7 Changed 3 years ago by Cas

  • Milestone changed from needs verified to 2.0.4
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed in develop [4b6c7d01b2]

Note: See TracTickets for help on using tickets.