FS#11984 - [Deluge 1.0.3-2]deluged does not stop or kill

Attached to Project: Arch Linux
Opened by Keerthi (keerthi) - Tuesday, 04 November 2008, 01:05 GMT
Last edited by Hugo Doria (hdoria) - Friday, 05 December 2008, 15:08 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Hugo Doria (hdoria)
Architecture All
Severity Low
Priority Normal
Reported Version None
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:
Deluge daemon does not respond to kill command.

Additional info:
deluge 1.0.3-2


Steps to reproduce:
1. Run deluge in daemon mode (classic mode is off under preferences). Start using 'deluged'.
2. Have about 4 torrents in the queue. 2 torrents actively downloading.
3. Let the daemon run until the torrents begin downloading.
4. Run 'killall deluged'.( Even tried 'sudo killall deluged')
5. deluged won't stop or kill and download continues

[Over time I have noticed mutliple deluged process by running 'top' command, hogging CPU and network]
This task depends upon

Closed by  Hugo Doria (hdoria)
Friday, 05 December 2008, 15:08 GMT
Reason for closing:  Fixed
Comment by MzE2OWM2 (warriant) - Wednesday, 05 November 2008, 01:43 GMT
This is actually SIGTERM, not SIGKILL. Applications can ignore it.
Comment by Keerthi (keerthi) - Wednesday, 05 November 2008, 19:09 GMT
https://dev.deluge-torrent.org/wiki/Faq#HowdoIstopthedaemon
According to faq, deluged should stop with SIGTERM.

It does stop when using SIGKILL but it actually an abrupt kill where deluge will not be able to trap the KILL signal causing 'unclean' shutdown. So SIGTERM is preferred so the application can trap it and shutdown cleanly.

killall -SIGTERM deluged ==> Does not work
killall -SIGKILL deluged ==> Works.

Deluged should stop when using SIGTERM.
Comment by Keerthi (keerthi) - Tuesday, 11 November 2008, 02:23 GMT
Confirming the bug in deluge 1.0.5.

killall -SIGKILL deluged is forcing the torrents to perform hash check after restarting the daemon (because it shuts down the daemon abruptly). This is very annoying. Please fix this bug.
Comment by Hugo Doria (hdoria) - Saturday, 15 November 2008, 14:47 GMT
I did not found the reason for this bug. I reported upstream and i am following it. I will fix this when i get a reply from upstream.
In meantime, if someone else find out what's is causing the problem here, let me know.
Comment by Keerthi (keerthi) - Monday, 01 December 2008, 20:20 GMT
Found a FIX myself.

In /usr/lib/python2.6/site-packages/deluge/component.py, changed the shutdown() function from

[code]
def shutdown(self):
"""Shuts down all components. This should be called when the program
exits so that components can do any necessary clean-up."""
# Stop all components first
self.stop()
for component in self.components.keys():
log.debug("Shutting down component %s..", component)
try:
self.components[component].shutdown()
except Exception, e:
log.debug("Unable to call shutdown(): %s", e)
[/code]

to

[code]
def shutdown(self):
"""Shuts down all components. This should be called when the program
exits so that components can do any necessary clean-up."""
# Stop all components first
self.stop()
for component in self.components.keys():
log.debug("Shutting down component %s..", component)
try:
if self.components[component].get_state() != COMPONENT_STATE.index("Stopped"):
self.components[component].shutdown()
except Exception, e:
log.debug("Unable to call shutdown(): %s", e)
[/code]

The fix is to shutdown a component only if is NOT already Stopped.
Comment by Keerthi (keerthi) - Monday, 01 December 2008, 20:28 GMT
Oops. Didn't realize my code would look so awfully formatted. See attached for the patched shutdown() function. Just add the below if statement in Line#180

if self.components[component].get_state() != COMPONENT_STATE.index("Stopped"):



Comment by Keerthi (keerthi) - Monday, 01 December 2008, 20:51 GMT
Attached patch file for use in Deluge 1.0.5
Comment by Keerthi (keerthi) - Monday, 01 December 2008, 21:00 GMT
Attached patch for use in Deluge 1.0.6. Could you please apply this patch in the PKGBUILD for the next deluge upgrade (until the deluge devs fix the issue) ?
Comment by János Illés (ijanos) - Tuesday, 02 December 2008, 07:27 GMT
upstream fix released:
http://dev.deluge-torrent.org/changeset/4337

But it will be only in 1.0.7:
http://dev.deluge-torrent.org/ticket/598#comment:9
Maybe this patch could be included in the next 1.0.6 package, as suggested in the deluge bugreport.
Comment by Hugo Doria (hdoria) - Tuesday, 02 December 2008, 18:43 GMT
Patch applied. Thanks.
Comment by Keerthi (keerthi) - Wednesday, 03 December 2008, 22:48 GMT
The patch applied is not valid, according to the deluge dev. Please review the dev's comment here http://dev.deluge-torrent.org/ticket/598#comment:9

Please revert the patches applied to component.py. And apply the suggested patches to core.py.
Comment by Hugo Doria (hdoria) - Friday, 05 December 2008, 15:08 GMT
Fixed!

Loading...