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 783789 - User accounts panel is slow to open
User accounts panel is slow to open
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: User Accounts
3.24.x
Other Linux
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on: 782627
Blocks:
 
 
Reported: 2017-06-14 14:40 UTC by Allan Day
Modified: 2018-03-26 08:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
profiling of opening of user-accounts (146.84 KB, application/x-sysprof-capture)
2017-06-17 11:01 UTC, Baptiste Mille-Mathias
  Details
out of strace (145.63 KB, application/x-xz)
2017-06-17 11:07 UTC, Baptiste Mille-Mathias
  Details
strace output (179.35 KB, application/x-compressed-tar)
2017-06-22 10:00 UTC, Allan Day
  Details
user-accounts: Prevent freeze caused by external cameras (4.79 KB, patch)
2017-10-20 16:24 UTC, Ondrej Holy
none Details | Review
user-accounts: Show spinner before camera monitor creation (2.50 KB, patch)
2017-10-20 16:25 UTC, Ondrej Holy
none Details | Review
user-accounts: Prevent freeze caused by external cameras (3.69 KB, patch)
2017-11-02 09:15 UTC, Ondrej Holy
none Details | Review
user-accounts: Show spinner before camera monitor creation (3.22 KB, patch)
2017-11-02 09:15 UTC, Ondrej Holy
none Details | Review
backtrace (8.54 KB, text/plain)
2018-02-19 12:10 UTC, Felipe Borges
  Details
user-accounts: Prevent freeze caused by external cameras (3.26 KB, patch)
2018-02-21 10:26 UTC, Ondrej Holy
none Details | Review
user-accounts: Prevent freeze caused by external cameras (3.60 KB, patch)
2018-03-13 09:07 UTC, Ondrej Holy
none Details | Review
user-accounts: Prevent freeze caused by external cameras (3.65 KB, patch)
2018-03-26 08:19 UTC, Ondrej Holy
committed Details | Review

Description Allan Day 2017-06-14 14:40:53 UTC
There's about a 3 second delay between my clicking on the users icon and the panel opening (during which time the control center home screen, with the icon grid, remains visible). This happens every time I open the panel.

Running the control centre in debug mode, I see these logs when I open the panel:

(gnome-control-center:22248): user-accounts-cc-panel-DEBUG: Got 1 users

(gnome-control-center:22248): user-accounts-cc-panel-DEBUG: adding user Allan

(gnome-control-center:22248): user-accounts-cc-panel-DEBUG: user added: 1000 Allan

(gnome-control-center:22248): user-accounts-cc-panel-DEBUG: File does not exist
(gnome-control-center:22248): user-accounts-cc-panel-DEBUG: File does not exist
(gnome-control-center:22248): user-accounts-cc-panel-DEBUG: File does not exist
(gnome-control-center:22248): user-accounts-cc-panel-DEBUG: File does not exist
(gnome-control-center:22248): user-accounts-cc-panel-DEBUG: File does not exist
(gnome-control-center:22248): GdkPixbuf-DEBUG: gdk_pixbuf_from_pixdata() called on:
(gnome-control-center:22248): GdkPixbuf-DEBUG: 	Encoding raw
(gnome-control-center:22248): GdkPixbuf-DEBUG: 	Dimensions: 14 x 14
(gnome-control-center:22248): GdkPixbuf-DEBUG: 	Rowstride: 56, Length: 808
(gnome-control-center:22248): GdkPixbuf-DEBUG: 	Copy pixels == false
** (gnome-control-center:22248): DEBUG: Num previous panels? 0
(gnome-control-center:22248): user-accounts-cc-panel-DEBUG: Got 1 users

(gnome-control-center:22248): user-accounts-cc-panel-DEBUG: adding user Allan

(gnome-control-center:22248): user-accounts-cc-panel-DEBUG: user added: 1000 Allan

(gnome-control-center:22248): user-accounts-cc-panel-DEBUG: File does not exist
(gnome-control-center:22248): user-accounts-cc-panel-DEBUG: File does not exist
(gnome-control-center:22248): user-accounts-cc-panel-DEBUG: File does not exist
(gnome-control-center:22248): user-accounts-cc-panel-DEBUG: File does not exist
(gnome-control-center:22248): user-accounts-cc-panel-DEBUG: File does not exist
(gnome-control-center:22248): GdkPixbuf-DEBUG: gdk_pixbuf_from_pixdata() called on:
(gnome-control-center:22248): GdkPixbuf-DEBUG: 	Encoding raw
(gnome-control-center:22248): GdkPixbuf-DEBUG: 	Dimensions: 14 x 14
(gnome-control-center:22248): GdkPixbuf-DEBUG: 	Rowstride: 56, Length: 808
(gnome-control-center:22248): GdkPixbuf-DEBUG: 	Copy pixels == false
(gnome-control-center:22248): GdkPixbuf-DEBUG: gdk_pixbuf_from_pixdata() called on:
(gnome-control-center:22248): GdkPixbuf-DEBUG: 	Encoding raw
(gnome-control-center:22248): GdkPixbuf-DEBUG: 	Dimensions: 14 x 14
(gnome-control-center:22248): GdkPixbuf-DEBUG: 	Rowstride: 56, Length: 808
(gnome-control-center:22248): GdkPixbuf-DEBUG: 	Copy pixels == false
Comment 1 Ondrej Holy 2017-06-14 17:38:27 UTC
I've tried this on Fedora 26 Beta Live in VM and it seems there is a lag sometimes when opening Users panel, but not sure that this is exactly the same what Allan described...

It is "slowly" printing the following message many times for various locales during the opening:
(gnome-control-center:347): GnomeDesktop-DEBUG: Ignoring '...' as a locale, since it lacks translations

So it might be Big 744477, or something similar...

Allan, can you confirm that it is printing the mentioned messages during opening?
Comment 2 Felipe Borges 2017-06-15 13:03:38 UTC
It is worth testing it under sysprof.
Comment 3 Baptiste Mille-Mathias 2017-06-17 11:01:32 UTC
Created attachment 353940 [details]
profiling of opening of user-accounts
Comment 4 Baptiste Mille-Mathias 2017-06-17 11:02:48 UTC
for me user-accounts panel take 12 seconds to open.
Comment 5 Baptiste Mille-Mathias 2017-06-17 11:07:28 UTC
Created attachment 353941 [details]
out of strace

The strace shows a lot of calls like this
ioctl(21, VIDIOC_ENUM_FRAMEINTERVALS, {index=0, pixel_format=v4l2_fourcc('M', 'J', 'P', 'G'), width=800, height=600, type=V4L2_FRMIVAL_TYPE_DISCRETE, discrete=1/30}) = 0
ioctl(21, VIDIOC_ENUM_FRAMEINTERVALS, {index=1, pixel_format=v4l2_fourcc('M', 'J', 'P', 'G'), width=800, height=600, type=V4L2_FRMIVAL_TYPE_DISCRETE, discrete=1/25}) = 0
ioctl(21, VIDIOC_ENUM_FRAMEINTERVALS, {index=2, pixel_format=v4l2_fourcc('M', 'J', 'P', 'G'), width=800, height=600, type=V4L2_FRMIVAL_TYPE_DISCRETE, discrete=1/20}) = 0
ioctl(21, VIDIOC_ENUM_FRAMEINTERVALS, {index=3, pixel_format=v4l2_fourcc('M', 'J', 'P', 'G'), width=800, height=600, type=V4L2_FRMIVAL_TYPE_DISCRETE, discrete=1/15}) = 0
ioctl(21, VIDIOC_ENUM_FRAMEINTERVALS, {index=4, pixel_format=v4l2_fourcc('M', 'J', 'P', 'G'), width=800, height=600, type=V4L2_FRMIVAL_TYPE_DISCRETE, discrete=1/10}) = 0
Comment 6 Ondrej Holy 2017-06-20 13:28:07 UTC
The strace covers 15 seconds, where 3 seconds are probably normal load and 12 seconds is v4l2-related only...

I am not really familiar with sysproof, but it seems similar, there are 12 seconds with only v4l2-related and 80211-related stuff. 80211 is for wifi, so it should be irrelevant to user-accounts.

v4l2 is for camera/video. It may be probably somehow loaded as a part of photo dialog. Bastien, don't you have an idea?
Comment 7 Ondrej Holy 2017-06-20 13:30:49 UTC
Have you tried also other panels? Does it affect only user-accounts panel?
Comment 8 Bastien Nocera 2017-06-20 13:33:35 UTC
(In reply to Ondrej Holy from comment #6)
> The strace covers 15 seconds, where 3 seconds are probably normal load and
> 12 seconds is v4l2-related only...
> 
> I am not really familiar with sysproof, but it seems similar, there are 12
> seconds with only v4l2-related and 80211-related stuff. 80211 is for wifi,
> so it should be irrelevant to user-accounts.
> 
> v4l2 is for camera/video. It may be probably somehow loaded as a part of
> photo dialog. Bastien, don't you have an idea?

Easiest would be to see if the cheese test app does the same. Was compiled as tests/cheese-test-chooser last time I looked at this, which I haven't in a couple of years.
Comment 9 Baptiste Mille-Mathias 2017-06-20 19:14:35 UTC
(In reply to Ondrej Holy from comment #7)
> Have you tried also other panels? Does it affect only user-accounts panel?

Yes, Yes
Comment 10 Ondrej Holy 2017-06-21 07:09:30 UTC
Baptiste, can you please try the cheese-test-chooser mentioned by Bastien? You have to build the cheese from source. If you don't know how to do it, it may be enough to try cheese itself first... do you also see slow startup? does strace output also contain continuous v4l2-related output?
Comment 11 Ondrej Holy 2017-06-21 07:10:34 UTC
Allan, can you please check that you also see the continuous v4l2-related output from strace when starting user-accounts?
Comment 12 Ondrej Holy 2017-06-21 07:11:01 UTC
I wonder that I don't see anything v4l2-related in my case, however, I can't also reproduce such hangs on startup... it has to be hardware dependent.
Comment 13 Allan Day 2017-06-22 10:00:33 UTC
Created attachment 354236 [details]
strace output

(In reply to Ondrej Holy from comment #11)
> Allan, can you please check that you also see the continuous v4l2-related
> output from strace when starting user-accounts?

That does appear in strace output, yes.
Comment 14 Ondrej Holy 2017-06-22 12:02:28 UTC
Thanks. So you also see v4l2-related output, interesting. Your log covers 26 seconds, because you started strace with just gnome-control-center without user-accounts parameter. So, 14 seconds probably covers a load of gnome-control-center and consequent activation of the user-accounts panel. Then, there are 5 seconds of v4l2-related output. You told about 3 seconds delay initially, so it might be 5 seconds this time...
Comment 15 Ondrej Holy 2017-06-22 12:03:44 UTC
Can you please somebody try cheese as mentioned in Comment 10? What is your version of cheese? Can you please try to downgrade it?

Sounds like a duplicate of Bug 782627 for cheese.
Comment 16 Ondrej Holy 2017-06-22 12:20:41 UTC
(In reply to Ondrej Holy from comment #15)
> Can you please somebody try cheese as mentioned in Comment 10? What is your
> version of cheese? Can you please try to downgrade it?

It might be also a bug in kernel if that doesn't help...
Comment 17 Baptiste Mille-Mathias 2017-06-22 19:40:20 UTC
Hello,

I can confirm bug 782627 is related to this one, because I have the same problem described, and once I have unplugged my webcam, both cheese and user-accounts start immediately.
Comment 18 Ondrej Holy 2017-06-23 09:33:05 UTC
Let's mark this as a duplicate of the cheese bug for now, because gnome-control-center builds on libcheese. Please see my comment there and provide more info if possible. We have to figure out if it is cheese bug, or kernel bug. Some workaround for g-c-c will be probably needed if it can't be fixed easily in cheese...

*** This bug has been marked as a duplicate of bug 782627 ***
Comment 19 Ondrej Holy 2017-10-20 16:24:55 UTC
Created attachment 361964 [details] [review]
user-accounts: Prevent freeze caused by external cameras

cheese_camera_device_monitor_new freezes the whole panel when opening
for a couple of seconds if external camera is connected. This is not
acceptable. Probably it is bug in kernel. Let's run this on a thread
as a workaround before it is fixed on the right place.
Comment 20 Ondrej Holy 2017-10-20 16:25:01 UTC
Created attachment 361965 [details] [review]
user-accounts: Show spinner before camera monitor creation

It may take some time before cheese_camera_device_monitor_new finishes.
Let's show the spinner to be obvious that something is happening.
Comment 21 Ondrej Holy 2017-10-20 16:25:32 UTC
I think that it is not acceptable that opening of users panel takes such a long time. I don't know what's exactly wrong and how to fix it. So I am proposing at least a workaround for Settings. What do you think? Unfortunately, my external webcam seems broken, so the patches are untested. Can somebody test it?
Comment 22 Felipe Borges 2017-10-31 11:55:27 UTC
Review of attachment 361964 [details] [review]:

Thank you!

I guess running it in a gtask is an acceptable workaround.

Being "cancellable" doesn't seem really necessary, but no problems here.
Comment 23 Felipe Borges 2017-10-31 11:56:34 UTC
Review of attachment 361965 [details] [review]:

Thanks!

Lets land this also in the gnome-3-26 in the hopes we can include it in 3.26.2.
Comment 24 Felipe Borges 2017-10-31 11:57:27 UTC
(In reply to Ondrej Holy from comment #21)
> I think that it is not acceptable that opening of users panel takes such a
> long time. I don't know what's exactly wrong and how to fix it. So I am
> proposing at least a workaround for Settings. What do you think?
> Unfortunately, my external webcam seems broken, so the patches are untested.
> Can somebody test it?

The patches work just fine here. I tested. ;-)
Comment 25 Bastien Nocera 2017-10-31 14:59:24 UTC
Review of attachment 361964 [details] [review]:

Why not make the CheeseCamera a GInitable and use that directly instead of working around this bug? This would help fix the same bug in Cheese.
Comment 26 Ondrej Holy 2017-11-01 10:35:49 UTC
Hmm, yes, GAsyncInitable sounds really like a good idea...
Comment 27 Ondrej Holy 2017-11-02 09:15:06 UTC
Created attachment 362801 [details] [review]
user-accounts: Prevent freeze caused by external cameras

Let's use GAsyncInitable if available. See Bug 782627.
Comment 28 Ondrej Holy 2017-11-02 09:15:43 UTC
Created attachment 362802 [details] [review]
user-accounts: Show spinner before camera monitor creation
Comment 29 Georges Basile Stavracas Neto 2018-01-18 14:19:40 UTC
Review of attachment 362801 [details] [review]:

Some questions below.

::: panels/user-accounts/um-photo-dialog.c
@@ +378,3 @@
 
+static void
+setup_cheese_camera_device_monitor (UmPhotoDialog *um)

This should be NULL safe I guess.

@@ +515,3 @@
+        {
+                um->monitor = cheese_camera_device_monitor_new ();
+                setup_cheese_camera_device_monitor (um);

CheeseCameraDeviceMonitor implements GInitable, its initialization might possibly fail. In that case, shouldn't we have a GError somewhere here? If that happens, setup_cheese_camera_device_monitor() will crash.
Comment 30 Georges Basile Stavracas Neto 2018-01-18 14:22:54 UTC
Review of attachment 362802 [details] [review]:

Looks good to me (although I admitedly might be lacking more context)
Comment 31 Georges Basile Stavracas Neto 2018-01-18 14:23:20 UTC
Review of attachment 362802 [details] [review]:

Looks good to me (although I admitedly might be lacking more context)
Comment 32 Georges Basile Stavracas Neto 2018-01-18 14:23:26 UTC
Review of attachment 362802 [details] [review]:

Looks good to me (although I admitedly might be lacking more context)
Comment 33 Bastien Nocera 2018-01-18 16:32:16 UTC
Review of attachment 362801 [details] [review]:

::: panels/user-accounts/um-photo-dialog.c
@@ +502,3 @@
 
+        /* Initialize asynchronously if possible in order to prevent freeze when opening. */
+        if (G_TYPE_IS_ASYNC_INITABLE (CHEESE_TYPE_CAMERA_DEVICE_MONITOR))

I'd rather you bumped the required cheese version when the patch has been merged. Looks fine otherwise.
Comment 34 Ondrej Holy 2018-02-19 10:31:47 UTC
Can't somebody test with the attached patches and corresponding patches from Bug 782627, please? I can't verify the patches, because I don't see this behavior anymore with the webcam which was causing this earlier...
Comment 35 Felipe Borges 2018-02-19 11:06:57 UTC
These patches need rebase.

I rebased locally here but the bug seems to persist. It takes 3~5 seconds to load control-center/user-accounts.

What type of logs/trace from me would help you here?
Comment 36 Felipe Borges 2018-02-19 12:10:26 UTC
Created attachment 368557 [details]
backtrace

It fixes the issue for me but raises a critical while iterating back and forth from one panel to another.

> Trying to stop a GstDeviceProvider v4l2deviceprovider0 which is already stopped

How to reproduce:

1. Open G_DEBUG=fatal-criticals gnome-control-center
2. Go to User Accounts
3. Go to Date & Time
4. Go to set 2 until the critical..
Comment 37 Bastien Nocera 2018-02-19 12:17:21 UTC
(In reply to Felipe Borges from comment #36)
> Created attachment 368557 [details]
> backtrace
> 
> It fixes the issue for me but raises a critical while iterating back and
> forth from one panel to another.
> 
> > Trying to stop a GstDeviceProvider v4l2deviceprovider0 which is already stopped
> 
> How to reproduce:
> 
> 1. Open G_DEBUG=fatal-criticals gnome-control-center
> 2. Go to User Accounts
> 3. Go to Date & Time
> 4. Go to set 2 until the critical..

I don't think you need to yo-yo between panels for the problem to appear. The problem looks like a misuse of the GStreamer API in Cheese.
Comment 38 Ondrej Holy 2018-02-19 12:21:13 UTC
Thanks for testing. But the critical is not caused by those patches, it is some bug in GStreamer, or Cheese. I see it even without those patches...
Comment 39 Ondrej Holy 2018-02-21 10:25:32 UTC
I've filed the following bug for the gstreamer critical:
https://bugzilla.gnome.org/show_bug.cgi?id=793689
Comment 40 Ondrej Holy 2018-02-21 10:26:53 UTC
Created attachment 368699 [details] [review]
user-accounts: Prevent freeze caused by external cameras

Rebased to master.

The cheese dependency has to be bumped accordingly before push!
Comment 41 Ondrej Holy 2018-03-13 09:07:16 UTC
Created attachment 369605 [details] [review]
user-accounts: Prevent freeze caused by external cameras

Cheese 2.28.0 has been finally released with the necessary API... so this patch modifies the cheese dependency accordingly... may I push this into master and gnome-3-28 as well?
Comment 42 Felipe Borges 2018-03-26 07:51:21 UTC
Review of attachment 369605 [details] [review]:

Sure. Thank you! Please push to the appropriate branches.
Comment 43 Ondrej Holy 2018-03-26 08:19:00 UTC
Created attachment 370138 [details] [review]
user-accounts: Prevent freeze caused by external cameras

Added one more #ifdef HAVE_CHEESE to not break building without cheese...
Comment 44 Ondrej Holy 2018-03-26 08:20:14 UTC
Attachment 370138 [details] pushed as 05c86d3 - user-accounts: Prevent freeze caused by external cameras
Comment 45 Ondrej Holy 2018-03-26 08:24:29 UTC
Pushed to gnome-3-28 as well.