abort with wireless HID devices: A handler is already registered for <battery>

Bug #1112907 reported by Till Kamppeter
638
This bug affects 77 people
Affects Status Importance Assigned to Milestone
Linux
Unknown
Unknown
Upower
Won't Fix
Undecided
upower (Ubuntu)
Fix Released
High
Martin Pitt

Bug Description

.

ProblemType: Crash
DistroRelease: Ubuntu 13.04
Package: upower 0.9.19-1ubuntu4
ProcVersionSignature: Ubuntu 3.5.0-216.23-omap4 3.5.7.1
Uname: Linux 3.5.0-216-omap4 armv7l
ApportVersion: 2.8-0ubuntu3
Architecture: armhf
Date: Fri Feb 1 22:25:19 2013
ExecutablePath: /usr/lib/upower/upowerd
InstallationDate: Installed on 2013-01-17 (15 days ago)
InstallationMedia: Ubuntu 13.04 "Raring Ringtail" - Alpha armhf+omap4 (20130116)
MarkForUpload: True
ProcCmdline: /usr/lib/upower/upowerd
ProcEnviron:

Signal: 5
SourcePackage: upower
StacktraceTop:
 dbus_g_connection_register_g_object () from /usr/lib/arm-linux-gnueabihf/libdbus-glib-1.so.2
 ?? ()
 ?? ()
Title: upowerd crashed with signal 5 in dbus_g_connection_register_g_object()
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups:

Related branches

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :
information type: Private → Public
Revision history for this message
Apport retracing service (apport) wrote :

Stacktrace:
 #0 <unavailable> in ?? ()
 PC not available
StacktraceSource: #0 <unavailable> in ?? ()
StacktraceTop: <unavailable> in ?? ()
ThreadStacktrace:
 PC not available
 warning: wrong size gregset struct in core file
 Quitting: PC register is not available

Changed in upower (Ubuntu):
importance: Undecided → Medium
tags: removed: need-armhf-retrace
Revision history for this message
Sasa Paporovic (melchiaros) wrote : Re: upowerd crashed with signal 5 in dbus_g_connection_register_g_object()

Hi Till,

this here is a problem.

apport-retracing was not able to create a stacktrace(usefull one because of ?? are still there) and there is also not a reproducing procedure.

Both are mostly necessary.

Can I ask you to provide a manually created stacktrace?

This may help

https://wiki.ubuntu.com/DebuggingProgramCrash#Debug_Symbol_Packages

but there is also other stuff arround in the wiki(give it a google/bing/yahoo/whatever).

Also a reproducing procedure would be create.

In meantime I set the status of the report to incomplete.

Please set it back after providing the needed informations.

Thank you.

Changed in upower (Ubuntu):
status: New → Incomplete
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Unfortunately, I cannot reproduce this bug. Here and there a pop-up comes up, mostly right after login, telling that upowerd has crashed. Most of the times I have simply clicked "Cancel" and now I have sent out the crash report.

By the way, the hardware is the Pandaboard ES.

Revision history for this message
Sasa Paporovic (melchiaros) wrote : Re: pandaboard - upowerd crashed with signal 5 in dbus_g_connection_register_g_object()

In this case please install the needed dbg packages (see stacktrace attached on this report)manually and wait until the crash occures again.

Following this:

https://wiki.ubuntu.com/DebuggingProgramCrash

you can examine locally and look if the stacktrace is good enough.

If it is please file a new report and close this here as dublicate.

summary: - upowerd crashed with signal 5 in dbus_g_connection_register_g_object()
+ pandaboard - upowerd crashed with signal 5 in
+ dbus_g_connection_register_g_object()
Revision history for this message
James M. Leddy (jm-leddy) wrote :

Hi melchiaros,

This is likely the same crash as in https://bugs.launchpad.net/ubuntu/+source/upower/+bug/929755/comments/2 . As far as I can tell, this happens because upower expects some battery to be there that isn't there. In bug 929755, it's a wiimote, in other cases, it's a bluetooth mouse.

I can reproduce it pretty frequently, let me know if you need more info. One thing I can't figure out is why it raises signal 5 (SIGTRAP). I thought that was only for gdb?

Changed in upower (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
James M. Leddy (jm-leddy) wrote :

Okay, I've figured out the sigtrap confusion. Apparently, it's what the Gnome devs think is a good signal to tie in to g_error() if you have debugging turned on (we compile glib with debugging turned on?).

I've also managed to find the code that's erroring. Take a look at lines 1706-1711:

http://maemo.org/api_refs/4.0/dbus-glib/dbus-gobject_8c-source.html

http://comments.gmane.org/gmane.comp.gnome.apps.gnucash.user/23290

Revision history for this message
Sasa Paporovic (melchiaros) wrote :

Hi James,

I have to say sorry.

I do only on bug triaging and not coding(have not done for several years -> you loose what you do not train). So, you do not have to orientate to me.

When you want to work on fixing this, please fell absolutely free.

greetings

melchiaros

Revision history for this message
James M. Leddy (jm-leddy) wrote :

Heh, no apology necessary :) I was just trying to get the information that you were looking for.

Now that we do have enough information to reproduce and get core dumps etc, whom do we triage _to_?

Revision history for this message
Sasa Paporovic (melchiaros) wrote :

Unfortunately I am not a member of Ubuntu Bug Control and with this I have no access to

https://bugs.launchpad.net/bugs/929755

which is still private.

There should be a full stacktrace following the dublicate entries you have brought here.

Can you copie it here?(Or set the report to public?

tags: added: quantal
tags: added: precise
tags: added: amd64
tags: added: i386
Revision history for this message
Sasa Paporovic (melchiaros) wrote :

I have looked through the dublicats and added tags that fits for them.

The crash is not limited to pandaboard.

Insted it occures on different architectures.

I adapt the summary for this.

summary: - pandaboard - upowerd crashed with signal 5 in
- dbus_g_connection_register_g_object()
+ upowerd crashed with signal 5 in dbus_g_connection_register_g_object()
Revision history for this message
Sasa Paporovic (melchiaros) wrote : Re: upowerd crashed with signal 5 in dbus_g_connection_register_g_object()

The first occurence I can see is on precise which has upower 0.9.15

The crasher also occures on quantal with upower 0.9.17

and is still there in raring with upower 0.9.19.

Revision history for this message
Sasa Paporovic (melchiaros) wrote :

@jm-leddy

o.K,

I have looked a little bit arround.

Looking at:

https://bugs.launchpad.net/ubuntu/+source/upower/+bugs?orderby=-heat&start=0

upower bugs seems to get not so much attention(to say it nice).There lay 60 open reports arround. Even when you use advance search you see that there where at whole life of launchpad only 94 reports and a closing rate (of whatever reason) of 34 is indeed low.

With the dublicates linked here the flame rate has increased to 266, which is the fourth highest one recently there, so there is a chance that this here will get attention.

Anyway, I think that involving the original developers of upower makes sense here, because the crash occures in different versions of upower and on different architectures(see the comments above). So there could be interest by them to handle this problem.

This brings the next problem with it.

There bugtracker at

https://bugs.freedesktop.org/

seems to be used only sporadic.

Following

http://upower.freedesktop.org/

they prefer contacted by mailing list

http://lists.freedesktop.org/mailman/listinfo/devkit-devel

James, because you have a plan what is going on here, could you contact them on the mailing list as they wish it?

When they do not react there I could open a ticket on their bugtracker.

Revision history for this message
Aaron Schif (ihasbedhead) wrote :

also on
12.10 ubuntu 32-bit
Lenovo V570
hp X4000b mouse

Revision history for this message
Olivier Bilodeau (plaxx) wrote :

I would like to get this fixed. I've packaged upower 0.9.19 for quantal in my PPA (https://launchpad.net/~plaxx/+archive/random-fixes) and installed it on my system. If it doesn't resolve it (i'll know in a couple of days), I intend to engage with upstream to try to find out exactly what is going on.

Thinkpad T420s w/ battery bay and am using bluetooth keyboard / mouse. Sleeping and swapping screens and inputs twice a day.

Revision history for this message
Vincent Ladeuil (vila) wrote :

Bluetooth keyboard and mouse here too. I need to re-sync the mouse and then re-issue

xinput --set-prop "vila’s mouse" "Device Accel Adaptive Deceleration" 4.0
xinput --set-prop "vila’s mouse" "Device Accel Velocity Scaling" 1.0

each time it occurs (I've put the above in .xprofile but having to do '. ./.xprofile' each time is becoming less fun lately ;)

Revision history for this message
Konstantin U. (fd.ru) wrote :
Revision history for this message
Konstantin U. (fd.ru) wrote :

According to my syslog, upowerd crash always follows a power_supply error, so I thought there must be some connection:

Mar 10 02:59:45 dev kernel: [ 160.051819] power_supply hid-00:12:a1:68:a3:1b-battery: driver failed to report `capacity' property: -5
Mar 10 02:59:45 dev kernel: [ 160.137237] do_trap: 66 callbacks suppressed
Mar 10 02:59:45 dev kernel: [ 160.137248] traps: upowerd[1502] trap int3 ip:7f2c0c1b92b5 sp:7fff26f6c440 error:0

If you look into linux-*/drivers/power/power_supply_sysfs.c, you can easily find the suspect:

        ssize_t ret = 0;
        ...

        if (off == POWER_SUPPLY_PROP_TYPE)
                value.intval = psy->type;
        else
                ret = psy->get_property(psy, off, &value);

        if (ret < 0) {
                if (ret == -ENODATA)
                        dev_dbg(dev, "driver has no data for `%s' property\n",
                                attr->attr.name);
                else if (ret != -ENODEV)
                        dev_err(dev, "driver failed to report `%s' property: %zd\n",
                                attr->attr.name, ret);
                return ret;
        }

Here, "ret" is assigned only once, which means psy->get_property() returns -EIO (-5).

psy->get_property() is actually calls hidinput_get_battery_property() from linux-*/drivers/hid/hid-input.c:

battery->get_property = hidinput_get_battery_property;

And the only place in hidinput_get_battery_property where we can get -EIO is:

          case POWER_SUPPLY_PROP_CAPACITY:
                ret = dev->hid_get_raw_report(dev, dev->battery_report_id,
                                              buf, sizeof(buf),
                                              dev->battery_report_type);
                ...
                break;

... and my knowledge isn't enough to dig a little deeper ;)

So, as a temporary solution I've recompiled kernel with commented out CONFIG_HID_BATTERY_STRENGTH and it works perfectly.

Revision history for this message
Robert Withers (baneofbelligerence) wrote :

The kernel recompile worked for me. Any chance this'll be patched in as an option for 13.10. I read somewhere (can't remember where) that the capacity warning was being worked on but bringing in a patched kernel is a good temporary fix.

Revision history for this message
In , Lawrenc (lawrenc-redhat-bugs) wrote :

Version-Release number of selected component:
upower-0.9.20-1.fc19

Additional info:
reporter: libreport-2.1.4
backtrace_rating: 4
cmdline: /usr/libexec/upowerd
crash_function: dbus_g_connection_register_g_object
executable: /usr/libexec/upowerd
kernel: 3.9.1-301.fc19.x86_64
runlevel: N 5
uid: 0

Truncated backtrace:
Thread no. 1 (6 frames)
 #2 dbus_g_connection_register_g_object at dbus-gobject.c:2859
 #3 up_device_register_device at up-device.c:838
 #4 up_device_coldplug at up-device.c:564
 #5 up_backend_device_new at up-backend.c:175
 #6 up_backend_device_add at up-backend.c:258
 #11 monitor_event at src/gudev/gudevclient.c:103

Potential duplicate: bug 817352

Revision history for this message
In , Lawrenc (lawrenc-redhat-bugs) wrote :

Created attachment 746570
File: backtrace

Revision history for this message
In , Lawrenc (lawrenc-redhat-bugs) wrote :

Created attachment 746571
File: cgroup

Revision history for this message
In , Lawrenc (lawrenc-redhat-bugs) wrote :

Created attachment 746572
File: core_backtrace

Revision history for this message
In , Lawrenc (lawrenc-redhat-bugs) wrote :

Created attachment 746573
File: dso_list

Revision history for this message
In , Lawrenc (lawrenc-redhat-bugs) wrote :

Created attachment 746574
File: environ

Revision history for this message
In , Lawrenc (lawrenc-redhat-bugs) wrote :

Created attachment 746575
File: limits

Revision history for this message
In , Lawrenc (lawrenc-redhat-bugs) wrote :

Created attachment 746576
File: maps

Revision history for this message
In , Lawrenc (lawrenc-redhat-bugs) wrote :

Created attachment 746577
File: open_fds

Revision history for this message
In , Lawrenc (lawrenc-redhat-bugs) wrote :

Created attachment 746578
File: proc_pid_status

Revision history for this message
In , Lawrenc (lawrenc-redhat-bugs) wrote :

Created attachment 746579
File: var_log_messages

Revision history for this message
In , Mikhail (mikhail-redhat-bugs) wrote :

Occurs every time when my Apple Magic Mouse reconnect to Bluetooth.

Changed in upower (Ubuntu):
status: Confirmed → Fix Committed
Revision history for this message
Olivier Bilodeau (plaxx) wrote :

@vvekecki: where is the fix? I can't find it in the upower (ubuntu) code branches..

I'm open to repackage it in my PPA and test if needed.

Martin Pitt (pitti)
Changed in upower (Ubuntu):
status: Fix Committed → Confirmed
Revision history for this message
Edson T. Marques (edsontmarques) wrote :

if it was fixed ... well, sorry but seems that it come back in 13.10... or maybe its another one.

Revision history for this message
Edson T. Marques (edsontmarques) wrote :

Crash when returning from a lock screen after an inactivity period.

Revision history for this message
Martin Pitt (pitti) wrote :

The error message makes this quite clear:

  "A handler is already registered for /org/freedesktop/UPower/devices/battery_hid_00o12oa1o68oa3o1b_battery"

So this seems to happen if you have a wireless mouse or keyboard, which powers down due to inactivity, and then gets repowered and it tries to register the same battery again.

summary: - upowerd crashed with signal 5 in dbus_g_connection_register_g_object()
+ abort with wireless HID devices: A handler is already registered for
summary: abort with wireless HID devices: A handler is already registered for
+ <battery>
Changed in upower (Ubuntu):
status: Confirmed → Triaged
importance: Medium → High
Revision history for this message
Martin Pitt (pitti) wrote :

I'm afraid I still don't understand what happens there; it's not just a simple removal and re-adding of these devices when they power down (I just tried that in the test suite, and it works fine). For anyone who can reproduce this, can you please open a terminal, and start

  udevadm monitor -e --udev | tee /tmp/monitor.txt

then wait a bit, or do whatever is necessary to trigger that crash, then go back to the terminal with the udevadm command, press Control-C to stop it, and attach /tmp/monitor.txt here? Thanks!

Changed in upower (Ubuntu):
status: Triaged → Incomplete
Revision history for this message
Tony Themelis (tony-athemelis) wrote : Re: [Bug 1112907] Re: abort with wireless HID devices: A handler is already registered for <battery>
  • monitor.txt Edit (56.0 KiB, text/plain; charset=US-ASCII; name=monitor.txt)

Martin,

Please find attached monitor.txt as you requested. Here is how I can reproduce
the crash:

- Enable my hp bluetooth mouse, and use it normally with the computer.
- Go away and come back some time later after the mouse has gone to sleep.
- As soon as I try use the mouse (i.e. it wakes up), the crash occurs.

Regards,

Tony.

On September 6, 2013 at 9:12 AM Martin Pitt <email address hidden> wrote:
> I'm afraid I still don't understand what happens there; it's not just a
> simple removal and re-adding of these devices when they power down (I
> just tried that in the test suite, and it works fine). For anyone who
> can reproduce this, can you please open a terminal, and start
>
> udevadm monitor -e --udev | tee /tmp/monitor.txt
>
> then wait a bit, or do whatever is necessary to trigger that crash, then
> go back to the terminal with the udevadm command, press Control-C to
> stop it, and attach /tmp/monitor.txt here? Thanks!
>
> ** Changed in: upower (Ubuntu)
> Status: Triaged => Incomplete
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1112907
>
> Title:
> abort with wireless HID devices: A handler is already registered for
> <battery>
>
> Status in Upower:
> Unknown
> Status in “upower” package in Ubuntu:
> Incomplete
>
> Bug description:
> .
>
> ProblemType: Crash
> DistroRelease: Ubuntu 13.04
> Package: upower 0.9.19-1ubuntu4
> ProcVersionSignature: Ubuntu 3.5.0-216.23-omap4 3.5.7.1
> Uname: Linux 3.5.0-216-omap4 armv7l
> ApportVersion: 2.8-0ubuntu3
> Architecture: armhf
> Date: Fri Feb 1 22:25:19 2013
> ExecutablePath: /usr/lib/upower/upowerd
> InstallationDate: Installed on 2013-01-17 (15 days ago)
> InstallationMedia: Ubuntu 13.04 "Raring Ringtail" - Alpha armhf+omap4
> (20130116)
> MarkForUpload: True
> ProcCmdline: /usr/lib/upower/upowerd
> ProcEnviron:
>
> Signal: 5
> SourcePackage: upower
> StacktraceTop:
> dbus_g_connection_register_g_object () from
> /usr/lib/arm-linux-gnueabihf/libdbus-glib-1.so.2
> ?? ()
> ?? ()
> Title: upowerd crashed with signal 5 in dbus_g_connection_register_g_object()
> UpgradeStatus: No upgrade log present (probably fresh install)
> UserGroups:
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/upower/+bug/1112907/+subscriptions
"

Revision history for this message
Darryl Beckford (78luphr0rnk2nuqimstywepozxn9kl19tqh0tx66b5dki1xxsh5mkz9gl21a5rlwfnr8jn6ln0m3jxne2k9x1ohg85w3jabxlrqbgszpjpwcmvkbcvq9spp6z3w5j1m33k06tlsfszeuscyt241haso-launchpad) wrote :

Monitor.txt is attached.

Steps taken:
1) Connect BT mouse (not used, as this bug also seems to prevent mouse from working - mouse works fine in 12.04).
2) Power down mouse
3) Power mouse back up

Dialog notifying upowerd crash is seen.

Revision history for this message
In , Martin (martin-redhat-bugs) wrote :

For the record, I track this in https://launchpad.net/bugs/1112907 . I am now able to reproduce this in a new test case, based on udev monitor logs that reporters sent me.

Revision history for this message
Martin Pitt (pitti) wrote :

Thanks for the two monitor logs. They indeed seem to confirm my suspicion: The device bluetooth mouse battery gets add/change events several times, but it never gets a remove event. On top of that, the add events have different device paths, which causes the already existing "treat add event as change" check to not work.That's a kernel bug, but we need to make upower more robust against that.

Thanks to the logs I was able to complete my test case which now nicely reproduces this crash.

Changed in upower (Ubuntu):
status: Incomplete → In Progress
assignee: nobody → Martin Pitt (pitti)
milestone: none → ubuntu-13.09
Revision history for this message
Martin Pitt (pitti) wrote :

I made two patches which both address this problem.

The first one is a direct workaround for this particular bluetooth HID issue where the kernel creates new native sysfs devices for those after each nap. This would even still be relevant if the kernel gets fixed to actually do send out remove events properly, as we don't really want upower to signal device removals/additions all the time.

Pro: unintrusive as it does not change behaviour for all other kinds of devices, suitable for a stable release update
Con: rather hackish, and does not guard against similar problems with other device types

Revision history for this message
Martin Pitt (pitti) wrote :

This second version is a bolder step, but I think it's the right thing to do. It's a little more risky than the first one, but I (and the test suite) are fairly convinced that it's correct.

Pro: addresses this kind of problem for all device types under Linux, and avoids D-BUS signalling device removals/additions from upower where the device itself did not really go away, just the parental USB/bluetooth tree structure changed
Con: More intrusive, could theoretically cause regressions (but I have no idea how, as upower already only uses the device name for building object names)

Both patches have detailled commit messages which explain their rationale.

@Richard: I recommend the second patch, but I posted both to get you a chance to compare.

Revision history for this message
Martin Pitt (pitti) wrote :

Reviewed by Richard on IRC, I pushed the second patch upstream.

Changed in upower (Ubuntu):
status: In Progress → Fix Committed
tags: added: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package upower - 0.9.21-3ubuntu2

---------------
upower (0.9.21-3ubuntu2) saucy; urgency=low

  * Update 00git_updates.patch to today's upstream git:
    - Track power_supply devices by name only instead of full sysfs path.
      Fixes crashes with devices whose USB/bluetooth parental structure
      changes after auto-suspend or similar actions. (LP: #1112907)
    - Don't call obsolete g_type_init() when building with a recent glib.
 -- Martin Pitt <email address hidden> Fri, 27 Sep 2013 09:57:15 +0200

Changed in upower (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

This message is a notice that Fedora 19 is now at end of life. Fedora
has stopped maintaining and issuing updates for Fedora 19. It is
Fedora's policy to close all bug reports from releases that are no
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 19 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Changed in upower:
importance: Unknown → Undecided
status: Unknown → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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