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 571423 - grabbing the keyboard while a menu is open can lock the session
grabbing the keyboard while a menu is open can lock the session
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: nm-applet
0.7.x
Other Linux
: Normal major
: ---
Assigned To: Dan Williams
Dan Williams
: 545509 573819 578208 592871 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-02-12 10:02 UTC by Sebastien Bacher
Modified: 2010-08-08 04:20 UTC
See Also:
GNOME target: ---
GNOME version: 2.25/2.26


Attachments
Try for a test case (2.52 KB, text/plain)
2009-02-14 14:11 UTC, Stef Walter
Details

Description Sebastien Bacher 2009-02-12 10:02:52 UTC
the bug has been described on https://bugs.edge.launchpad.net/bugs/217551

"1. Click to nm-applet and select connection(wired in my case)
2. Click again on nm-applet and move your mouse somewhere on any connection
3. The Unlock keyring appears and everything is blocked"
Comment 1 Stef Walter 2009-02-14 14:11:57 UTC
Created attachment 128717 [details]
Try for a test case

I'm trying to understand this problem better. I've written a test program for it. The test program shows a menu, and then the keyring ask dialog in attempt lock up the screen similar to this bug.

I can't get it to happen, but I'd like to ask you to try the test program to see if it duplicates the behavior for you.

This test program assumes GNOME is installed in /usr as is usually the case in most distros.
Comment 2 Stef Walter 2009-02-14 14:21:44 UTC
BTW, if anyone needs instructions on how to run the test program:

 * Save the file as gtk-test.c 
 * Install your OS's build packages (on Debian build-essential, libgtk2.0-dev)
 * In same directory as file run command on first line of the file. Remove /* and */

I've also added the strings to gnome-keyring that for the showing of an error dialog (since we're soon entering string freeze) once we figure out what the problem is and how to fix it. 
Comment 3 Alexander Sack 2009-02-16 12:02:44 UTC
it takes a few right click, but then it triggers this "grabbing" deadlock as i would say. Only way out was to kill gdm on console.

Also i encounter situations similar to this (nothing gets any focus/clicks), but even alt-ctrl-F1 doesn't work anymore. Could this be related? ... by grabbing even more keyboard/input? (i think the total lockup happens in combination with gtk pinentry for me which seems to grab more aggressively).

Do you need more info?
Comment 4 Alexander Sack 2009-02-16 12:07:50 UTC
also of interest that killing the test binary on console doesnt help. once i reach this deadlock situation only restarting X helps.
Comment 5 Stef Walter 2009-02-18 14:49:36 UTC
Alexander, could you describe your X environment so I can try and replicate it more closely:

 * Window manager
 * Use of desktop effects
 * Distro and version?

Thanks!
Comment 6 Alexander Sack 2009-02-23 13:34:39 UTC
WM: Compiz with normal desktop effects
Distro: ubuntu jaunty 9.04 (up to date).
Comment 7 Stef Walter 2009-02-28 19:55:16 UTC
Interesting, I'll be upgrading to jaunty shortly and will try to duplicate there. I appreciate the info.
Comment 8 Stef Walter 2009-03-01 23:40:37 UTC
When I try to duplicate this on an up to date Jaunty (ie: using the test program attached) the session doesn't lock up for me.

I get the following output (which is to be expected):

stef@stef-laptop:~/Desktop$ ./gtk-test 
show menu
run gnome-keyring-ask
** Message: could not grab keyboard: 1
** Message: could not grab keyboard: 1
** Message: could not grab keyboard: 1

The number 1 above represents 'GDK_GRAB_ALREADY_GRABBED'. See GdkGrabStatus in the documentation.

Could you duplicate the problem, and paste the output of the test program attached?
Comment 9 Stef Walter 2009-03-03 00:56:11 UTC
*** Bug 573819 has been marked as a duplicate of this bug. ***
Comment 10 Stef Walter 2009-03-05 03:35:07 UTC
*** Bug 545509 has been marked as a duplicate of this bug. ***
Comment 11 Stef Walter 2009-03-07 05:40:13 UTC
Anyone have the output of the sample program when the hang occurs? I'd like to fix this before 2.28.0. 
Comment 12 Arto Huotari 2009-03-11 20:59:01 UTC
I know that this is not the info you want but I had no luck with the test program. Output was as follows. 

And I know that on my system this bug can be replicated since I reported a duplicate 573819 for this bug. 

Hope that this helps a bit since I confirm that the bug does not occur with the test program.

show menu
run gnome-keyring-ask
** Message: could not grab keyboard: 1
** Message: could not grab keyboard: 1
** Message: could not grab keyboard: 1
mypassword


[general]
response=2
show menu
run gnome-keyring-ask
** Message: could not grab keyboard: 1
** Message: could not grab keyboard: 1
** Message: could not grab keyboard: 1
mypassword
Comment 13 Stef Walter 2009-04-10 20:02:59 UTC
*** Bug 578208 has been marked as a duplicate of this bug. ***
Comment 14 Jonathon Jongsma 2009-10-08 19:16:52 UTC
I just encountered an issue that I think is very similar to the one described.  In my case, I opened evolution.  I right-clicked a folder, which popped up a context menu.  While the context menu was still open, evolution attempted to update my accounts, so a gnome-keyring dialog appeared.  When the dialog appeared, my X session became completely unresponsive to keyboard or mouse.  The only way I could recover was to switch to a virtual console (Ctrl+Alt+F1) and kill evolution.  This is a very serious issue.  For most normal users that don't know about Ctrl+Alt+F1, the only solution would be a hard power-down of the computer.
Comment 15 Stef Walter 2009-10-10 01:49:35 UTC
We need to find a way to reliably duplicate this. It seems to be dependent on the window manager being used, but I'm not sure. 

Do you have a way to reliably duplicate this? Could you describe it? 

If you could had the means and time to write a tiny application which duplicates the problem, that would help immensely toward fixing the problem. But that may be asking too much. I'd be happy with any help you could contribute.
Comment 16 Jonathon Jongsma 2009-10-10 04:00:20 UTC
hm, did you try to reproduce the steps I mentioned in my previous comment? (start evolution, right-click a folder, wait for gnome-keyring dialog).  I replicated that several times in a row here, does it not work on your machine?  This requires you to have not granted evolution the ability to always access the keyring, of course.  (btw, I'm just using stock metacity as window manager)
Comment 17 Stef Walter 2009-10-14 04:00:49 UTC
The evolution case is due to them using the sync gnome-keyring APIs, which are not appropriate for use in a GTK mainloop driven GUI application:

~/contrib/evolution-data-server$ grep -R gnome_keyring * | grep sync
libedataserverui/e-passwords.c:		result = gnome_keyring_item_delete_sync (NULL, found->item_id);
libedataserverui/e-passwords.c:	result = gnome_keyring_item_create_sync (
libedataserverui/e-passwords.c:	result = gnome_keyring_find_items_sync (
libedataserverui/e-passwords.c:		gnome_keyring_get_default_keyring_sync (&default_keyring);

When evolution grabs the keyboard (due to a menu) and then executes a keyring 'sync' call, it no longer runs its mainloop until that API returns. The API does not return until after the keyring prompt.
Comment 18 Stef Walter 2009-10-14 04:04:31 UTC
In addition this same reason is why network-manager-applet is hanging:

~/contrib/network-manager-applet$ grep -R gnome_keyring * | grep sync
src/gconf-helpers/gconf-upgrade.c:	result = gnome_keyring_find_itemsv_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
src/gconf-helpers/gconf-upgrade.c:	result = gnome_keyring_find_network_password_sync (g_get_user_name (), /* user */
src/gconf-helpers/gconf-upgrade.c:	ret = gnome_keyring_find_itemsv_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
src/gconf-helpers/gconf-upgrade.c:	gnome_keyring_item_delete_sync (found->keyring, found->item_id);
src/gconf-helpers/gconf-upgrade.c:	ret = gnome_keyring_find_itemsv_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
src/gconf-helpers/gconf-upgrade.c:	gnome_keyring_item_delete_sync (found->keyring, found->item_id);
src/gconf-helpers/gconf-upgrade.c:	status = gnome_keyring_find_network_password_sync (g_get_user_name (),     /* user */
src/gconf-helpers/gconf-upgrade.c:		gnome_keyring_item_delete_sync (found->keyring, found->item_id);
src/gconf-helpers/gconf-upgrade.c:		ret = gnome_keyring_find_itemsv_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
src/gconf-helpers/gconf-upgrade.c:			ret = gnome_keyring_find_itemsv_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
src/gconf-helpers/gconf-upgrade.c:				ret = gnome_keyring_item_delete_sync (found->keyring, found->item_id);
src/gconf-helpers/gconf-upgrade.c:	ret = gnome_keyring_find_itemsv_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
src/gconf-helpers/gconf-upgrade.c:		gnome_keyring_item_delete_sync (found->keyring, found->item_id);
src/gconf-helpers/gconf-helpers.c:	if (gnome_keyring_get_info_sync (NULL, &info) == GNOME_KEYRING_RESULT_OK) {
src/gconf-helpers/gconf-helpers.c:	ret = gnome_keyring_item_create_sync (NULL,
src/gconf-helpers/nma-gconf-connection.c:	ret = gnome_keyring_find_itemsv_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
src/gconf-helpers/nma-gconf-connection.c:	ret = gnome_keyring_find_itemsv_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
Comment 19 Stef Walter 2009-10-14 13:36:54 UTC
Changing product to network-manager-applet. Related bug for evolution-data-server is bug #595421
Comment 20 Dan Williams 2009-10-15 14:42:18 UTC
nm-applet will close the menu before any operation that uses the keyring; see src/gconf-helpers/gconf-helpers.c, pre_keyring_callback().  Yes, it's a hack around using sync keyring functions, but it works.

What version of NM did you see this with?  Because it shouldn't have been happening since early 2009.
Comment 21 Arto Huotari 2009-10-27 16:29:56 UTC
0.7.0 but I am still using ubuntu 8.10

(Synaptic reports cryptic 0.7~~svn20081020t00044ubuntu1.8.10.2
Comment 22 Tobias Mueller 2010-02-02 14:30:36 UTC
Reopening as the requested information has been provided.
Comment 23 Stef Walter 2010-02-07 19:30:43 UTC
*** Bug 592871 has been marked as a duplicate of this bug. ***
Comment 24 Dan Williams 2010-08-08 04:20:27 UTC
The fix for this bug was committed on 2008-10-28 (commit 7083b298) so I think the version Ubuntu shipped in 8.10 just missed this fix by a week :(  But it's fixed now.