Re-check on startup every time.

Specific support for Deluge on Microsoft Windows OS
robnitro
Member
Member
Posts: 19
Joined: Fri Sep 19, 2014 12:19 pm
OS or Distro: windows 7 x64

Re: Re-check on startup every time.

Postby robnitro » Sun Sep 21, 2014 4:46 am

Ok, so I ran some tests, with NSSM set to 30 seconds each kill step and then 45 seconds. Used the -L debug -l d:\log.txt to log to my drive.
Neither one kills it gracefully if a torrent is downloading. On reload, it starts checking again!
I tried with both console set on and console set off, but no difference.

From event viewer NSSM events:

Code: Select all

 12:04:53 AM  Killing process D:\Program Files (x86)\Deluge\deluged.exe because service DELUGE is stopping.
 12:05:13 AM kill_process() has waited 20000 of 30000 milliseconds for the DELUGE service to exit. Next update in 10000 milliseconds.
12:05:23 Killing process tree of process 10404 for service DELUGE with exit code 0
12:05:23 Killing PID 10404 in process tree of PID 10404 because service DELUGE is stopping.

From end of debug log of deluged.exe-

Code: Select all

[DEBUG   ] 00:04:53 alertmanager:123 dht_reply_alert: (a torrent)  () received DHT peers: 15
[DEBUG   ] 00:04:54 config:423 Saving new config file C:\Users\ROB\AppData\Roaming\deluge\stats.totals.new
[DEBUG   ] 00:04:54 config:436 Backing up old config file to C:\Users\RO\AppData\Roaming\deluge\stats.totals~
[DEBUG   ] 00:04:54 config:444 Moving new config file C:\Users\ROB\AppData\Roaming\deluge\stats.totals.new to C:\Users\ROB\AppData\Roaming\deluge\stats.totals..
[DEBUG   ] 00:04:55 alertmanager:123 peer_blocked_alert: (a torrent) : blocked peer: 173.197.159.34
[DEBUG   ] 00:05:11 alertmanager:123 peer_blocked_alert: (a torrent) : blocked peer: 74.77.204.34


Notice how the kill process was started at 12:04:53 and during that 30 seconds wait, the torrent I had active was still downloading. No indication of stopping torrents, the service, or pausing them! Process was finally killed (I believe by the terminate final option of nssm)- at 12:05:23
In the debug log, we see that it saves the configs around the time of requested shutdown, but still on reload, it did recheck.

----------------------------
In contrast, if I use AlwaysUP, with a setting to use the command "(path\to)deluge-console.exe halt" as the shutdown command, there is no recheck, and I can see that the traffic slows to a halt, then deluged.exe dissapears from task manager.
You can see in the log (which is too long to post easily) that it checks each torrent state, pauses it and saves the state. Also other processes are closed and checked. On restart, it resumes fine!

So, deluge-console.exe halt seems to be the correct way to end deluged.exe, because when downloading a torrent, NSSM will not properly kill it and it will end up rechecking next run.
And before posting this I tried a 60 second run in NSSM, same thing!

By the way, any way to have the deluge client reconnect automatically for xx times every xx seconds?

Cas
Top Bloke
Top Bloke
Posts: 3410
Joined: Mon Dec 07, 2009 6:04 am
OS or Distro: Ubuntu 16.04
Location: Scotland

Re: Re-check on startup every time.

Postby Cas » Sun Sep 21, 2014 12:22 pm

Ok I tested NSSM myself and using deluged-debug.exe it shuts down cleanly.

robnitro
Member
Member
Posts: 19
Joined: Fri Sep 19, 2014 12:19 pm
OS or Distro: windows 7 x64

Re: Re-check on startup every time.

Postby robnitro » Sun Sep 21, 2014 6:28 pm

Just tried deluged-debug.exe and it works with nssm.
I wonder why deluged.exe doesn't work right.
I guess because it is not a console, the "Ctrl-C" that NSSM sends out doesn't do anything.
the 2 WM_ stop options fail too, because they are based on "window X click".
Then it runs terminate, which is unclean.

So, if this works for a while, I will write up a small explanation to use deluge-debug.exe
BTW, anything to disable from this debug to prevent logging like crazy or what not?

Cas
Top Bloke
Top Bloke
Posts: 3410
Joined: Mon Dec 07, 2009 6:04 am
OS or Distro: Ubuntu 16.04
Location: Scotland

Re: Re-check on startup every time.

Postby Cas » Sun Sep 21, 2014 8:34 pm

I have already created a wiki page: http://dev.deluge-torrent.org/wiki/User ... MS_Windows

Change the log level to something else, info, error etc.

robnitro
Member
Member
Posts: 19
Joined: Fri Sep 19, 2014 12:19 pm
OS or Distro: windows 7 x64

Re: Re-check on startup every time.

Postby robnitro » Mon Sep 22, 2014 12:31 am

I've noticed an issue on shutdown but rectified it by enabling log off and shutdown scripts. I don't know if everyone on win7 x64 has this issue....
It may be that I have a lot of services besides deluge which could have been making it time out before deluge gets a proper shutdown or enough time to write out the last chunks/etc.

Shutdown scripts are run and the system waits for it. I had luck using log off script, the shutdown script sometimes didn't work- may be a system shutdown timeout that I would have to tweak. I run both of them to be 100% sure, it does no harm to have sc stop twice.

Make an empty file called delugeshutdown.bat or what not.
Make sure it is in a path without spaces (eg: c:\delugescripts)
add these lines into the batch file:

Code: Select all

REM stop the deluged service
sc stop deluged
REM wait 18 seconds using ping
ping 123.45.67.89 -n 1 -w 18000


Log-off script:
Go to start menu, type in gpedit.msc.
Hit enter.
Click user configuration -> windows settings -> scripts (startup/shutdown)
click shutdown and click add.
Click browse and pick the batch file you created.
Hit apply. Hit OK

optional- also add it for the shutdown policy too:
Click computer configuration -> windows settings -> scripts (startup/shutdown)
click shutdown and click add.
Click browse and pick the batch file you created.
Hit apply. Hit OK.

seanvree
Member
Member
Posts: 22
Joined: Tue Dec 27, 2016 1:42 pm
OS or Distro: windows

Re: Re-check on startup every time.

Postby seanvree » Sat Apr 08, 2017 3:05 pm

I know this is a really old topic, but this is bothering me A LOT lately.

I'm also using deluged-debug as a service, and i have to recheck EVERY time after reboot.

And I have 400 torrents seeding.


SOOOOO......yeah. Any solution to this?

I'm using the thin client, so I usually do the following:

exit and shut down dameon from thin client.

Shut down deluged service.

Reboot machine

Right?!


Return to “Windows OS”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest