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) #ifdef HAVE_PYSIGNAL_SETWAKEUPFD 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); #endif 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.