Scheduler not restarting seeding but looks like it is

General support for problems installing or using Deluge
Post Reply
togaclad
New User
New User
Posts: 3
Joined: Sun Dec 17, 2023 7:48 pm

Scheduler not restarting seeding but looks like it is

Post by togaclad »

Hi. This is a strange one. I've looked around but have not found any matching issues.
Everything starts fine and seeding is working. Then the scheduler shuts every down for an hour and when it resumes, marks everything as seeding, but it is not actually seeding. Upload is 0 and trackers show nothing is seeding. If I manually pause everything then manually start, all trackers show normal seeding. I usually run with everything set to infinite and my share ratio is very high. I am not anywhere near even a 1:1 ratio with these seeds.
I am using version 2.1.1 with Ubuntu 22.04. This problem seems to have started a few months ago but I did not notice until I started getting HnR warnings since there are no error messages and everything is blue and marked as seeding.
togaclad
New User
New User
Posts: 3
Joined: Sun Dec 17, 2023 7:48 pm

Re: Scheduler not restarting seeding but looks like it is

Post by togaclad »

It looks like this has been an issue before but was fixed. Not sure why it has pooped up again. I have tried the suggested fixes in the other tickets but none work. Main difference between this an previous issues seems to be when the scheduler resumes (red to green) all the torrents are marked as seeding but the trackers don't detect it. It requires a manual pause and resume. I have tried adding core to the core.py to "component.get('Core').resume_session()" when state turns green but that did not seem to fix the issue.
mhertz
Moderator
Moderator
Posts: 2215
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Scheduler not restarting seeding but looks like it is

Post by mhertz »

Sorry, have no knowledge about this unfortunately, and just quickly commenting about your tried workaround in the code of plugin. That call will do nothing, as internally first checks if session paused and if is, then resumes it, otherwise quits silent, which done here, as session not paused or else would show 'paused' upon all your torrents. If you wanna workaround by automating what you manually said do(pause/resume everything), then need instead add e.g.:

Code: Select all

import deluge.component as component
from twisted.internet.reactor import callLater

component.get("EventManager").register_event_handler("SessionStartedEvent", self.z)

    def z(self):
        callLater(1, self.f)

    def f(self):
         component.get('Core').pause_torrents()
         component.get('Core').resume_torrents()
The plural version of pause/resume_torrent, internally generates torrentlist and iterates, if none list given as arg I saw, hence above, though also can manually e.g.

Code: Select all

x = component.get('TorrentManager').get_torrent_list()
for y in x:
    component.get('Core').pause_torrent(y)
    component.get('Core').resume_torrent(y)
E.g. can check for various properties before attempting it, if wanted etc.

Anyway, main thing to note here, is that the torrentlist will be empty when plugin loads initially, hence why I need hook into SessionStartedEvent, and even add an async 1 sec delay on-top, for the list be populated, maybe could save someone reading later some head-ache and not need find themselves.

Sorry no real help :( Personally would test another libtorrent version, as only slight thing I could think off.

Edit: Also, lastly, I forgot that the resume_session( ) you tried, which I said failed silent, which correct, but if was actually paused(session), then would besides resuming it, also run a forced libtorrent update of status of every torrent, so maybe that would do the trick specifically(despite already did by original plugin, when gone from red to green, but still), instead of above, i.e something like.

Code: Select all

x = component.get('TorrentManager')
for torrent_id in x.torrents:
                x[torrent_id].update_state()
Edit: To lazy fixup top parts with component.get's into own var.

Edit: Doh you're amending a plugin doing these things later on, sorry, and so please disregard example about needing SessionStartedEvent and callLater etc.
togaclad
New User
New User
Posts: 3
Joined: Sun Dec 17, 2023 7:48 pm

Re: Scheduler not restarting seeding but looks like it is

Post by togaclad »

@mhertz
Thank you for all the details! I have tried the above, and a lot of other things, but still the same issue still happens. For now I'm just disabling the scheduler plugin. Hoping it gets fixed in a future version. I may try a few other experiments and if I find something that works will post the solution.
mhertz
Moderator
Moderator
Posts: 2215
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Scheduler not restarting seeding but looks like it is

Post by mhertz »

I see libtorrent v2.0.8 actually fixes an issue of leaving trackers stuck after pause/resume session specifically - ubuntu 22.04 has libtorrent v2.0.5 by default, taking precedence over the 1.2.16 in PPA(Edit: Actually no libtorrent included for 22.04 in PPA), so could sound like related possibly. Also if having over 1600 torrents, then need up 'active_tracker_limit' libtorrent setting with ltconfig plugin BTW. You can get latest libtorrent 2.0.9, or try revert to 1.2.19 easily through pip from python3-pip, e.g 'sudo pip3 install libtorrent -U', or 'sudo -u deluge pip3 install libtorrent -U'(deluge user local install) - I don't remember for sure if still allowed on ubuntu 22.04, I mean that newer Bep for python, blocking such usage and instead demanding e.g venv's etc, but seem remember still allowed and I think also takes precedence over the apt installed libtorrent automatically. Alternatively I see libtorrent v2.0.8/v2.0.9 in Ubuntu 23.04/23.10(and Debian Sid) to use in 22.04.

Edit: Pep not bep, sorry :) Pep668 specifically, though can use '--break-system-packages' for affected systems - pipx not appropriate here btw, as for apps not libs, and venv's only activate for current terminal(and don't work for exec/fork anyway, so activating venv from e.g. .bachrc/.zshrc won't work neither), so personally would just override with said switch for this one case(and still gets installed seperate I.e under '/usr/local/lib/python3' and not '/usr/lib/python3', and takes precedense since sys.path lists former first), but own choice of-course. Very last, remember once recently in either ubuntu 22.04, or Debian, not fully sure honestly, but anyway, then found had to first do e.g 'sudo pip3 install libtorrent==1.2.* -U', before allowed me to do e.g 'sudo pip3 install libtorrent -U' to get latest 2.x libtorrent, when having e.g 2.0.5 installed from apt, well unless adding '--force'. Just adding for completeness.
Post Reply