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 686202 - Getting to "source selection" page is too slow
Getting to "source selection" page is too slow
Status: RESOLVED NOTGNOME
Product: gnome-boxes
Classification: Applications
Component: general
unspecified
Other Linux
: Normal normal
: --
Assigned To: GNOME Boxes maintainer(s)
GNOME Boxes maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2012-10-16 06:12 UTC by Bastien Nocera
Modified: 2016-03-31 14:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
media-manager: Call GUdev.Enumerator.execute asynchronously (1.18 KB, patch)
2012-10-16 19:16 UTC, Zeeshan Ali
none Details | Review

Description Bastien Nocera 2012-10-16 06:12:59 UTC
Especially when coming back from the preparation stage.
Comment 1 Christophe Fergeau 2012-10-16 08:33:47 UTC
How slow it is and how many ISO images does it list? I've just tried it here and it's not noticeably slower than the "source selection" -> "welcome" screen which is fast.
Comment 2 Bastien Nocera 2012-10-16 09:19:41 UTC
(In reply to comment #1)
> How slow it is and how many ISO images does it list?

a good 20-30 seconds of hard drive churning, with a depressed button pushed down, and no ISO images listed.

> I've just tried it here
> and it's not noticeably slower than the "source selection" -> "welcome" screen
> which is fast.
Comment 3 Zeeshan Ali 2012-10-16 12:35:03 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > How slow it is and how many ISO images does it list?
> 
> a good 20-30 seconds of hard drive churning, with a depressed button pushed
> down, and no ISO images listed.

Thats terrible but I can't reproduce this either. Have you checked if its gnome-boxes process that is churning hard drive? Shot in the dark about possible causes: Could it be that you have done something to tracker on your system (e.g disabled it)?
Comment 4 Bastien Nocera 2012-10-16 13:01:31 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > (In reply to comment #1)
> > > How slow it is and how many ISO images does it list?
> > 
> > a good 20-30 seconds of hard drive churning, with a depressed button pushed
> > down, and no ISO images listed.
> 
> Thats terrible but I can't reproduce this either. Have you checked if its
> gnome-boxes process that is churning hard drive? Shot in the dark about
> possible causes: Could it be that you have done something to tracker on your
> system (e.g disabled it)?

I didn't change tracker's defaults. I don't know if it was gnome-boxes eating the disk, but it was doing something sync, certainly. Don't do that...
Comment 5 Zeeshan Ali 2012-10-16 13:11:32 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > (In reply to comment #2)
> > > (In reply to comment #1)
> > > > How slow it is and how many ISO images does it list?
> > > 
> > > a good 20-30 seconds of hard drive churning, with a depressed button pushed
> > > down, and no ISO images listed.
> > 
> > Thats terrible but I can't reproduce this either. Have you checked if its
> > gnome-boxes process that is churning hard drive? Shot in the dark about
> > possible causes: Could it be that you have done something to tracker on your
> > system (e.g disabled it)?
> 
> I didn't change tracker's defaults. I don't know if it was gnome-boxes eating
> the disk, but it was doing something sync, certainly. Don't do that...

We really do try our best not to make sync blocking calls, especially ones that need to be made often. Since we are unable to reproduce this, it might take some time to find out the cause.
Comment 6 Bastien Nocera 2012-10-16 13:36:24 UTC
Try using a debug kernel to reproduce the problem.

kernel-3.6.1-1.fc18.x86_64
gnome-boxes-3.6.0-1.fc18.x86_64

  • #0 read
    from /lib64/libc.so.6
  • #1 __GI__IO_file_underflow
    from /lib64/libc.so.6
  • #2 __GI__IO_default_uflow
    from /lib64/libc.so.6
  • #3 __GI__IO_getline_info
    from /lib64/libc.so.6
  • #4 fgets
    from /lib64/libc.so.6
  • #5 udev_device_read_uevent_file.part.5
    from /lib64/libudev.so.1
  • #6 udev_device_get_properties_list_entry
    from /lib64/libudev.so.1
  • #7 match_property
    from /lib64/libudev.so.1
  • #8 scan_dir_and_add_devices
    from /lib64/libudev.so.1
  • #9 scan_dir
    from /lib64/libudev.so.1
  • #10 udev_enumerate_scan_devices
    from /lib64/libudev.so.1
  • #11 g_udev_enumerator_execute
    from /lib64/libgudev-1.0.so.0
  • #12 boxes_media_manager_list_installer_medias_co
  • #13 boxes_wizard_source_add_media_entries_co
  • #14 boxes_wizard_source_set_page
  • #15 boxes_wizard_set_page
  • #16 g_cclosure_marshal_VOID__VOIDv
    at gmarshal.c line 115
  • #17 _g_closure_invoke_va
    at gclosure.c line 840
  • #18 g_signal_emit_valist
    at gsignal.c line 3211
  • #19 g_signal_emit
    at gsignal.c line 3356
  • #20 gtk_button_clicked
    at gtkbutton.c line 1308
  • #21 gtk_real_button_released
    at gtkbutton.c line 1967
  • #22 g_cclosure_marshal_VOID__VOID
    at gmarshal.c line 85
  • #23 g_type_class_meta_marshal
    at gclosure.c line 970
  • #24 g_closure_invoke
    at gclosure.c line 777
  • #25 signal_emit_unlocked_R
    at gsignal.c line 3481
  • #26 g_signal_emit_valist
    at gsignal.c line 3300
  • #27 g_signal_emit
    at gsignal.c line 3356
  • #28 gtk_button_button_release
    at gtkbutton.c line 1802
  • #29 _gtk_marshal_BOOLEAN__BOXEDv
    at gtkmarshalers.c line 130
  • #30 g_type_class_meta_marshalv
    at gclosure.c line 997
  • #31 _g_closure_invoke_va
    at gclosure.c line 840
  • #32 g_signal_emit_valist
    at gsignal.c line 3211
  • #33 g_signal_emit
    at gsignal.c line 3356
  • #34 gtk_widget_event_internal
    at gtkwidget.c line 6294
  • #35 gtk_widget_event
    at gtkwidget.c line 5951
  • #36 propagate_event_up
    at gtkmain.c line 2400
  • #37 propagate_event
    at gtkmain.c line 2500
  • #38 gtk_propagate_event
    at gtkmain.c line 2535
  • #39 gtk_main_do_event
    at gtkmain.c line 1723
  • #40 _gdk_event_emit
    at gdkevents.c line 69
  • #41 gdk_event_source_dispatch
    at gdkeventsource.c line 358
  • #42 g_main_dispatch
    at gmain.c line 2715
  • #43 g_main_context_dispatch
    at gmain.c line 3219
  • #44 g_main_context_iterate
    at gmain.c line 3290
  • #45 g_main_context_iteration
    at gmain.c line 3351
  • #46 g_application_run
    at gapplication.c line 1620
  • #47 _vala_main
  • #48 __libc_start_main
    from /lib64/libc.so.6
  • #49 _start

Comment 7 Zeeshan Ali 2012-10-16 19:08:22 UTC
(In reply to comment #6)
> Try using a debug kernel to reproduce the problem.
> 
> kernel-3.6.1-1.fc18.x86_64

Using the exact same kernel here.

Thanks for the stack trace. It should be trivial to wrap the g_udev_enumerator_execute() in an async call but according to davidz, this call really shouldn't block:

<zeenix> davidz: seems g_udev_enumerator_execute is a blocking call: https://bugzilla.gnome.org/show_bug.cgi?id=686202#c6
<davidz> zeenix: it shouldn't be, no
<davidz> zeenix: it only looks through the udev database which is on tmpfs
<zeenix> davidz: i thought so since it doesn't provide an async variant
<davidz> zeenix: what makes you think it is sync?
<davidz> zeenix: docs also explicitly state "Device information is retrieved from the kernel (through the sysfs filesystem) and the udev daemon (through a tmpfs filesystem) and presented through GUdevDevice objects. This means that no blocking IO ever happens (in both cases, we are essentially just reading data from kernel memory) and as such there are no asynchronous versions of the provided methods."
Comment 8 Zeeshan Ali 2012-10-16 19:16:01 UTC
Created attachment 226585 [details] [review]
media-manager: Call GUdev.Enumerator.execute asynchronously
Comment 9 Zeeshan Ali 2012-10-16 19:22:04 UTC
(In reply to comment #8)
> Created an attachment (id=226585) [details] [review]
> media-manager: Call GUdev.Enumerator.execute asynchronously

This should work around this issue if stack trace was pointing to the correct place. But before we consider it:

<zeenix> davidz: i can't reproduce the bug on my system, neither can teuf 
<davidz> zeenix: the place where it hangs is in fgets() on the uevent file in sysfs....
<davidz> the stack trace anyway
* teuf would say that his system is not slow enough to observe what hadess is seeing
<teuf> and the stack trace is probably hadess randomly pressing ctrl+c during the slowness
<davidz> I think so
<davidz> either way, I don't think there's anything wrong with libudev
<davidz> ask hadess to run sysprof?
<davidz> that should give you an idea of what's going on
Comment 10 Bastien Nocera 2012-11-21 10:30:38 UTC
gudev is blocking, both during startup and when creating a new image:

readlink("/sys/class/power_supply/hid--battery", "../../devices/pci0000:00/0000:00"..., 1024) = 118
stat("/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.5/1-1.5.1/1-1.5.1:1.0/0003:0A5C:4502.0004/power_supply/hid--battery/uevent", {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0
open("/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.5/1-1.5.1/1-1.5.1:1.0/0003:0A5C:4502.0004/power_supply/hid--battery/uevent", O_RDONLY|O_CLOEXEC) = 21
fstat(21, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1948fb2000
read(21, 


If udev pokes things that query the kernel, and that the kernel tries to query the hardware...

I can reproduce this at will.
Comment 11 David Zeuthen (not reading bugmail) 2012-11-21 11:49:46 UTC
(In reply to comment #10)
> If udev pokes things that query the kernel, and that the kernel tries to query
> the hardware...

As I said on IRC, my view is that this is a device driver bug - accessing the uevent file should never block. Accessing one or more sysfs attribute files is allowed to block, that's OK, we never touch any of those by default.
Comment 12 Bastien Nocera 2012-11-21 12:16:08 UTC
The patch just makes it hang later (in this case, when I click "Select file").
Comment 13 Zeeshan Ali 2013-01-07 00:59:38 UTC
If gudev does anything the can potentially block, it should provide async API but as David explained the call is not expected to block. Whether driver or gudev bug or both, its really nothing Boxes should be fixing.