From time to time Deluge goes to 100% CPU with no apparent reason, (no active torrents). If I restart it the CPU goes to around 0%

Has anyone else encountered that?


Lol, finally solved the bug (after some investigating). In short it appears it's caused by Deluge using twisted.internet.run() instead of gtk.main() for it's main loop, and then twisted.internet.run() calling gobject.threads_init() internally, which sets a SIGCHLD handler, and ultimately it boils down to a bug in PyGtk that is resoved by this patch:

diff --git a/gtk/gtk.override b/gtk/gtk.override
index 75018f4..94309a6 100644
--- a/gtk/gtk.override
+++ b/gtk/gtk.override
@@ -1151,9 +1151,10 @@ pygtk_main_watch_check(GSource *source)
     PySignalWatchSource *real_source = (PySignalWatchSource *)source;
     GPollFD *poll_fd = &real_source->fd;
-    int data_size = 0;
+    unsigned char dummy;
+    gssize ret;
     if (poll_fd->revents & G_IO_IN)
-        data_size = read(poll_fd->fd, 0, 1);
+        ret = read(poll_fd->fd, &dummy, 1);
     state = pyg_gil_state_ensure();

Now Deluge works fine, and I understand that this patch fixes a similar bug in other programs that use PyGtk as well.

  • 3
  • When you have problems with a program like this you need to have some basic information like: What version of Ubuntu are you using? What version of Deluge are you using? Without this most basic info, we're shooting in the dark. – djeikyb Feb 6 '11 at 0:20
  • @CYREX, thanks for the answer, I read about the bug (it was a duplicate btw), but had forgotten to come here and mark your answer as the correct. – sashoalm Feb 6 '11 at 8:48
  • 1
    Do not worry. Not helping for the points as primary reason but for the community as the first reason. – Luis Alvarado Feb 6 '11 at 15:10
  • 1
    The actual bug is now fixed in Natty: bugs.launchpad.net/ubuntu/+source/pygtk/+bug/664920 – Cas May 13 '11 at 17:36

I believe this is a bug that the Deluge developers have blamed on a GTK+ control they use for displaying files. In short the workaround is to just not use the file pane and not to use the "open folder" context menu option.

deluge-web has a separate bug that also causes high CPU but this is officially fixed in the latest version available from their website.


The Deluge Forum has more detail about this problem, with links to bug reports and the patched debs for Natty and Maverick.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.