ibus python 100 % cpu for ever

Bug #637671 reported by tuxfusion@gmail.com on 2010-09-13
192
This bug affects 34 people
Affects Status Importance Assigned to Milestone
Ayatana Ubuntu
Medium
Karl Lattimer
ibus (Ubuntu)
Undecided
Ken VanDine
Maverick
Undecided
Unassigned

Bug Description

Binary package hint: ibus

After installing many languages and selecting input engine to ibus, the cpu stays at 100 % usage with process "python" for the second time , not sure how to reprocude. Autobugreport mentions ibus somewhere ...

ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: ibus 1.3.7-1ubuntu3
ProcVersionSignature: Ubuntu 2.6.35-20.29-generic 2.6.35.4
Uname: Linux 2.6.35-20-generic x86_64
Architecture: amd64
Date: Tue Sep 14 01:48:40 2010
ExecutablePath: /usr/share/ibus/ui/gtk/main.py
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Beta amd64 (20100901.1)
InterpreterPath: /usr/bin/python2.6
ProcEnviron:
 SHELL=/bin/bash
 LANG=de_DE.utf8
 LANGUAGE=de:en_US:en
SourcePackage: ibus

steps to recreate the problem:
* open ibus preferences from the ibus menu in the notification area.
* close preferences. (after this, the python process runs at 100% cpu)

FIX:
There is a fix available in the ppa. See comment #15.

Related branches

tuxfusion@gmail.com (tuxfusion) wrote :

I'm running Maverick beta i386 and it also affects me.

gokul (dotgokul) wrote :

killing the python process does not stop ibus daemon. The shortcuts (ctrl+space) seems to toggle ON and OFF the input method. killing the python process removes the system tray/menu and the language bar.

ps -ef | grep <pid> gives /usr/share/ibus/ui/gtk/main.py

steps to recreate the problem:
* open ibus preferences from the ibus menu in the notification area.
* close preferences. (after this, the python process runs at 100% -- infinite loop?)

Changed in ibus (Ubuntu):
status: New → Confirmed
description: updated
gokul (dotgokul) wrote :

Not sure if this will be helpful. I tried running the python script under pdb:

pdb /usr/share/ibus/ui/gtk/main.py
> /usr/share/ibus/ui/gtk/main.py(30)<module>()
-> import os
(Pdb) continue
Traceback (most recent call last):
  File "/usr/lib/python2.6/pdb.py", line 1296, in main
    pdb._runscript(mainpyfile)
  File "/usr/lib/python2.6/pdb.py", line 1215, in _runscript
    self.run(statement)
  File "/usr/lib/python2.6/bdb.py", line 372, in run
    exec cmd in globals, locals
  File "<string>", line 1, in <module>
  File "/usr/share/ibus/ui/gtk/main.py", line 118, in <module>
    main()
  File "/usr/share/ibus/ui/gtk/main.py", line 112, in main
    launch_panel()
  File "/usr/share/ibus/ui/gtk/main.py", line 83, in launch_panel
    UIApplication().run()
  File "/usr/share/ibus/ui/gtk/main.py", line 54, in __init__
    self.__panel = panel.Panel(self.__bus)
  File "/usr/share/ibus/ui/gtk/panel.py", line 73, in __init__
    self.__data_dir = path.join(self.__prefix, "share", "ibus")
  File "/usr/lib/python2.6/posixpath.py", line 67, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /usr/lib/python2.6/posixpath.py(67)join()
-> elif path == '' or path.endswith('/'):
(Pdb)

gokul (dotgokul) wrote :

update:
now the run away python process is there as soon as I login to the desktop. However, a sure shot way to start it is to open the preferences dialog and close it.

it now changes the language to chinese-pinyin randomly (I have both chinese-pinyin and japanese-anthy installed, but chinese is the first in the list)

gokul (dotgokul) on 2010-09-30
description: updated
gokul (dotgokul) wrote :

This is what I gather by running "strace -f " on ibus-daemon:

/*the child process, i.e., the preferences window is closed*/

31490 --- SIGCHLD (Child exited) @ 0 (0) ---
31490 write(10, "\0", 1) = 1
31490 rt_sigreturn(0xa) = -1 EINTR (Interrupted system call)
31490 wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 31496
31490 read(4, 0x295a334, 4096) = -1 EAGAIN (Resource temporarily unavailable)
31490 poll([{fd=5, events=POLLIN}, {fd=4, events=POLLIN}, {fd=8, events=POLLIN}, {fd=9, events=POLLIN}, {fd=3, events=POLLIN}, {fd=7, events=POLLIN}], 6, -1) = 1 ([{fd=9, revents=POLLIN}])

/*this fd (9) belongs to the entity that sits on the panel... it is a pipe. EFAULT is does not appear until the child window is closed.*/

31490 read(9, 0, 1) = -1 EFAULT (Bad address)
31490 read(4, 0x295a334, 4096) = -1 EAGAIN (Resource temporarily unavailable)
31490 poll([{fd=5, events=POLLIN}, {fd=4, events=POLLIN}, {fd=8, events=POLLIN}, {fd=9, events=POLLIN}, {fd=3, events=POLLIN}, {fd=7, events=POLLIN}], 6, -1) = 1 ([{fd=9, revents=POLLIN}])
31490 read(9, 0, 1) = -1 EFAULT (Bad address)
.........
..........
this continues until I select quit from the panel menu item.

will attach the full strace log as "gokul-ibus-daemon.strace.tbz".

gokul (dotgokul) wrote :

full strace.

john e (john-godzero) wrote :

kubuntu 10.10 (2010-10-05) also see.
restart usually clears it.

-john e

(32 bit software: flash, skype (64 bit package), QQ)

rileinc (rileinc) wrote :

Just updated from Lucid to Maverick stable x64. This issue affects me as well. When iBus daemon is running, python would consume 100% of a core. Exit iBus, CPU hogging by python stops. This leaves me unable to type in my native language.

I try to rebuild ibus package without 05_appindicator.patch. and it works fine (maybe).
Karl who is author of this patch, please take a look.

Karl Lattimer (karl-qdh) wrote :

Correction, I'm not the author of the patch exactly, I updated the existing patch to show the icons. This seems like it's part of the patch though so I'll take a look at it.

Changed in ibus (Ubuntu):
assignee: nobody → Karl Lattimer (karl-qdh)
Karl Lattimer (karl-qdh) on 2010-10-12
Changed in ibus (Ubuntu):
status: Confirmed → In Progress
Karl Lattimer (karl-qdh) wrote :

@gokul, you have to run it with IBUS_PREFIX=/usr python /usr/share/ibus/ui/gtk/main.py

Karl Lattimer (karl-qdh) wrote :

I've discovered a fix for this bug and will produce a patch soon, and make an upload to my ppa for testing.

Some problem with python signals causes it.

Karl Lattimer (karl-qdh) wrote :

an updated ibus package has been uploaded to my ppa

ppa:karl-qdh/ppa it will be available for testing shortly.

Karl Lattimer (karl-qdh) wrote :

updated distro patch

Changed in ibus (Ubuntu):
status: In Progress → Fix Committed
gokul (dotgokul) wrote :

@karl

 Thanks for the tip on how to run the main.py file.

 I upgraded the packages from the ppa. The python process now does not run, but becomes <defunct> and remains there until I open the "preferences" from the panel indicator's menu again (and closing this new window leaves behind a new <defunct> python process and so on).

 Also, the preferences window does not seem to open all the time... sometimes there seems to be no response on clicking the menu item. Same is the case for restart and quit menu items. Changing the input method from that indicator's menu however, seems to respond as expected. But this behavior has been there even before the upgrade to through your ppa.

tags: added: patch
Karl Lattimer (karl-qdh) wrote :

ok, I'll retest this and see if I can reproduce that.

Karl Lattimer (karl-qdh) wrote :

The unresponsiveness of the menu I was informed is a python binding bug that *should* have been fixed by now. I'll dig into that one again if the fix still isn't released.

I applied path and has the same issue with gokul and also, If I want to select other Chinese input method, it does not work sometime.

Karl Lattimer (karl-qdh) wrote :

Ok, as I'm testing the preferences always shows and goes away properly, I can confirm it leaves a defunct process but it'll kill this every time the preferences are invoked.

The problem here is that after the signal is called responding to the window close it goes ape for no reason at all, I can't debug why as it appears to be very very deep inside python.

I can't get the "No input window" to change into a list of input methods :/ this means there are other problems...

gokul (dotgokul) wrote :

@karl
On a whim I logged out and logged back in. A re-login into gnome seems to fix the unresponsiveness.
Just for the record, this does not fix the <defunct> process situation.

As of today this bug appears to be fixed in Maverick. python launched by ibus is now using nominal CPU and the IME menu window now works normally.

Thanks a lot guys, good work!

Perry Thompson (rypervenche) wrote :

I am still having this problem. I click on the preferences from the panel icon then close it and main.py runs at 100% CPU forever.

What's worse, now there is a new problem. I often have the ibus settings menu open then close repeatedly. It usually happens when I click on any new window. It happens the most when I am focused on the ccsm. When I kill main.py, the problem desists.

I am on 10.10 and have updated and upgraded with no luck. I even purged ibus and reinstalled it with no luck.

Perry Thompson (rypervenche) wrote :

There are others who are having the same problem. http://ubuntuforums.org/showthread.php?p=9975943 I use Chewing as my first ibus layout, for those trying to reproduce this.

Karl Lattimer (karl-qdh) wrote :

could you take a look at /usr/share/ibus/ui/gtk/panel.py on line 77 for this code;

        if not appindicator:
            signal.signal(signal.SIGCHLD, self.__sigchld_cb)

that was the fix for the bug, if that's in there and you're still experiencing the problem, please comment.

Perry Thompson (rypervenche) wrote :

The code is not there. However, I had purged ibus and reinstalled it with no luck.

gokul (dotgokul) wrote :

Just so that everyone is on the same page:
the fix is available only in the ppa as of now [ppa is mentioned in comment #15]
I will edit the description to include this workaround/patch so that everyone sees that first.

description: updated
sunsongxp (sunsongxp) wrote :

I confirm the same experience, and it's urgent! Update are desperately desired.

jeannich (jeannich) wrote :

I confirm the fix available in post #15 (https://bugs.launchpad.net/ubuntu/+source/ibus/+bug/637671/comments/15) solved the issue! No crazy "Python" process anymore.

I can use iBus again, thanks a lot!

Zhang Weiwu (zhangweiwu) wrote :

Offer some information for those who don't use an DE: I am a bit surprised that I hit this problem too as I thought non-DE users are immune to such problems as they can decide if turn on the input method or not by .xsession. Fact is .xsession no longer have control over what input method to run or in which mode (IM_MODULE/XIM).

I don't use gnome at all on my Ubuntu Maverick 32-bit and what I use for XIM is decided in .xsession (which launches fluxbox), now having this 100% cpu problem, I commented out everything related to xim daemon:

#export GTK_IM_MODULE="ibus"
#export XMODIFIERS="@im=ibus"
#/usr/bin/ibus-daemon --xim &

and that doesn't help. With all these commented out, ibus run as usual, means I will not have control over xim daemon like I used to.

My preference of using xim (instead of *K_IM_MODULE) is so that I still have control over it in .xsession. It seems things changed now.

Karl Lattimer (karl-qdh) wrote :

@Zhang, maybe this bug is affecting you, https://bugs.launchpad.net/bugs/625793

I was having similar problems too, hope the gconf-settings-daemon fix helps
it

Pedro Nariyoshi

On Mon, Oct 18, 2010 at 6:21 AM, Karl Lattimer <email address hidden> wrote:

> @Zhang, maybe this bug is affecting you,
> https://bugs.launchpad.net/bugs/625793
>
> --
> ibus python 100 % cpu for ever
> https://bugs.launchpad.net/bugs/637671
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in “ibus” package in Ubuntu: Fix Committed
>
> Bug description:
> Binary package hint: ibus
>
> After installing many languages and selecting input engine to ibus, the cpu
> stays at 100 % usage with process "python" for the second time , not sure
> how to reprocude. Autobugreport mentions ibus somewhere ...
>
> ProblemType: Bug
> DistroRelease: Ubuntu 10.10
> Package: ibus 1.3.7-1ubuntu3
> ProcVersionSignature: Ubuntu 2.6.35-20.29-generic 2.6.35.4
> Uname: Linux 2.6.35-20-generic x86_64
> Architecture: amd64
> Date: Tue Sep 14 01:48:40 2010
> ExecutablePath: /usr/share/ibus/ui/gtk/main.py
> InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Beta amd64
> (20100901.1)
> InterpreterPath: /usr/bin/python2.6
> ProcEnviron:
> SHELL=/bin/bash
> LANG=de_DE.utf8
> LANGUAGE=de:en_US:en
> SourcePackage: ibus
>
> steps to recreate the problem:
> * open ibus preferences from the ibus menu in the notification area.
> * close preferences. (after this, the python process runs at 100% cpu)
>
> FIX:
> There is a fix available in the ppa. See comment #15.
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/ubuntu/+source/ibus/+bug/637671/+subscribe
>

Changed in ibus (Ubuntu):
assignee: Karl Lattimer (karl-qdh) → Ken VanDine (ken-vandine)
Karl Lattimer (karl-qdh) wrote :

kenvandine's investigation of this reveals that it's not quite right.

I'm going to continue to fix the problems he's mentioned (menu's stop working) and see how far I get.

Changed in ibus (Ubuntu):
assignee: Ken VanDine (ken-vandine) → Karl Lattimer (karl-qdh)
Karl Lattimer (karl-qdh) wrote :

Urgh, after some hacking around i have a test case which proves there's some kind of bug in python signal.signal, it may be that python's signal.signal is incompatible with gtks mainloop.

Karl Lattimer (karl-qdh) wrote :

I have a fix for this bug, but am unwilling to release it given that there are more bugs under it :/ I'll continue to try and fix these issues and produce a properly patched version soon.

Changed in ibus (Ubuntu):
status: Fix Committed → Confirmed

I hope this patch fixes this issue finally.
03_fix1104.patch is taken from http://github.com/ibus/ibus/commit/acf2a46cdce536945d56ecc2a581fda38470dfe5 and backport to 1.3.7.
Please check and test it.

Thanks.

Karl Lattimer (karl-qdh) wrote :

@Ikuya, that's effectively the patch I have. However, it's slightly pointless right now given that ibus won't work properly due to window focus tracking issues which I was in the middle of debugging.

I'll be speaking to tedg this week (as I'm at UDS) and will try and persuade him to make life easier for ibus focus tracking.

luojie-dune (luojie-dune) wrote :

It seems the bug fixed in Upstream release 1.3.8

http://code.google.com/p/ibus/

    * 2010-10-22 ibus 1.3.8 stable release
          o Fix CPU 100% usage with signal.SIGCHLD
          o Destroy existing connection before creating a new connection, and only create the fake context once.
          o Move the candidate window just above the cursor when the window and a preedit string overlap.
          o Enable key snooper by default again
          o Always consume the hotkey, even if the hotkey associated engine already activated.
          o Fix race condition in bus_ibus_impl_create_engine()
          o Fix a build error of IBus-1.0.gir with gobject-introspection 0.9.6
          o Implement stress tool for ibus.
          o Fix a build error with GTK3 gdkkeysyms.h
          o Add time info in log message from <email address hidden>
          o Fix memory leak in ibus_input_context_process_key_event by Fujiwarat
          o Fix segv in bus_engine_proxy_process_key_event_reply_cb
          o Fix property issue.
          o Updated many translations.

I already tested ibus 1.3.8 with Ubuntu specification patchs, it works well, no cpu 100%

Zhang Weiwu (zhangweiwu) wrote :

@Karl Lattimer on #32: you suggested me to check #625793, which I think is not affecting me, because that bug have gnome-setting-daemon taking 100% CPU while I had python taking all CPU resource.

I'm not getting neither python or gnome-settings-daemon using 100%, but I'm
still getting random input method switching (between chinese japanese and
off), and sometimes it's really out of control. Should I file a new bug?

Pedro Nariyoshi

On Thu, Oct 28, 2010 at 12:22 AM, Zhang Weiwu <email address hidden> wrote:

> @Karl Lattimer on #32: you suggested me to check #625793, which I think
> is not affecting me, because that bug have gnome-setting-daemon taking
> 100% CPU while I had python taking all CPU resource.
>
> --
> ibus python 100 % cpu for ever
> https://bugs.launchpad.net/bugs/637671
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in “ibus” package in Ubuntu: Confirmed
>
> Bug description:
> Binary package hint: ibus
>
> After installing many languages and selecting input engine to ibus, the cpu
> stays at 100 % usage with process "python" for the second time , not sure
> how to reprocude. Autobugreport mentions ibus somewhere ...
>
> ProblemType: Bug
> DistroRelease: Ubuntu 10.10
> Package: ibus 1.3.7-1ubuntu3
> ProcVersionSignature: Ubuntu 2.6.35-20.29-generic 2.6.35.4
> Uname: Linux 2.6.35-20-generic x86_64
> Architecture: amd64
> Date: Tue Sep 14 01:48:40 2010
> ExecutablePath: /usr/share/ibus/ui/gtk/main.py
> InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Beta amd64
> (20100901.1)
> InterpreterPath: /usr/bin/python2.6
> ProcEnviron:
> SHELL=/bin/bash
> LANG=de_DE.utf8
> LANGUAGE=de:en_US:en
> SourcePackage: ibus
>
> steps to recreate the problem:
> * open ibus preferences from the ibus menu in the notification area.
> * close preferences. (after this, the python process runs at 100% cpu)
>
> FIX:
> There is a fix available in the ppa. See comment #15.
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/ubuntu/+source/ibus/+bug/637671/+subscribe
>

Karl Lattimer (karl-qdh) wrote :

Hi all, the patch proposed in comment #37 will hopefully be pushed today by kenvandine, this will still leave us with a focus tracking issue which means that the input method switching from the menu will still be prone to failure.

Ken VanDine (ken-vandine) wrote :

I had to rename a call out to __sigchld_cb since it was removed in 03_fix1104.patch and i dropped the hunk that patched the .c file which didn't seem relevant to this bug and caused a FTBFS

lp:~ken-vandine/ubuntu/maverick/ibus/maverick

With this branch, it doesn't peg the CPU anymore but it is still not functional at all for me. The only menu item that does anything is "Quit".

Karl Lattimer (karl-qdh) wrote :

Attached patch fixes the problem more effectively than the backported patch and doesn't do incorrect things like calling os.kill on a glib watch.

Karl Lattimer (karl-qdh) wrote :

yet another patch to replace the existing patch

Perry Thompson (rypervenche) wrote :

I got mine fixed with this ppa, https://launchpad.net/~ossug-hychen/+archive/ibus

I don't think it's been changed anywhere else. This one fixes all of the problems I have encountered so far.

David Barth (dbarth) on 2010-11-09
Changed in ayatana-ubuntu:
assignee: nobody → Karl Lattimer (karl-qdh)
importance: Undecided → Medium
status: New → Fix Committed
tags: added: sru
Didier Roche (didrocks) wrote :

This release fails to build on natty, probably due to new GI:

usr/lib/dbus-1.0/include -DG_LOG_DOMAIN=\"IBUS\" -g -O2 -c test-global-engine.c
  CCLD test-global-engine
  GISCAN IBus-1.0.gir
g-ir-scanner: warning: Option --strip-prefix has been deprecated;
see --identifier-prefix and --symbol-prefix.
  GICOMP IBus-1.0.gir
error parsing file IBus-1.0.gir: Line 20, character 33: The attribute 'name' on the element 'type' must be specified
make[4]: *** [IBus-1.0.typelib] Erreur 1
make[4]: quittant le répertoire « /home/didrocks/work/ibus/build-area/ibus-1.3.7/src »
make[3]: *** [all] Erreur 2
make[3]: quittant le répertoire « /home/didrocks/work/ibus/build-area/ibus-1.3.7/src »
make[2]: *** [all-recursive] Erreur 1
make[2]: quittant le répertoire « /home/didrocks/work/ibus/build-area/ibus-1.3.7 »
make[1]: *** [all] Erreur 2
make[1]: quittant le répertoire « /home/didrocks/work/ibus/build-area/ibus-1.3.7 »
dh_auto_build: make -j1 returned exit code 2
make: *** [build] Erreur 2
dpkg-buildpackage: erreur: debian/rules build a produit une erreur de sortie de type 2
debuild: fatal error at line 1337:
dpkg-buildpackage -rfakeroot -D -us -uc -i -I failed
bzr: ERROR: The build failed.

Indeed:
didrocks@tidus:~/work/ibus/maverick$ grep -r strip-prefix *
src/Makefile.in:@HAVE_INTROSPECTION_TRUE@IBus_1_0_gir_SCANNERFLAGS = --strip-prefix=IBus --pkg=dbus-1,glib-2.0
src/Makefile.am:IBus_1_0_gir_SCANNERFLAGS = --strip-prefix=IBus --pkg=dbus-1,glib-2.0

Not sure if we can safely remove the prefix there. Ken, can you please have a look upstream about it and if we should make two uploads? One for maverick, the other for natty?

Changed in ibus (Ubuntu):
assignee: Karl Lattimer (karl-qdh) → Ken VanDine (ken-vandine)

Accepted ibus into maverick-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in ibus (Ubuntu Maverick):
status: New → Fix Committed
tags: added: verification-needed

1.3.7-1ubuntu4 works great for me.
Thank you for your effort.

This bug is fixed in ibus 1.3.7-1ubuntu4 in maverick-proposed

Step to Reproduce:

1. Boot Ubuntu Maverick Live CD, and Click "Try Ubuntu"
2. Install ibus-1.37-1ubuntu4 and python-ibus-1.37-1ubuntu4 in mavarick-proposed archive
3. Install ibus-chewing 1.3.6-20100730-1 in maverick archive
4. Press Ctrl + Space to active input method engine, and type Chinese word

Result:

1. Ibus does not take 100% cpu
2. ibus-chewing setting windows does not flashs (fixed LP:659690)

thanks you all

Hagen (hagenf) wrote :

I can also confirm that the bug is fixed in maverick-proposed. The new version also fixes some other bugs for me (unresponsiveness and random switches of input method).

Martin Pitt (pitti) wrote :

Please fix this ASAP in natty, so that the fix can go into maverick-updates.

tags: added: verification-done
removed: verification-needed
Sebastien Bacher (seb128) wrote :

the fix is in natty now

Changed in ibus (Ubuntu):
status: Confirmed → Fix Released
Changed in ayatana-ubuntu:
status: Fix Committed → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ibus - 1.3.7-1ubuntu4

---------------
ibus (1.3.7-1ubuntu4) maverick-proposed; urgency=low

  [ Karl Lattimer ]
  * debia/patches/05_appindicator.patch
    - Fixed unresponsive menu, (LP: #645724)
    - Fixed 100% cpu usage properly, (LP: #637671)
    - Fixed focus tracking issue, (LP: #522079)

  [ Ikuya Awashiro ]
  * debian/patches/03_fix1104.patch: added.
    - http://code.google.com/p/ibus/issues/detail?id=1104
    - This patch fixed (LP: #637671) finally.

  [ Ken VanDine ]
  * debian/README.source
    - Removed, it was outdated and no longer correct
 -- Ken VanDine <email address hidden> Tue, 16 Nov 2010 09:57:35 -0500

Changed in ibus (Ubuntu Maverick):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.