hald-addon-input making 100%-cpu-usage

Bug #203679 reported by midnightflash
48
Affects Status Importance Assigned to Milestone
hal (Gentoo Linux)
Unknown
High
hal (Ubuntu)
Fix Released
High
Martin Pitt
Hardy
Fix Released
High
Martin Pitt

Bug Description

Sometimes after a certain while after fresh boot top shows something like the following:

top - 17:26:06 up 2:03, 2 users, load average: 2.93, 3.12, 3.17
Tasks: 112 total, 5 running, 107 sleeping, 0 stopped, 0 zombie
Cpu(s): 48.8%us, 40.9%sy, 10.3%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1034360k total, 1018448k used, 15912k free, 42412k buffers
Swap: 2931852k total, 38192k used, 2893660k free, 572028k cached

  PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
 5225 root 20 0 3436 1328 1160 R 80.8 0.1 73:14.44 hald-addon-inpu
 9102 root 30 10 77552 74m 1464 R 8.0 7.3 5:33.33 scrollkeeper-up
 6207 root 20 0 163m 25m 10m S 3.7 2.5 6:47.18 Xorg

It has to be killed because it doesn't stop by itself even after many minutes.

Affected is up-to-date Hardy-Alfa-6

Related branches

Revision history for this message
Kristopher Ives (nullmind) wrote :

I have the same problem if I disable wireless while using the b44 ethernet driver (and b43 wireless driver which seem to have a depmod)

Revision history for this message
Justin Lunning (jmlunning) wrote :

I've run into the same thing as well. A few minutes upon logging in after a fresh boot, my laptop fans are running at full speed. If I look at 'top' I see hald-addon-inpu using 100% CPU utilization. I have to manually kill it, then the fans slow down.

I have the bcm43 wireless module installed (with firmware), but I have wireless set to disabled, since I use an Sierra PCMCIA ppp card all the time.

The problem is random. Some fresh boots are fine. Others I have to kill hald-addon-inpu

Revision history for this message
Barteq (barteqpl) wrote :

Same here. T61 with iwl4965.

PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command
 5739 root 20 0 3436 1364 1184 S 99.3 0.0 2:22.75 hald-addon-input: Listening on /dev/input/event7 /dev/input/event1 /dev/input/event12

Occurs randomly.

After it's being killed there is no popup while manipulating LCD backlight with fn + (home|end) keys.

Revision history for this message
midnightflash (midnightflash) wrote :

Barteq: Yes it's the same with me on older Thinkpads (R50p and T40).
I was wandering, why it's disappearing... But it's obvious.

Revision history for this message
sergks (sergks) wrote :

Have the same problem each time I disable wireless:

 8832 root 20 0 3436 1344 1176 R 98.5 0.1 2:25.90 hald-addon-inpu
 9482 root 20 0 219m 60m 29m S 0.7 6.0 1:09.92 Xorg

06:02.0 Network controller: Broadcom Corporation BCM4318 [AirForce One 54g] 802.11g Wireless LAN Controller (rev 02)

Revision history for this message
Mike Dalessio (mike-csa) wrote :

Same thing happens to me when I unlock gnome-screensaver. CPU utilization goes to 100% for hald-addon-input until I restart hal. I'm running on a Thinkpad Z60m.

Interesting syslog messages appear when this occurs:

Mar 24 23:52:37 troglobite kernel: [ 7540.014311] input: Virtual ThinkFinger Keyboard as /devices/virtual/input/input18
Mar 24 23:52:37 troglobite NetworkManager: <debug> [1206417157.780176] nm_hal_device_added(): New device added (hal udi is '/org/freedesktop/Hal/devices/computer_logicaldev_input_6').
Mar 24 23:52:40 troglobite NetworkManager: <debug> [1206417160.570412] nm_hal_device_removed(): Device removed (hal udi is '/org/freedesktop/Hal/devices/computer_logicaldev_input_6').

Also possibly noteworthy, is that as I repeat this process, the "input" number increases. That is, done twice more, I'll get the above message for input19 and input20:

Mar 24 23:54:58 troglobite kernel: [ 7657.892823] input: Virtual ThinkFinger Keyboard as /devices/virtual/input/input19
...
Mar 24 23:57:12 troglobite kernel: [ 7790.678671] input: Virtual ThinkFinger Keyboard as /devices/virtual/input/input20

Revision history for this message
Liken Otsoa (liken) wrote :

Some problem. Hald-addon-input gets 100% CPU always after I unlock screen and sometimes when I resume from suspend.

I do
/etc/init.d/hal restart
to stop it

Revision history for this message
Mike Dalessio (mike-csa) wrote :

Forgot to give versions ... I'm running Hardy, hal is 0.5.11~rc2-1ubuntu2.

Revision history for this message
Mike Dalessio (mike-csa) wrote :

also there's a related ticket (dupe?) at

https://bugs.launchpad.net/ubuntu/+bug/203515

Revision history for this message
Mike Dalessio (mike-csa) wrote :

I'm marking this as confirmed, since multiple people (on multiple tickets) are having similar issues.

New note: when I disable the 'thinkfinger' functionality on my thinkpad, this problem stops occurring. It appears to have something to do with new hardware being added and removed from hal. This is consistent with other people's descriptions of turning off wireless network and losing bluetooth connections.

Changed in hal:
status: New → Confirmed
Revision history for this message
XmIsTeR (xmisterhu) wrote :

Same problem, when I connect my bluetooth-adapter.

Revision history for this message
Matthew Tighe (tighem) wrote :

Started for me today after the kernel upgrade. I do run thinkfinger, too. I've been running it for a few days with no problems until I graded to -14 kernel in Hardy.

Changed in hal:
status: Unknown → Confirmed
Revision history for this message
uzahnd (uzahnd) wrote :

Same as Matthew Tighe: Running ThinkFinger, upgrade to -14-Kernel, hald-addon-inpu is on 97%
(there weren't any problems before)

Revision history for this message
midnightflash (midnightflash) wrote :

And my problem seems to be gone since the 2.6.24-14-Kernel upgrade.

Revision history for this message
Lars Hallberg (lah) wrote :

Still have it (at random on boot) with the 2.6.24-14-Kernel. Do have a wireless card but wireless set to disabled.

$ sudo /etc/init.d/hal restart

Fixes it. /LaH

Revision history for this message
Lars Hallberg (lah) wrote :

May be hal starting to early?

https://bugs.launchpad.net/ubuntu/+source/hal/+bug/211343

My system is a upgrade and I have /etc/rc2.d/S12hal

/LaH

Revision history for this message
midnightflash (midnightflash) wrote :

@ Lars Hallberg
No... I only got /etc/rc2.d/S24hal and the problem still occurs. With Kernel -14 and -15.

Revision history for this message
Marcus Asshauer (mcas) wrote :

I have the same problem with my iBook (ppc).
/etc/init.d/hal restart works for me. I have this after a normal boot.
Kernel: 2.6.24-12
hal:
  Installiert:0.5.11~rc2-1ubuntu5
  Mögliche Pakete:0.5.11~rc2-1ubuntu5
  Versions-Tabelle:
 *** 0.5.11~rc2-1ubuntu5 0
        500 http://ports.ubuntu.com hardy/main Packages
        100 /var/lib/dpkg/status

Revision history for this message
Thiago Gallo (tagallo) wrote :

I have the same problem in a Thinkpad R61.
I think this is related to thinkfinger in my case.
I'm running Hardy

htop shows-me the hald command line:
hald-addon-input: listening on /dev/input/event8 /dev/input/event7 /dev/input/event1 /dev/input/event11 /dev/input/event3 /dev/input/event4 /dev/input/event5 /dev/input/event6

Revision history for this message
Barteq (barteqpl) wrote :

Happened again without any reason.

Hal: 0.5.11~rc2-1ubuntu6
kernel: 2.6.24-15-generic
HW: lenovo t61

root 5661 4.2 0.0 3444 1340 ? R 15:49 16:58 hald-addon-input: Listening on /dev/input/event7 /dev/input/event6 /dev/input/event1 /dev/input/event13 /dev/input/event3 /dev/input/event4 /dev/input/event5 /dev/input/event8

100% Cpu load

strace log attached below.

Revision history for this message
blackbeast (blackbeast-inbox) wrote :

I just had this problem. It took me 15 minutes to figure what's wrong. I restarted ubuntu 2 times...
Finally, i run top and then saw what was the problem.
This happened while i was surfing... Nothing especially.

I use 8.04 amd64 desktop beta.

Revision history for this message
Herbert V. Riedel (hvr) wrote :

I noticed this issue on my powerbook as well since upgrading to hardy (and I happen to use the b43 driver);
I strace(1)ed the hald-addon-input process which was running at 100% cpu, and noticed it was looping in a poll(2) call which returned POLLNVAL for one fd, which turned out to be non-existent when inspecting the process with lsof(1):

strace output:
...
poll([{fd=5, events=POLLIN}, {fd=6, events=POLLIN}, {fd=9, events=POLLIN, revents=POLLNVAL}, {fd=3, events=POLLIN}, {fd=8, events=POLLIN}, {fd=4, events=POLLIN}], 6, -1) = 1
poll([{fd=5, events=POLLIN}, {fd=6, events=POLLIN}, {fd=9, events=POLLIN, revents=POLLNVAL}, {fd=3, events=POLLIN}, {fd=8, events=POLLIN}, {fd=4, events=POLLIN}], 6, -1) = 1
...(and so on)

lsof output:
...
hald-addo 4878 root 0r CHR 1,3 6625 /dev/null
hald-addo 4878 root 1u CHR 1,3 6625 /dev/null
hald-addo 4878 root 2u CHR 1,3 6625 /dev/null
hald-addo 4878 root 3u unix 0xef0b74e0 14102 socket
hald-addo 4878 root 4r CHR 13,69 12149 /dev/input/event5
hald-addo 4878 root 5w CHR 13,67 12054 /dev/input/event3
hald-addo 4878 root 6r CHR 13,66 11958 /dev/input/event2
hald-addo 4878 root 8r CHR 13,65 11900 /dev/input/event1
... (no fd=9 listed...)

hth

Revision history for this message
greenhunter (tierfreunde-hagenburg) wrote :

confirmed!

makes my system unuseable now.

Hardy-386 with all updates

Revision history for this message
greenhunter (tierfreunde-hagenburg) wrote :

after the 3. reboot, the systems seems to work proper.

Revision history for this message
midnightflash (midnightflash) wrote :

Kernel 2.6.24-16 does not help.

Revision history for this message
Frédéric Petit (fraiddo) wrote :

I have the same problem with scrollkeeper-up and hald-addon-inpu, with hardu beta and the updates.

Revision history for this message
Mozg (andrei-arhont) wrote :
Download full text (11.8 KiB)

Same happens with me on Thinkpad T61p with thinkfinger and iwl4965. I could not notice any consistency in this behaviour. It happens randomly and I've noticed this after the recent updates. I've upgraded by Hardy beta on 09/04/2008 and it did not happen initially. After the yesterday's upgraded i've noticed this behaviour. I do run wireless with WPA-psk and my bluetooth is on by default but not peered with any device. This too happens shortly after system boot

Info:
Hardy beta 1 with full updates as of 13/04/2008
hal: 0.5.11~rc2-1ubuntu6
uname -r : 2.6.24-16-generic
Arch: amd64

hald-addon-input strace shows a lot of:

---
oll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=9, events=POLLIN}, {fd=10, events=POLLIN}, {fd=11, events=POLLIN}, {fd=12, events=POLLIN, revents=POLLNVAL}, {fd=3, events=POLLIN}, {fd=6, events=POLLIN}], 10, -1) = 1
poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=9, events=POLLIN}, {fd=10, events=POLLIN}, {fd=11, events=POLLIN}, {fd=12, events=POLLIN, revents=POLLNVAL}, {fd=3, events=POLLIN}, {fd=6, events=POLLIN}], 10, -1) = 1

---

lsof |grep hald-add:

---
hald-addo 7799 root cwd DIR 254,3 4096 50490928 /usr/lib/hal
hald-addo 7799 root rtd DIR 254,2 4096 128 /
hald-addo 7799 root txt REG 254,3 23648 50508792 /usr/lib/hal/hald-addon-input
hald-addo 7799 root mem REG 254,2 14624 44091148 /lib/libdl-2.7.so
hald-addo 7799 root mem REG 254,2 109368 37749080 /lib/libselinux.so.1
hald-addo 7799 root mem REG 254,3 154200 379 /usr/lib/libpcre.so.3.12.1
hald-addo 7799 root mem REG 254,2 93080 44091151 /lib/libnsl-2.7.so
hald-addo 7799 root mem REG 254,3 281104 84998 /usr/lib/libgobject-2.0.so.0.1600.3
hald-addo 7799 root mem REG 254,2 1436976 44091145 /lib/libc-2.7.so
hald-addo 7799 root mem REG 254,3 783864 84993 /usr/lib/libglib-2.0.so.0.1600.3
hald-addo 7799 root mem REG 254,3 248432 943790 /usr/lib/libdbus-1.so.3.4.0
hald-addo 7799 root mem REG 254,3 131880 95366 /usr/lib/libdbus-glib-1.so.2.1.0
hald-addo 7799 root mem REG 254,3 62976 95977 /usr/lib/libhal.so.1.0.0
hald-addo 7799 root mem REG 254,2 127480 44091142 /lib/ld-2.7.so
hald-addo 7799 root mem REG 254,3 25700 67240750 /usr/lib/gconv/gconv-modules.cache
hald-addo 7799 root 0r CHR 1,3 9809 /dev/null
hald-addo 7799 root 1u CHR 1,3 9809 /dev/null
hald-addo 7799 root 2u CHR 1,3 9809 /dev/null
hald-addo 7799 root 3u unix 0xffff810133c16580 19425 socket
hald-addo 7799 root 4r CHR 13,71 ...

Revision history for this message
yaroslav (yarik-yarik) wrote :

I have the same problem with Thinkpad X60 running hardy fully updated. This happens almost every time screen is unlocked.

Revision history for this message
Davi Garcia (davivcgarcia-deactivatedaccount) wrote :

I have the some problem too with my Thinkpad R61 running 8.04b. This happens almost when I start the Ubuntu.

Revision history for this message
Craig Magina (craig.magina) wrote :

I am also having this problem on a Thinkpad X61 tablet running Hardy.

Revision history for this message
Jon Oberheide (jon-oberheide-deactivatedaccount) wrote :

Experiencing the same intermittently on a ThinkPad X300.

The addon-input tool is pretty straightforward:

http://cgit.freedesktop.org/hal/tree/hald/linux/addons/addon-input.c

It's been forever since I've used GIOChannels, but it doesn't look like the channel might not be getting fully unref'ed the correct number of times. A GIOChannel starts off with a refcount of 1 when it's created and is incremented on a g_io_add_watch_full(). Normally, the event source should be removed if it's callback returns FALSE. But if there's another caller of remove_device(), the channel gets shutdown and deref'ed once but if the event source is still around the ref count will still be 1 and might result in the polling on a non-existent fd behavior that we're seeing.

Then again, I'm totally rusty on GIO and am likely way off. :-)

Revision history for this message
Jon Oberheide (jon-oberheide-deactivatedaccount) wrote :

It looks like this might indeed be the case:

read(12, "\335\27\10H\0\0\0\0\374L\1\0\0\0\0\0\0\0\0\0\1\0\0\0", 1024) = 24
read(12, 0x6115a0, 1024) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=9, events=POLLIN}, {fd=10, events=POLLIN}, {fd=11, events=POLLIN}, {fd=6, events=POLLIN}, {fd=3, events=POLLIN, revents=POLLIN}, {fd=12, events=POLLIN}], 10, -1) = 1
read(3, "l\1\0\1\3\3\0\0\27\0\0\0\204\0\0\0\1\1o\0#\0\0\0/org/f"..., 2048) = 923
read(3, 0x60cca0, 2048) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=9, events=POLLIN}, {fd=10, events=POLLIN}, {fd=11, events=POLLIN}, {fd=6, events=POLLIN}, {fd=12, events=POLLIN}, {fd=3, events=POLLIN}], 10, 0) = 0
close(12) = 0
writev(3, [{"l\2\1\1\0\0\0\0\27\0\0\0\10\0\0\0\5\1u\0\27\0\0\0", 24}, {"", 0}], 2) = 24
poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}, {fd=9, events=POLLIN}, {fd=10, events=POLLIN}, {fd=11, events=POLLIN}, {fd=6, events=POLLIN}, {fd=12, events=POLLIN, revents=POLLNVAL}, {fd=3, events=POLLIN}], 10, -1) = 1

fd 12 is closed via remove_device() but not removed from poll's fdset. Therefore poll continues to return with the POLLNVAL code but it is never handled. The POLLNVAL should be handled by adding G_IO_NVAL to the g_io_add_watch_full() event mask and then also included in the error condition at the top of event_io().

Revision history for this message
Peter Meiser (meiser79) wrote :

@Jon: could you perhaps make a patch for your suggestions? Would be great as I'm seeing the issue here with my ThinkPad R52, too.

Revision history for this message
Jon Oberheide (jon-oberheide-deactivatedaccount) wrote :

Attached is a patch against hal's latest GIT branch.

Feel free to try it out and let us know the results.

Revision history for this message
Zivago Lee (zivagolee) wrote :

@Jon: Thanks for the patch. Just applied it to the hal source package and it seems to have cured the issues on my T43.

Revision history for this message
Peter Meiser (meiser79) wrote :

@Jon: that also fixes the problem here. Thanks a lot!

Revision history for this message
Herbert V. Riedel (hvr) wrote :

@Jon: seems to work here: have been running your patch for some hours now, and haven't seen any cpu-eating hald-add-input since then on my powerbook :-)

Revision history for this message
Jon Oberheide (jon-oberheide-deactivatedaccount) wrote :

Excellent. Any maintainers around to review/merge before Hardy?

Martin Pitt (pitti)
Changed in hal:
importance: Undecided → High
Revision history for this message
Martin Pitt (pitti) wrote :

I applied Jon's patch and uploaded it, sitting in the unapproved queue now for release manager inspection. I also forwarded it to upstream.

Changed in hal:
assignee: nobody → pitti
status: Confirmed → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package hal - 0.5.11~rc2-1ubuntu7

---------------
hal (0.5.11~rc2-1ubuntu7) hardy; urgency=low

  * Add 02_input_spin_removed_fd.patch:
    - Avoid spinning on already invalidated/closed file descriptors in the
      input addon. This fixes "hal takes 100% CPU and breaks input device
      handling" on a lot of machines. (LP: #203679)
    - Thanks to Jon Oberheide for the patch!

 -- Martin Pitt <email address hidden> Mon, 21 Apr 2008 10:36:50 +0200

Changed in hal:
status: Fix Committed → Fix Released
Revision history for this message
midnightflash (midnightflash) wrote :

It is fixed for me too.

Changed in hal (Ubuntu):
status: Fix Released → New
Changed in hal (Ubuntu):
status: New → In Progress
Martin Pitt (pitti)
Changed in hal (Ubuntu):
status: In Progress → Fix Released
Changed in hal (Gentoo Linux):
status: Confirmed → Unknown
Changed in hal (Gentoo Linux):
importance: Unknown → High
To post a comment you must log in.
This report contains Public information  
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.