Bug 204946

Summary: yum-updatesd wakes up every 100 msec even when doing nothing
Product: [Fedora] Fedora Reporter: Arjan van de Ven <arjan>
Component: pygobject2Assignee: Matthew Barnes <mbarnes>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: gjc, katzj, lmacken
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: pygobject2-2.12.2-1.fc6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-11-04 13:11:01 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 204948, 207681    

Description Arjan van de Ven 2006-09-01 11:58:02 EDT
Description of problem:

yum-updatesd keeps waking up 10 times per second while it's idle. This is
obviously not a good idea, it eats compute and battery power for absolutely no
reason.

To check this, just do

strace -tt -p <pid of python that runs the updated>

I've not yet been able to find where this is coming from but FC6 really
shouldn't ship with this one
Comment 1 Bill Nottingham 2006-09-01 12:35:22 EDT
static gboolean
pyg_signal_watch_prepare(GSource *source,
                         int     *timeout)
{
    /* Python only invokes signal handlers from the main thread,
     * so if a thread other than the main thread receives the signal
     * from the kernel, PyErr_CheckSignals() from that thread will
     * do nothing. So, we need to time out and check for signals
     * regularily too.
     * Also, on Windows g_poll() won't be interrupted by a signal
     * (AFAIK), so we need the timeout there too.
     */
#ifndef PLATFORM_WIN32
    if (pyg_threads_enabled)
#endif
        *timeout = 100;
    return FALSE;
}
Comment 2 Gustavo J. A. M. Carneiro 2006-09-01 13:32:41 EDT
Right, it happens that when thread awareness is enabled in pygobject, the 100ms
timeout is used.

This used to be upstream bug http://bugzilla.gnome.org/show_bug.cgi?id=154779
Comment 3 Arjan van de Ven 2006-09-02 03:35:51 EDT
afaik the kernel only sends signals to threads that don't have them blocked. If
python doesn't want anyone but the main thread to get signals, it should just
block signals on all but the main thread and then by nature, all signals will go
to the main thread....
Comment 4 Gustavo J. A. M. Carneiro 2006-09-02 07:56:34 EDT
Well, I guess we have to tell that to the Python developers, then... :|
Comment 5 Will Woods 2006-10-12 19:54:19 EDT
pygobject 2.12.2 raises the timeout to 1000msec (1s):

http://mail.python.org/pipermail/python-announce-list/2006-October/005285.html

which is lower frequency than many other system services (e.g. avahi-daemon) and
would probably make yum-updatesd insignificant in terms of battery/CPU use.
Comment 6 Jeremy Katz 2006-10-13 01:05:02 EDT
Seems like a good candidate for a quick post FC6 update.   
Comment 7 Matthew Barnes 2006-10-24 13:26:24 EDT
Packaged up gobject-2.12.2-1.fc6.

I'll close this bug once it's available in Fedora Updates.
Comment 8 Matthew Barnes 2006-11-04 13:11:01 EST
Package pushed to Fedora Updates.  Closing this bug.