! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Infinite recursive loop at startup when loading root menu
Status:
RESOLVED: WONTFIX

Comments

Description Landry Breuil editbugs 2010-11-08 22:03:19 CET
For a reason i don't explain, upon startup appfinder goes into an infinite recursive loop in _xfce_appfinder_window_load_menu(). The menu returned by garcon_menu_get_menus(menu) contains the parent menu, and leads to an infinite loop.
Added a g_debug statement just after garcon_menu_element_get_name() call : 

(xfce4-appfinder:20062): xfce4-appfinder-DEBUG: name=Xfce
(xfce4-appfinder:20062): xfce4-appfinder-DEBUG: name=Accessoires
(xfce4-appfinder:20062): xfce4-appfinder-DEBUG: name=Autres
(xfce4-appfinder:20062): xfce4-appfinder-DEBUG: name=Bureau
(xfce4-appfinder:20062): xfce4-appfinder-DEBUG: name=Développement
(xfce4-appfinder:20062): xfce4-appfinder-DEBUG: name=Infographie
(xfce4-appfinder:20062): xfce4-appfinder-DEBUG: name=Jeux
(xfce4-appfinder:20062): xfce4-appfinder-DEBUG: name=Multimédia
(xfce4-appfinder:20062): xfce4-appfinder-DEBUG: name=Paramètres
(xfce4-appfinder:20062): xfce4-appfinder-DEBUG: name=Économiseurs d'écran
(xfce4-appfinder:20062): xfce4-appfinder-DEBUG: name=Réseau
(xfce4-appfinder:20062): xfce4-appfinder-DEBUG: name=Science
(xfce4-appfinder:20062): xfce4-appfinder-DEBUG: name=Système
(xfce4-appfinder:20062): xfce4-appfinder-DEBUG: name=Éducation
(xfce4-appfinder:20062): xfce4-appfinder-DEBUG: name=Xfce
(xfce4-appfinder:20062): xfce4-appfinder-DEBUG: name=Accessoires
(xfce4-appfinder:20062): xfce4-appfinder-DEBUG: name=Autres
(xfce4-appfinder:20062): xfce4-appfinder-DEBUG: name=Bureau

etc etc.. so the root menu list contains itself. Maybe a bug in garcon_menu_add_menu() ? an unclean list ptr ? xfdesktop and xfce4-panel menus work fine, but they use garcon_menu_get_elements() + own submenu handling.

Maybe this bug should be filed against garcon ?
Comment 1 Landry Breuil editbugs 2010-11-25 22:52:04 CET
Reassigning to garcon, the infinite loop being in the menu returned by garcon_menu_get_menus().

Added a g_debug in garcon_menu_add_menu(), i get the following exactly 14 times:
(xfce4-appfinder:9821): garcon-DEBUG: adding submenu Settings to menu Xfce
(xfce4-appfinder:9821): garcon-DEBUG: adding submenu Accessories to menu Xfce
(xfce4-appfinder:9821): garcon-DEBUG: adding submenu Development to menu Xfce
(xfce4-appfinder:9821): garcon-DEBUG: adding submenu Education to menu Xfce
(xfce4-appfinder:9821): garcon-DEBUG: adding submenu Games to menu Xfce
(xfce4-appfinder:9821): garcon-DEBUG: adding submenu Graphics to menu Xfce
(xfce4-appfinder:9821): garcon-DEBUG: adding submenu Multimedia to menu Xfce
(xfce4-appfinder:9821): garcon-DEBUG: adding submenu Network to menu Xfce
(xfce4-appfinder:9821): garcon-DEBUG: adding submenu Office to menu Xfce
(xfce4-appfinder:9821): garcon-DEBUG: adding submenu Science to menu Xfce
(xfce4-appfinder:9821): garcon-DEBUG: adding submenu System to menu Xfce
(xfce4-appfinder:9821): garcon-DEBUG: adding submenu Other to menu Xfce
(xfce4-appfinder:9821): garcon-DEBUG: adding submenu Screensavers to menu Settings

and then it gets out of the loop and gets to the infinite loop in _xfce_appfinder_window_load_menu()

Debugging with gdb is painful as there seems to be corrupt stacks..

#0  garcon_menu_get_menus (menu=0x2b0bf4d0) at garcon-menu.c:788
#1  0x28862224 in garcon_menu_get_menus (menu=0x2b0bf4d0) at garcon-menu.c:785
#2  0x28862224 in garcon_menu_get_menus (menu=0x2b0bf4d0) at garcon-menu.c:785
#3  0x28862224 in garcon_menu_get_menus (menu=0x2b0bf4d0) at garcon-menu.c:785
#4  0x28862224 in garcon_menu_get_menus (menu=0x2b0bf4d0) at garcon-menu.c:785
#5  0x28862224 in garcon_menu_get_menus (menu=0x2b0bf4d0) at garcon-menu.c:785
Previous frame inner to this frame (corrupt stack?)
Comment 2 Landry Breuil editbugs 2010-11-25 22:57:26 CET
(In reply to comment #1)
> Reassigning to garcon, the infinite loop being in the menu returned by
> garcon_menu_get_menus().
> 
> Added a g_debug in garcon_menu_add_menu(), i get the following exactly 14
> times:

Oh wait. i get it 14 times before the window shows up. But after that, it continues endlessly to spam me with the same messages. So the endless loop is somewhere in the call path of garcon_menu_add_menu() ?
Comment 3 Landry Breuil editbugs 2011-01-14 09:37:25 CET
More info on this issue, which also affects xfdesktop which takes 100% cpu as soon as app-menu is enabled. xfdesktop 4.7.5, garcon 0.1.4, appfinder 4.7.2, gamin-0.1.10.

Another note.. while in the infinite loop, disk is hammered by gam_server, so to me it looks like monitoring is involved in it. On a remote machine with no xfce session, xfce4-appfinder starts/works fine (with monitoring, as gam_server is started once appfinder is started).

I have an infinite loop with that trace :
(gdb) bt
#0  garcon_menu_load (menu=0x206f7e890, cancellable=0x0, error=0x7f7ffffe4368) at garcon-menu.c:656
#1  0x0000000000419a65 in xfce_desktop_menu_destroy ()
#2  0x0000000000419b2e in xfce_desktop_menu_force_regen ()
#3  0x0000000213baeb93 in g_main_context_dispatch () from /usr/local/lib/libglib-2.0.so.2600.0
#4  0x0000000213bb2460 in g_main_context_prepare () from /usr/local/lib/libglib-2.0.so.2600.0
#5  0x0000000213bb2855 in g_main_loop_run () from /usr/local/lib/libglib-2.0.so.2600.0
#6  0x0000000209dffe93 in gtk_main () from /usr/local/lib/libgtk-x11-2.0.so.2200.0
#7  0x0000000000413646 in main ()

And for the appfinder, similar infinite loop calling garcon_menu_load :

(gdb) bt
#0  garcon_menu_load (menu=0x203978200, cancellable=0x0, error=0x7f7ffffd1fe8) at garcon-menu.c:656
#1  0x0000000000407aa8 in ?? ()
#2  0x0000000202e83f6f in g_closure_invoke () from /usr/local/lib/libgobject-2.0.so.2600.0
#3  0x0000000202e9b011 in g_signal_handlers_block_matched () from /usr/local/lib/libgobject-2.0.so.2600.0
#4  0x0000000202e9cf25 in g_signal_emit_valist () from /usr/local/lib/libgobject-2.0.so.2600.0
#5  0x0000000202e9d323 in g_signal_emit () from /usr/local/lib/libgobject-2.0.so.2600.0
#6  0x0000000202e83f6f in g_closure_invoke () from /usr/local/lib/libgobject-2.0.so.2600.0
#7  0x0000000202e9b011 in g_signal_handlers_block_matched () from /usr/local/lib/libgobject-2.0.so.2600.0
#8  0x0000000202e9cf25 in g_signal_emit_valist () from /usr/local/lib/libgobject-2.0.so.2600.0
#9  0x0000000202e9d323 in g_signal_emit () from /usr/local/lib/libgobject-2.0.so.2600.0
#10 0x000000020b525071 in g_file_input_stream_query_info () from /usr/local/lib/libgio-2.0.so.2600.0
#11 0x000000020eec9b93 in g_main_context_dispatch () from /usr/local/lib/libglib-2.0.so.2600.0
#12 0x000000020eecd460 in g_main_context_prepare () from /usr/local/lib/libglib-2.0.so.2600.0
#13 0x000000020eecd855 in g_main_loop_run () from /usr/local/lib/libglib-2.0.so.2600.0
#14 0x000000020e247e93 in gtk_main () from /usr/local/lib/libgtk-x11-2.0.so.2200.0
#15 0x0000000000405536 in ?? ()
#16 0x00000000004052d1 in ?? ()
#17 0x0000000000000000 in ?? ()
(gdb) c
Continuing.

Breakpoint 1, garcon_menu_load (menu=0x203978200, cancellable=0x0, error=0x7f7ffffd1fc8) at garcon-menu.c:656
656     {
(gdb) bt
#0  garcon_menu_load (menu=0x203978200, cancellable=0x0, error=0x7f7ffffd1fc8) at garcon-menu.c:656
#1  0x0000000000407aa8 in ?? ()
#2  0x0000000202e83f6f in g_closure_invoke () from /usr/local/lib/libgobject-2.0.so.2600.0
#3  0x0000000202e9b011 in g_signal_handlers_block_matched () from /usr/local/lib/libgobject-2.0.so.2600.0
#4  0x0000000202e9cf25 in g_signal_emit_valist () from /usr/local/lib/libgobject-2.0.so.2600.0
#5  0x0000000202e9d323 in g_signal_emit () from /usr/local/lib/libgobject-2.0.so.2600.0
#6  0x000000020b08467f in garcon_menu_directory_file_changed (menu=0x20d26f310, file=Variable "file" is not available.
) at garcon-menu.c:2338
#7  0x0000000202e83f6f in g_closure_invoke () from /usr/local/lib/libgobject-2.0.so.2600.0
#8  0x0000000202e9b011 in g_signal_handlers_block_matched () from /usr/local/lib/libgobject-2.0.so.2600.0
#9  0x0000000202e9cf25 in g_signal_emit_valist () from /usr/local/lib/libgobject-2.0.so.2600.0
#10 0x0000000202e9d323 in g_signal_emit () from /usr/local/lib/libgobject-2.0.so.2600.0
#11 0x000000020b525071 in g_file_input_stream_query_info () from /usr/local/lib/libgio-2.0.so.2600.0
#12 0x000000020eec9b93 in g_main_context_dispatch () from /usr/local/lib/libglib-2.0.so.2600.0
#13 0x000000020eecd460 in g_main_context_prepare () from /usr/local/lib/libglib-2.0.so.2600.0
#14 0x000000020eecd855 in g_main_loop_run () from /usr/local/lib/libglib-2.0.so.2600.0
#15 0x000000020e247e93 in gtk_main () from /usr/local/lib/libgtk-x11-2.0.so.2200.0
#16 0x0000000000405536 in ?? ()
#17 0x00000000004052d1 in ?? ()
#18 0x0000000000000000 in ?? ()
Comment 4 Landry Breuil editbugs 2011-01-16 19:40:34 CET
okay, finally found it.

Added debug stmts in all garcon_menu.c, and the endless loop start from the g_signal_emit() at the end of garcon_menu_file_changed() :

(xfdesktop:10681): garcon-DEBUG: menu_file_changed (prio!) file:///home/landry/.config/menus/xfce-applications.menu
DBG[xfce-desktop-menu.c:100] xfce_desktop_menu_reload(): Schedule menu reload
etc etc in a loop.

garcon_menu_file_changed() is recursively called with .config/menus/xfce-applications.menu as argument... but this file doesn't exist.

if i mkdir .config/menus and copy the file from etc/xdg/menus there, the endless loop doesn't happen.

So i don't know if this file should be here by default, or if garcon should avoid monitoring files which doesn't exist.. and this doesn't happen anymore with the appfinder, as there's probably no monitoring involved.
Comment 5 Landry Breuil editbugs 2011-01-16 21:17:58 CET
Created attachment 3355 
xfdesktop log when .config/menus/xfce-applications.menu exists
Comment 6 Landry Breuil editbugs 2011-01-16 21:19:54 CET
Created attachment 3356 
xfdesktop log when .config/menus/xfce-applications.menu doesn't exist

adding xfdesktop logs with GAM_DEBUG set when file is present and not. As i don't know gamin, it'd be nice to have help on that part. My understanding is that the kqueue backend of gamin *bsd uses has a different behaviour from the linux/inotify one...
Comment 7 Landry Breuil editbugs 2011-01-16 21:30:15 CET
looked at gamin/fam, what i'm getting in the case where the file doesn't exist looks correct : when monitoring starts on a file which doesn't exist, the caller is supposed to receive a 'Deleted' fam event. So i still don't get if the error is in gamin, in glib, or in garcon. I wonder how the trace looks like in the linux case.
Comment 8 Landry Breuil editbugs 2011-01-18 15:19:01 CET
Created attachment 3375 
testgam input file
Comment 9 Landry Breuil editbugs 2011-01-18 15:19:25 CET
Created attachment 3376 
gamtest output
Comment 10 Landry Breuil editbugs 2011-01-18 15:22:51 CET
Created attachment 3377 
interactive testgam session

Now i'm even more puzzled, i've done some gamin testing and it looks to monitor file creation just fine, according to those debug session logs.

I can monitor a dir which doesn't exist, a file in this dir, then create the dir and the file, the event is correctly raised, and in the meantime gam_server is not busy looping. Same if i monitor a file in a dir which doesn't exist, without monitoring the dir. Now to find out if the issue is in glib or garcon.

http://people.gnome.org/~veillard/gamin/debug.html is a useful resource btw :)
Comment 11 Skunnyk editbugs 2018-10-08 23:09:52 CEST
Closing old garcon bugreport.
Please reopen if needed.

Bug #6796

Reported by:
Landry Breuil
Reported on: 2010-11-08
Last modified on: 2018-10-08

People

Assignee:
Jannis Pohlmann
CC List:
2 users

Version

Attachments

xfdesktop log when .config/menus/xfce-applications.menu exists (15.72 KB, text/plain)
2011-01-16 21:17 CET , Landry Breuil
no flags
xfdesktop log when .config/menus/xfce-applications.menu doesn't exist (599.50 KB, text/plain)
2011-01-16 21:19 CET , Landry Breuil
no flags
testgam input file (258 bytes, text/plain)
2011-01-18 15:19 CET , Landry Breuil
no flags
gamtest output (1.06 KB, text/plain)
2011-01-18 15:19 CET , Landry Breuil
no flags
interactive testgam session (1.10 KB, application/octet-stream)
2011-01-18 15:22 CET , Landry Breuil
no flags

Additional information