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 672704 - gdu_pool_new() crash in gdu_device_get_object_path() when volume appears and disappears quickly
gdu_pool_new() crash in gdu_device_get_object_path() when volume appears and ...
Status: RESOLVED DUPLICATE of bug 591660
Product: gnome-disk-utility
Classification: Core
Component: libgdu
3.0.x
Other Linux
: Normal major
: ---
Assigned To: Martin Pitt
gnome-disk-utility-maint
Depends on:
Blocks:
 
 
Reported: 2012-03-23 16:08 UTC by Martin Pitt
Modified: 2012-03-23 16:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
reproducer (1.39 KB, text/plain)
2012-03-23 16:10 UTC, Martin Pitt
Details

Description Martin Pitt 2012-03-23 16:08:59 UTC
Note, this applies to the old 3.0 branch with libgdu.

https://launchpad.net/bugs/916892 reports quite a few crashes that look like this:

  • #0 gdu_device_get_object_path
    at gdu-device.c line 840
  • #1 gdu_pool_new_for_address
    at gdu-pool.c line 2109
  • #2 gdu_pool_new
    at gdu-pool.c line 1929
  • #3 get_device_for_device_file
    at /build/buildd/unity-5.0.0/plugins/unityshell/src/DeviceLauncherIcon.cpp line 505
  • #4 unity::launcher::DeviceLauncherIcon::DeviceLauncherIcon
    at /build/buildd/unity-5.0.0/plugins/unityshell/src/DeviceLauncherIcon.cpp line 50
  • #5 unity::launcher::DeviceLauncherSection::OnVolumeAdded
    at /build/buildd/unity-5.0.0/plugins/unityshell/src/DeviceLauncherSection.cpp line 103
  • #6 g_cclosure_marshal_VOID__OBJECT
    at /build/buildd/glib2.0-2.31.8/./gobject/gmarshal.c line 644

Where OnVolumeAdded is a signal handler for GVolumeMonitor's "volume-added" signal.

This happens in particular when using usb-creator, a tool to write iso images to USB sticks. This sets up a loop device.

As the loop device is mounted to /tmp/..., what happens is that there is no GVolume during the time it's mounted, as we hide stuff that's not in /media/ by default.

On unmounting, the GVolume appears quickly, triggering a volume-added signal. But it disappears immediately again as the underlying loop device is cleaned up.

So while the volume-added signal handler is running, it gets to this code:

                device = _gdu_device_new_from_object_path (pool, object_path);

                g_hash_table_insert (pool->priv->object_path_to_device,
                                     (gpointer) gdu_device_get_object_path (device),
                                     device);

I suppose at that time the underlying loop device is already history, and thus _gdu_device_new_from_object_path() returns NULL, as the stack trace shows.
Comment 1 Martin Pitt 2012-03-23 16:10:40 UTC
Created attachment 210440 [details]
reproducer

This is a simple reproducer which just listens to volume-added and calls gdu_pool_new().

gcc -o /tmp/gdu_pool_crash gdu_pool_crash.c -Wall -g -O0 `pkg-config --cflags --libs glib-2.0 gio-2.0 gdu` && gdb /tmp/gdu_pool_crash

then run

sudo mkdir /tmp/d
while true; do sudo mount -o loop some_cd_image.iso /tmp/d; sudo umount /tmp/d; done

This reproduces the crash eventually.
Comment 2 Martin Pitt 2012-03-23 16:13:50 UTC
Actually, this is a dupe of bug 591660. At first I only looked at the trace in that bug, which is too bad to say whether it's that bug or a different one. But some of its dupes have much better ones which match this.

*** This bug has been marked as a duplicate of bug 640049 ***
Comment 3 Martin Pitt 2012-03-23 16:14:14 UTC

*** This bug has been marked as a duplicate of bug 591660 ***