Bug 660137 - 100% CPU usage with Python + twisted framework using glib2 or gtk2 reactors
Summary: 100% CPU usage with Python + twisted framework using glib2 or gtk2 reactors
Alias: None
Product: Fedora
Classification: Fedora
Component: pygtk2
Version: 14
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Colin Walters
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2010-12-05 19:29 UTC by Antoine Martin
Modified: 2011-05-25 02:56 UTC (History)
6 users (show)

Fixed In Version: pygtk2-2.17.0-9.fc14
Doc Type: Bug Fix
Doc Text:
Clone Of: 562825
Last Closed: 2011-04-18 04:05:02 UTC
Type: ---

Attachments (Terms of Use)
running this code causes pygtk/twisted to use 100% cpu (939 bytes, text/x-python)
2010-12-05 19:29 UTC, Antoine Martin
no flags Details
the patch which fixes the pygtk bug (1.15 KB, patch)
2011-02-04 13:30 UTC, Antoine Martin
no flags Details | Diff
patch for the spec file (1.09 KB, patch)
2011-02-04 13:30 UTC, Antoine Martin
no flags Details | Diff
this patch is for Fedora 15 (522 bytes, patch)
2011-02-06 10:36 UTC, Antoine Martin
no flags Details | Diff
adds the patch to the fedora 15 spec file (889 bytes, patch)
2011-02-06 10:37 UTC, Antoine Martin
no flags Details | Diff

Description Antoine Martin 2010-12-05 19:29:15 UTC
Created attachment 464883 [details]
running this code causes pygtk/twisted to use 100% cpu

+++ This bug was initially created as a clone of Bug #562825 +++

Test case in attachment immediately shows the problem.
This bug affects all versions of Fedora since at least Fedora 12, not just Fedora 12.

I am creating this new bug against Fedora 14 since my request to re-assign the original bug seemed to have gone to /dev/null

Comment 1 Antoine Martin 2011-01-27 11:45:10 UTC
New upstream bug (assuming this is a twisted bug and not pygtk/glib):


Comment 2 Antoine Martin 2011-01-31 09:49:11 UTC
Thanks to some great investigative work from exarkun at twisted-matrix.com, the bug has been found in pygtk and a patch is available:


Comment 3 Antoine Martin 2011-02-03 10:00:00 UTC
Correct me if I am wrong but it would appear that Fedora maintains its own tree of PyGTK for each release:

So whoever maintains PyGTK for Fedora will have to apply the patch above to Fedora 13, 14 and upcoming 15...

(it's a shame bugzilla doesn't let you select more than one version)

Comment 4 Antoine Martin 2011-02-04 13:29:10 UTC
Still no reply, so I went off and did my own fixed RPMs for fedora 14 x86_64:

This fixes the bug just fine. I may provide other arch/versions if I find the time - but this should be the distro's job - hint, hint.

I am attaching the patch to the spec file and the pygtk patch that goes with it (straight copy from debian).

Please APPLY...

Comment 5 Antoine Martin 2011-02-04 13:30:01 UTC
Created attachment 477006 [details]
the patch which fixes the pygtk bug

Comment 6 Antoine Martin 2011-02-04 13:30:33 UTC
Created attachment 477007 [details]
patch for the spec file

Comment 7 Antoine Martin 2011-02-06 10:36:50 UTC
Created attachment 477280 [details]
this patch is for Fedora 15

Comment 8 Antoine Martin 2011-02-06 10:37:17 UTC
Created attachment 477281 [details]
adds the patch to the fedora 15 spec file

Comment 9 Antoine Martin 2011-03-27 06:52:11 UTC
I would really like Fedora not to be the last distro to fix this bug...
But now that the bug has been fixed or at least "confirmed" by everyone else, this looks increasingly unlikely. :(

If providing a test case, a fix, patches for the spec files and sample RPMs is not enough... I really don't know what is, but feel free to let me know what I should have done better.

Comment 10 Gianluca Sforna 2011-03-27 09:29:29 UTC
Antoine, I think it's just unfortunate that this is showing up on pygobject2, which is possibly going to be deprecated in the GNOME 3 stack.

The maintainer is probably swamped with GNOME 3 related work and this is too low priority to be handled.

I'll forward the bug to the devel mailing list, where a provenpackager may notice and help applying the patch. 

Do you know if this landed in any upstream release?

Comment 11 Antoine Martin 2011-03-27 09:54:06 UTC
Yes, the [really trivial and obvious] patch has been merged into PyGTK 2.23 (for release in 2.24).
Unfortunately, PyGTK does not do point releases, even for "stable" versions like 2.22.0, let alone dev snapshots like 2.17 used in Fedora 14.
So there will never be an upstream version named 2.22.1 (for convenience, I made one here: http://winswitch.org/src/pygtk-2.22.1.tar.bz2)

As per comment no 3: things would be easier for distros to fix if they shared a common source tree as opposed to an unmaintained snapshot of a development version... (currently, each distro is having to duplicate all the work - even for a trivial patch like this one)

Comment 12 Antoine Martin 2011-04-12 14:19:24 UTC
2.5 months on, fix still not applied. :(

Gentoo: 0 days (~unstable)
FreeBSD: 15 days
Ubuntu: almost 4 months
Fedora: 2.5 months and counting

Comment 13 Dominik 'Rathann' Mierzejewski 2011-04-12 15:09:01 UTC
This bug is filed against pygobject2, while the patches are for pygtk2, reassigning.

Comment 14 Dominik 'Rathann' Mierzejewski 2011-04-12 15:41:45 UTC
Which patch is correct? The one in comment 2 or the one attached here https://bugzilla.redhat.com/attachment.cgi?id=477006 ?

Comment 15 Antoine Martin 2011-04-12 15:51:56 UTC
The one in comment 2 is the upstream patch for GTK ~2.22 and above - use this one for Fedora 15 (rawhide has/will get the fix from upstream).

Older versions of Fedora are still stuck on GTK ~2.17, so they need the other patch (same patch as applied by Debian last year)

Comment 17 Antoine Martin 2011-04-12 17:57:38 UTC
I didn't think the second one applied to 2.17, but if it does apply then yes you do want it too.

Comment 18 Christopher Aillon 2011-04-12 18:10:20 UTC
It does if you apply them in sequence :-)

Comment 19 Fedora Update System 2011-04-12 18:20:23 UTC
pygtk2-2.24.0-1.fc15 has been submitted as an update for Fedora 15.

Comment 20 Fedora Update System 2011-04-12 18:21:28 UTC
pygtk2-2.17.0-8.fc14 has been submitted as an update for Fedora 14.

Comment 21 Fedora Update System 2011-04-12 18:21:38 UTC
pygtk2-2.17.0-8.fc13 has been submitted as an update for Fedora 13.

Comment 22 Fedora Update System 2011-04-13 04:51:59 UTC
Package pygtk2-2.24.0-1.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing pygtk2-2.24.0-1.fc15'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).

Comment 23 Antoine Martin 2011-04-13 08:25:46 UTC
I have tested the F14 x86_64 build and left a comment. (Fixes the issue as expected)

I have been using the fixed RPMs for a while on F14 (see comment 4 for location), so although pushing a fixed pygtk2 package for F15 is welcome news, most users will be stuck with the broken version available in F13 and F14 until it gets pushed there too..

As for the cumulative patching: IIRC, the code fixed in the second patch doesn't actually fire until F15 because the code paths it fixes are #ifdefed.

Comment 24 Christopher Aillon 2011-04-15 00:05:53 UTC
Antoine, if you have a FAS account, it would really help if you logged in when providing feedback on the update itself.  While we do appreciate feedback in any form, in order to push builds officially, we need two logged in users to say it works (although one has to be a QA proventester).

Comment 25 Fedora Update System 2011-04-18 04:04:54 UTC
pygtk2-2.24.0-1.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 26 Antoine Martin 2011-04-18 06:19:32 UTC
This problem has existed since Fedora 12, I don't understand why pushing a fix to Fedora 15 (not even released yet) means the bug is "CLOSED" when Fedora 13 and 14 are still affected.

Comment 27 Christopher Aillon 2011-05-12 06:06:43 UTC
For whatever its worth, this still needs more people to test it on F13 and F14.  If this bug affects you on either, please log in to the updates system using your FAS account: https://admin.fedoraproject.org/updates/login

And then add karma to one of the updates:

F13: https://admin.fedoraproject.org/updates/pygtk2-2.17.0-9.fc13
F14: https://admin.fedoraproject.org/updates/pygtk2-2.17.0-9.fc14

Without more positive feedback, this fix cannot ever be released.

Comment 28 Antoine Martin 2011-05-12 09:10:16 UTC
IMHO, the karma thing for pushing updates is good *idea*, but when it blocks trivial one-liners that anyone who is capable of reading the code can see is simply broken... then clearly it is not serving the users well.

The clue should be that: upstream applied it, debian applied it, gentoo applied it, freebsd applied it, etc..  Also, I very much doubt that all bugs go through this tedious process: I have seen enough "potential" kernel bugs being patched and I very much doubt these all had a test case and proven testers agreeing on each particular fix (since they generally can't be tested individually without a test case).

I'm just saying, I'm not expecting anything to change and this comment will be probably be dismissed and /dev/nulled
It's just that as a Fedora user, this saddens me because I believe we can do better than this.
It looks like F15 will be released and people will have moved on by the time this is pushed out, which means that Fedora will have carried a trivial known bug for well over a year.

Comment 29 Christopher Aillon 2011-05-13 00:07:59 UTC
And if it weren't for the karma system, the F13 update would have gone out even more broken than before.  I messed up on the initial builds for F13 (-8), but its fixed in -9.  Sadly, people felt like commenting that stuff was broken but never bothered to comment after I fixed it.

Comment 30 Antoine Martin 2011-05-13 03:32:54 UTC
If you read my comment above, I never claimed that the karma system was not useful - in fact I said the opposite: "a good idea", I just said that it is "not serving the users well" when "Fedora will have carried a trivial known bug for over a year".

I fully expected my comment to be dismissed on other grounds though, the fact that the build was broken is only very weakly related to the point I was trying to make.

I will take no further part in this discussion.

Comment 31 Fedora Update System 2011-05-25 02:56:16 UTC
pygtk2-2.17.0-9.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.