After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 539843 - Gnome Power Manager crash on critical battery with UPS
Gnome Power Manager crash on critical battery with UPS
Status: RESOLVED OBSOLETE
Product: gnome-power-manager
Classification: Deprecated
Component: gnome-power-manager
2.22.x
Other Linux
: Normal critical
: ---
Assigned To: GNOME Power Manager Maintainer(s)
GNOME Power Manager Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2008-06-23 21:44 UTC by Joe Dunne
Modified: 2011-03-11 13:52 UTC
See Also:
GNOME target: ---
GNOME version: 2.21/2.22


Attachments
Debug backtrace WITHOUT symbols (22.35 KB, text/plain)
2008-07-07 20:25 UTC, Joe Dunne
Details

Description Joe Dunne 2008-06-23 21:44:53 UTC
I'm a developer at Tripp Lite.  I am working on new firmware for a new UPS.  

I've noticed 2 problems with the Power Manager application with my new UPS:



1. Low battery and Critical battery actions are not taken.  This seems to be a  fairly common problem as I've seen several other bug reports with similar descriptions: 479486, 467967, 491357.  

2. I'm not sure the exact sequence, but it appears that shortly (or sometimes immediately) after the UPS reaches Critical Battery the application crashes.

This exact same problem appears on several other UPSes I've tried.  Specifically, I tried a Tripp Lite Smart750SLT, APC Smart UPS 1500, APC Back-UPS ES 750, and probably others.  In each case I'm not powering the computer from the UPS so I can perform testing without interrupting the test PC's power.  

Basically, all that is required to be done is put the UPS on Battery mode by disconnecting AC power and wait until the battery capacity % reaches approximately 10%.  At this point, the power manager icon disappears.

I've done some basic debugging and I haven't been able to identify the problem.  
gnome-power-manager --verbose --no-daemon 2>&1 | tee gpm.debug.log.txt:

Here are the last few things happening from the above command prior to the crash:


usb_device_9ae_1008_FW_2368_B_hiddev, key=battery.reporting.current, added=0, removed=0, finally=0
[hal_device_property_modified_cb] gpm-cell.c:258 (11:50:14):	 udi=/org/freedesktop/Hal/devices/usb_device_9ae_1008_FW_2368_B_hiddev, key=battery.charge_level.percentage, added=0, removed=0, finally=0
[hal_device_property_modified_cb] gpm-cell.c:303 (11:50:14):	 ** EMIT: percent-changed: 2
[gpm_cell_array_update] gpm-cell-array.c:344 (11:50:14):	 1 devices of type ups
[gpm_cell_percent_changed_cb] gpm-cell-array.c:600 (11:50:14):	 ** EMIT: percent-changed
[gpm_engine_get_icon] gpm-engine.c:391 (11:50:14):	 Trying CRITICAL icon: primary, ups, mouse, keyboard
[gpm_engine_get_icon] gpm-engine.c:435 (11:50:14):	 Trying CHARGING icon: primary, ups
[gpm_cell_unit_get_icon] gpm-cell-unit.c:210 (11:50:14):	 got filename: gpm-ups-000
[gpm_engine_recalculate_state_icon] gpm-engine.c:585 (11:50:14):	 ** EMIT: icon-changed: gpm-ups-000
[gpm_tray_icon_set_icon] gpm-tray-icon.c:182 (11:50:14):	 Setting icon to gpm-ups-000
*** WARNING ***
[gpm_profile_get_accuracy] gpm-profile.c:841 (11:50:14):	 no config id set!
[gpm_cell_array_get_description] gpm-cell-array.c:968 (11:50:14):	 accuracy = 0
[gpm_engine_get_summary] gpm-engine.c:349 (11:50:14):	 tooltip: Computer is running on backup power
UPS 5 minutes remaining (2%)
[gpm_engine_recalculate_state_summary] gpm-engine.c:623 (11:50:14):	 ** EMIT: summary-changed(2): Computer is running on backup power
UPS 5 minutes remaining (2%)
[gpm_cell_array_percent_changed] gpm-cell-array.c:524 (11:50:14):	 printing combined new device:
[gpm_cell_unit_print] gpm-cell-unit.c:65 (11:50:14):	 device         UPS
[gpm_cell_unit_print] gpm-cell-unit.c:66 (11:50:14):	 present        1
[gpm_cell_unit_print] gpm-cell-unit.c:67 (11:50:14):	 percent        2
[gpm_cell_unit_print] gpm-cell-unit.c:68 (11:50:14):	 is charging    0
[gpm_cell_unit_print] gpm-cell-unit.c:69 (11:50:14):	 is discharging 1
[gpm_cell_unit_print] gpm-cell-unit.c:71 (11:50:14):	 charge current 10
[gpm_cell_unit_print] gpm-cell-unit.c:83 (11:50:14):	 time charge    1094
[gpm_cell_unit_print] gpm-cell-unit.c:86 (11:50:14):	 time discharge 525
[gpm_cell_array_percent_changed] gpm-cell-array.c:564 (11:50:14):	 warning state = 4
[gpm_cell_array_emit_system_action] gpm-cell-array.c:498 (11:50:14):	 ** EMIT: charge-action
[gpm_engine_get_icon] gpm-engine.c:391 (11:50:14):	 Trying CRITICAL icon: primary, ups, mouse, keyboard
[gpm_engine_get_icon] gpm-engine.c:435 (11:50:14):	 Trying CHARGING icon: primary, ups
[gpm_cell_unit_get_icon] gpm-cell-unit.c:210 (11:50:14):	 got filename: gpm-ups-000
[gpm_engine_recalculate_state_icon] gpm-engine.c:590 (11:50:14):	 no change
*** WARNING ***
[gpm_profile_get_accuracy] gpm-profile.c:841 (11:50:14):	 no config id set!
[gpm_cell_array_get_description] gpm-cell-array.c:968 (11:50:14):	 accuracy = 0
[gpm_engine_get_summary] gpm-engine.c:349 (11:50:14):	 tooltip: Computer is running on backup power
UPS 5 minutes remaining (2%)
[gpm_engine_recalculate_state_summary] gpm-engine.c:627 (11:50:14):	 no change
[gpm_cell_array_charge_action_cb] gpm-engine.c:861 (11:50:14):	 ** EMIT: charge-action
[gpm_cell_unit_get_icon] gpm-cell-unit.c:210 (11:50:14):	 got filename: gpm-ups-000
*** WARNING ***
[gpm_notify_create] gpm-notify.c:124 (11:50:14):	 libnotify: Power Manager : The UPS is below the critical level and this computer will <b>power-off</b> when the UPS becomes completely empty.



--------
After that happens, the program crashes and I get the following output:
*** glibc detected *** gnome-power-manager: double free or corruption (!prev): 0x08085278 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb708aa85]
/lib/tls/i686/cmov/libc.so.6(cfree+0x90)[0xb708e4f0]
/usr/lib/libglib-2.0.so.0(g_free+0x31)[0xb71c68b1]
gnome-power-manager[0x80676c2]
/usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x129)[0xb7242759]
/usr/lib/libgobject-2.0.so.0[0xb7256d1d]
/usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x8c6)[0xb7258916]
/usr/lib/libgobject-2.0.so.0(g_signal_emit+0x29)[0xb7258c59]
gnome-power-manager[0x80525b2]
/usr/lib/libgobject-2.0.so.0(g_cclosure_marshal_VOID__UINT+0x5a)[0xb724f6ea]
/usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x129)[0xb7242759]
/usr/lib/libgobject-2.0.so.0[0xb7256d1d]
/usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x8c6)[0xb7258916]
/usr/lib/libgobject-2.0.so.0(g_signal_emit+0x29)[0xb7258c59]
gnome-power-manager[0x80568c8]
/usr/lib/libgobject-2.0.so.0(g_cclosure_marshal_VOID__UINT+0x5a)[0xb724f6ea]
/usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x129)[0xb7242759]
/usr/lib/libgobject-2.0.so.0[0xb7256d1d]
/usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x8c6)[0xb7258916]
/usr/lib/libgobject-2.0.so.0(g_signal_emit+0x29)[0xb7258c59]
gnome-power-manager[0x80554c9]
gnome-power-manager(libhal_marshal_VOID__STRING_BOOLEAN_BOOLEAN_BOOLEAN+0x6f)[0x8078c2f]
/usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x129)[0xb7242759]
/usr/lib/libgobject-2.0.so.0[0xb7256d1d]
/usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x8c6)[0xb7258916]
/usr/lib/libgobject-2.0.so.0(g_signal_emit+0x29)[0xb7258c59]
gnome-power-manager[0x8076603]
gnome-power-manager(libhal_marshal_VOID__INT_BOXED+0x61)[0x8078fc1]
/usr/lib/libdbus-glib-1.so.2[0xb7631016]
/usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x129)[0x

Everything looks relatively normal.  b7242759]
/usr/lib/libgobject-2.0.so.0[0xb7256d1d]
/usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x8c6)[0xb7258916]
/usr/lib/libgobject-2.0.so.0(g_signal_emit+0x29)[0xb7258c59]
/usr/lib/libdbus-glib-1.so.2[0xb7632004]
/usr/lib/libdbus-1.so.3(dbus_connection_dispatch+0x397)[0xb72819f7]
/usr/lib/libdbus-glib-1.so.2[0xb76294cd]
/usr/lib/libglib-2.0.so.0(g_main_context_dispatch+0x178)[0xb71bebf8]
/usr/lib/libglib-2.0.so.0[0xb71c1e5e]
/usr/lib/libglib-2.0.so.0(g_main_loop_run+0x1e7)[0xb71c21e7]
gnome-power-manager[0x8065935]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0xb7035450]
gnome-power-manager(gtk_status_icon_position_menu+0x2a1)[0x804dff1]
======= Memory map: ========
08048000-08094000 r-xp 00000000 08:01 229796     /usr/bin/gnome-power-manager
08094000-08095000 rw-p 0004c000 08:01 229796     /usr/bin/gnome-power-manager
08095000-0832b000 rw-p 08095000 00:00 0          [heap]
b4b00000-b4b21000 rw-p b4b00000 00:00 0 
b4b21000-b4c00000 ---p b4b21000 00:00 0 
b4cb9000-b4cba000 ---p b4cb9000 00:00 0 
b4cba000-b54ba000 rw-p b4cba000 00:00 0 
b56bb000-b56bc000 ---p b56bb000 00:00 0 
b56bc000-b5ebc000 rw-p b56bc000 00:00 0 
b5ebc000-b5ebf000 r-xp 00000000 08:01 4538410    /lib/libcap.so.1.10
b5ebf000-b5ec0000 rw-p 00002000 08:01 4538410    /lib/libcap.so.1.10
b5ec0000-b5f0d000 r-xp 00000000 08:01 231402     /usr/lib/libpulse.so.0.4.1
b5f0d000-b5f0e000 rw-p 0004c000 08:01 231402     /usr/lib/libpulse.so.0.4.1
b5f0e000-b5f1b000 r-xp 00000000 08:01 1253436    /usr/lib/gstreamer-0.10/libgstpulse.so
b5f1b000-b5f1c000 rw-p 0000d000 08:01 1253436    /usr/lib/gstreamer-0.10/libgstpulse.so
b5f1c000-b5f3f000 r-xp 00000000 08:01 231121     /usr/lib/libgstcontroller-0.10.so.0.16.0
b5f3f000-b5f40000 rw-p 00023000 08:01 231121     /usr/lib/libgstcontroller-0.10.so.0.16.0
b5f4b000-b5f9d000 r-xp 00000000 08:01 231323     /usr/lib/liboil-0.3.so.0.2.0
b5f9d000-b5fb4000 rw-p 00052000 08:01 231323     /usr/lib/liboil-0.3.so.0.2.0
b5fb4000-b5fb6000 rw-p b5fb4000 00:00 0 
b5fb6000-b5fbb000 r-xp 00000000 08:01 1253472    /usr/lib/gstreamer-0.10/libgstautodetect.so
b5fbb000-b5fbc000 rw-p 00004000 08:01 1253472    /usr/lib/gstreamer-0.10/libgstautodetect.so
b5fbc000-b5fc0000 r-xp 00000000 08:01 1253461    /usr/lib/gstreamer-0.10/li


--------------------

I was monitoring HAL with libhal -m and observed nothing strange.
I'll be happy to support any requests for more information or other debug commands if needed.  Unfortunately I'm not much of a linux guru, but I have access to some other developers here who may be able to help if needed.
Comment 1 Joe Dunne 2008-06-26 14:03:26 UTC
Any questions or comments about this bug?  I realized I kinda buried it in the text, but this problem is very reproducible on many different UPSes.  Also, I didn't mention, but I am running Ubuntu 8.10, and I also saw the same problem on Fedora 9.
Comment 2 Richard Hughes 2008-07-04 09:38:29 UTC
Eeek. Could you get me a gdb backtrace when you get the double free please?
Comment 3 Joe Dunne 2008-07-07 20:25:44 UTC
Created attachment 114146 [details]
Debug backtrace WITHOUT symbols
Comment 4 Joe Dunne 2008-07-07 20:29:22 UTC
As stated, I'm not much of a Linux guy.  I've generated a debug backtrace as requested, but unfortunately I was unable to find a debug package to get the debugging symbols.  

Based on the page here:  http://www.gnome.org/projects/gnome-power-manager/bugs.html  I'm guessing I would need to download the source and build it with debugging enabled.  I didn't see specific instructions for this, so I figured I'd exhausted my Linux abilities at that point.  

I've attached the backtrace without symbols, and if this is useless then I apologize.  If you could provide some specific details on the process to get the debug symbols, perhaps I could help a bit more.  
Comment 5 Joe Dunne 2008-07-08 13:31:58 UTC
I did some browsing today and found that this bug has already been found and fixed on debian.  See the following:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=482431

There is a patch under debian's repository.  Here's the changelog:
gnome-power-manager (2.22.1-2) UNRELEASED; urgency=low

  * 02-ups-invalid-free.patch: patch from Avery Fay to fix invalid free 
    when the UPS level is too low. Closes: #482431.

 -- Josselin Mouette <joss@debian.org>  Sun, 08 Jun 2008 20:44:47 +0200


This is the contents of the patch I found on debian's svn:
svn://svn.debian.org/svn/pkg-gnome/desktop/unstable/gnome-power-manager/debian/patches/02-ups-invalid-free.patch

--- gnome-power-manager-2.22.1-orig/src/gpm-manager.c	2008-05-23 19:07:49.000000000 -0400
+++ gnome-power-manager-2.22.1-fixed/src/gpm-manager.c	2008-05-23 18:35:35.000000000 -0400
@@ -1586,17 +1586,17 @@
 
 		/* use different text for different actions */
 		if (strcmp (action, ACTION_NOTHING) == 0) {
-			message = _("The UPS is below the critical level and "
+			message = g_strdup (_("The UPS is below the critical level and "
 				    "this computer will <b>power-off</b> when the "
-				    "UPS becomes completely empty.");
+				    "UPS becomes completely empty."));
 
 		} else if (strcmp (action, ACTION_HIBERNATE) == 0) {
-			message = _("The UPS is below the critical level and "
-				    "this computer is about to hibernate.");
+			message = g_strdup (_("The UPS is below the critical level and "
+				    "this computer is about to hibernate."));
 
 		} else if (strcmp (action, ACTION_SHUTDOWN) == 0) {
-			message = _("The UPS is below the critical level and "
-				    "this computer is about to shutdown.");
+			message = g_strdup (_("The UPS is below the critical level and "
+				    "this computer is about to shutdown."));
 		}
 
 		g_free (action);



----------------------------------------------------------
Just to point out, I have the exact same issue this guy pointed out, not only does the program crash, but the actions are not taken.
Comment 6 Richard Hughes 2008-07-08 15:01:42 UTC
I've merged this into 2.22 -- many thanks.
Comment 7 Joe Dunne 2008-07-08 20:56:57 UTC
Richard,

I'm glad the crash is sorted out.  What about the actions not being taken though?  Its great that the application shouldn't crash now with this patch, but the computer will still lose data if the UPS runs out of battery and the OS is not shut down properly.
Comment 8 Richard Hughes 2009-03-04 15:13:23 UTC
Thanks for taking the time to report this bug.
However, you are using a version that is too old and not supported anymore. GNOME developers are no longer working on that version, so unfortunately there will not be any bug fixes for the version that you use.

By upgrading to a newer version of GNOME you could receive bug fixes and new functionality. You may need to upgrade your Linux distribution to obtain a newer version of GNOME.
Please feel free to reopen this bug if the problem still occurs with a newer version of GNOME.
Comment 9 Alex 2011-03-11 13:52:41 UTC
Dear All,
I've tested UPS with USB HID support with latest GNome 2.32. Unfortunately there is the same problem - GNome power management not take any action when UPS battery discharging. Would you please add such functional because it very useful. Now user have to install additional demon like NUT to shutdown system when UPS battery low.