Bug 227828

Summary: Mail-Notification fails to initialize in FC7-T1
Product: [Fedora] Fedora Reporter: Bob Agel <cragel>
Component: mail-notificationAssignee: Thorsten Leemhuis <fedora>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: erik-fedora, mbarnes, mclasen
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-04-04 15:08:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 229925, 231767, 235056    
Bug Blocks:    
Attachments:
Description Flags
testcase for the deadlock which occurs when using GDK_THREADS_ENTER while the g_main_loop is not running
none
testcase for the deadlock which doesn't occur when using GDK_THREADS_ENTER using the g_main_loop
none
Patch to fix the deadlock none

Description Bob Agel 2007-02-08 14:32:39 UTC
Description of problem:
Mail-notification installed without error, however clicking on the icon does not
initialize and running in terminal as 'mail-notification' results in a 'hang'
with the response of:
GTK Accessibility Module initialized
Bonobo accessibility support initialized


Version-Release number of selected component (if applicable):
mail-notification-4.0-1.fc7
mail-notification-evolution-plugin-4.0-1.fc7
(same hang before installing the evolution-plugin)


How reproducible:
every time - start by icon or in terminal

Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Thorsten Leemhuis 2007-02-10 14:25:11 UTC
Happens here, too. But looks like the bug is somewhere else -- I see odd
behavior in other apps, too. I'm still investigating.... 

Bob, can you please try to run gconf-editor for example? Does it crash for you
shortly after printing "Bonobo accessibility support initialized", too?

Comment 2 Bob Agel 2007-02-10 22:52:04 UTC
No, gconf-editor installed and ran properly. In this case, it did respond with:
GTK Accessibility Module initialized
Bonobo accessibility support initialized

but then immediately launched the gui and worked fine in both user and root modes.

Comment 3 Thorsten Leemhuis 2007-02-11 18:31:01 UTC
/me is confused -- it seems to work fine if you start if from another machine
via ssh

Comment 4 Bob Agel 2007-02-11 21:59:14 UTC
Ah...well then, would you please start mine? ;) - still borking here.

Comment 5 Erik van Pienbroek 2007-02-19 15:37:00 UTC
I've tried to investigate this issue too and the problem seems to be caused
by a call to gnome_program_init. If the GDK threads subsystem is already
initialized (gdk_threads_init) and gnome_program_init is called, something
within the gnome_program_init function locks the GDK threads subsystem, but
doesn't unlock it. When mail-notification tries to acquire the lock it fails in
doing so, thus a deadlock. I'll try to investigate this issue further.

Comment 6 Erik van Pienbroek 2007-02-19 16:59:18 UTC
It looks like the cause of this problem is to be found in at-spi.
at-spi recently had a change (1) which should fix a deadlock problem
in Ekiga, but apparantly it also introduced a new bug. Due to this change
the function GDK_THREADS_ENTER can only be called when the g_main_loop is running.
This behaviour can be reproduced by using test program 1. Test program 2
shows that starting the g_main_loop before using GDK_THREADS_ENTER 'solves'
this problem. So, as a workaround to this problem the calls to GDK_THREAD_ENTER
and GDK_THREADS_LEAVE can be removed from the main() function, but I don't know
what further consequences this change might have. 

Anyway, about at-spi, when I start mail-notification from gdb and put
breakpoints on gdk_threads_impl_lock and gdk_threads_impl_unlock it looks
like the gdk_threads_impl_unlock breakpoint gets hit first...

#0  gdk_threads_impl_unlock () at gdk.c:384
#1  0x00fbc970 in ?? () from /usr/lib/gtk-2.0/modules/libgail.so
#2  0x0012f16b in atk_misc_threads_leave (misc=0x8801660) at atkmisc.c:112
#3  0x0054212e in spi_atk_bridge_register_application (registry=<value optimized
out>) at bridge.c:314
#4  0x00542767 in spi_atk_bridge_do_registration () at bridge.c:271
#5  0x0054416a in atk_bridge_init (argc=0x3e44448, argv=0x3e4444c) at bridge.c:231
#6  0x03becba9 in default_display_notify_cb (display_manager=0x87d6340) at
gtkmodules.c:413
#7  0x00315819 in g_cclosure_marshal_VOID__PARAM () from /lib/libgobject-2.0.so.0
#8  0x00308d9b in g_closure_invoke () from /lib/libgobject-2.0.so.0
#9  0x00319433 in ?? () from /lib/libgobject-2.0.so.0
#10 0x0031a957 in g_signal_emit_valist () from /lib/libgobject-2.0.so.0
#11 0x0031ab19 in g_signal_emit () from /lib/libgobject-2.0.so.0
#12 0x0030d171 in ?? () from /lib/libgobject-2.0.so.0
#13 0x00309b5f in ?? () from /lib/libgobject-2.0.so.0
#14 0x0030ed22 in g_object_notify () from /lib/libgobject-2.0.so.0
#15 0x005e96e8 in IA__gdk_display_manager_set_default_display
(display_manager=0x87d6340, display=0x87e3098) at gdkdisplaymanager.c:243
#16 0x005e0d36 in IA__gdk_display_open_default_libgtk_only () at gdk.c:289
#17 0x03bd5bcf in IA__gtk_init_check (argc=0xbf8eecd4, argv=0xbf8eecd0) at
gtkmain.c:889
#18 0x03bd5c04 in IA__gtk_init (argc=0xbf8eecd4, argv=0xbf8eecd0) at gtkmain.c:924
#19 0x00d0b136 in bonobo_ui_gtk_post_args_parse (program=0x87ca810,
mod_info=0xd4f440) at bonobo-ui-init-gtk.c:59
#20 0x009e7774 in gnome_program_postinit (program=0x87ca810) at gnome-program.c:1700
#21 0x009e9755 in gnome_program_init_common (type=142374072, app_id=0x808379b
"mail-notification", app_version=0x8082f76 "4.0", module_info=0x222620, 
    argc=1, argv=0xbf8ef004, first_property_name=0x8082f62 "human-readable-name", 
    args=0xbf8eede8
"�/\b\bW/\b\bR/\b\bC/\b\b>/\b\b2/\b\b'/\b\b\034/\b\b\023/\b\b\b/\b\b(�\216�",
nparams=-1, params=0x0) at gnome-program.c:1932
#22 0x009e9a81 in gnome_program_init (app_id=0x808379b "mail-notification",
app_version=0x8082f76 "4.0", module_info=0x222620, argc=1, argv=0xbf8ef004, 
    first_property_name=0x8082f62 "human-readable-name") at gnome-program.c:1748
#23 0x08058eab in main (argc=1, argv=0xbf8ef004) at mn-main.c:359

...and afterwards the gdk_threads_impl_lock breakpoint gets reached...

#0  gdk_threads_impl_lock () at gdk.c:377
#1  0x00f86940 in ?? () from /usr/lib/gtk-2.0/modules/libgail.so
#2  0x00db614b in atk_misc_threads_enter (misc=0x949c660) at atkmisc.c:79
#3  0x004b6172 in spi_atk_bridge_register_application (registry=<value optimized
out>) at bridge.c:318
#4  0x004b6767 in spi_atk_bridge_do_registration () at bridge.c:271
#5  0x004b816a in atk_bridge_init (argc=0x3e44448, argv=0x3e4444c) at bridge.c:231
#6  0x03becba9 in default_display_notify_cb (display_manager=0x9471340) at
gtkmodules.c:413
#7  0x002a3819 in g_cclosure_marshal_VOID__PARAM () from /lib/libgobject-2.0.so.0
#8  0x00296d9b in g_closure_invoke () from /lib/libgobject-2.0.so.0
#9  0x002a7433 in ?? () from /lib/libgobject-2.0.so.0
#10 0x002a8957 in g_signal_emit_valist () from /lib/libgobject-2.0.so.0
#11 0x002a8b19 in g_signal_emit () from /lib/libgobject-2.0.so.0
#12 0x0029b171 in ?? () from /lib/libgobject-2.0.so.0
#13 0x00297b5f in ?? () from /lib/libgobject-2.0.so.0
#14 0x0029cd22 in g_object_notify () from /lib/libgobject-2.0.so.0
#15 0x004d66e8 in IA__gdk_display_manager_set_default_display
(display_manager=0x9471340, display=0x947e098) at gdkdisplaymanager.c:243
#16 0x004cdd36 in IA__gdk_display_open_default_libgtk_only () at gdk.c:289
#17 0x03bd5bcf in IA__gtk_init_check (argc=0xbf8d14c4, argv=0xbf8d14c0) at
gtkmain.c:889
#18 0x03bd5c04 in IA__gtk_init (argc=0xbf8d14c4, argv=0xbf8d14c0) at gtkmain.c:924
#19 0x003e9136 in bonobo_ui_gtk_post_args_parse (program=0x9465810,
mod_info=0x42d440) at bonobo-ui-init-gtk.c:59
#20 0x00cef774 in gnome_program_postinit (program=0x9465810) at gnome-program.c:1700
#21 0x00cf1755 in gnome_program_init_common (type=155591864, app_id=0x808379b
"mail-notification", app_version=0x8082f76 "4.0", module_info=0x943620, 
    argc=1, argv=0xbf8d17f4, first_property_name=0x8082f62 "human-readable-name", 
    args=0xbf8d15d8
"�/\b\bW/\b\bR/\b\bC/\b\b>/\b\b2/\b\b'/\b\b\034/\b\b\023/\b\b\b/\b\b\030\026\215�",
nparams=-1, params=0x0) at gnome-program.c:1932
#22 0x00cf1a81 in gnome_program_init (app_id=0x808379b "mail-notification",
app_version=0x8082f76 "4.0", module_info=0x943620, argc=1, argv=0xbf8d17f4, 
    first_property_name=0x8082f62 "human-readable-name") at gnome-program.c:1748
#23 0x08058eab in main (argc=1, argv=0xbf8d17f4) at mn-main.c:359

Should we reassign this problem to at-spi ?

1. http://bugzilla.gnome.org/show_bug.cgi?id=329454 

Comment 7 Erik van Pienbroek 2007-02-19 17:01:34 UTC
Created attachment 148332 [details]
testcase for the deadlock which occurs when using GDK_THREADS_ENTER while the g_main_loop is not running

Comment 8 Erik van Pienbroek 2007-02-19 17:03:02 UTC
Created attachment 148333 [details]
testcase for the deadlock which doesn't occur when using GDK_THREADS_ENTER using the g_main_loop

Comment 9 Thorsten Leemhuis 2007-02-19 17:13:52 UTC
(In reply to comment #5)
>  I'll try to investigate this issue further.

Many thx for your help Erik

(In reply to comment #6at-spi)
> Should we reassign this problem to at-spi ?
> 1. http://bugzilla.gnome.org/show_bug.cgi?id=329454 

Maybe adding the owner (mclasen) to the CC-list of this bug helps -- he's quite
helpful if he finds time. If he doesn't comment in the next days it might be the
best to file a separate bug to make tracking easier. 

Comment 10 Matthias Clasen 2007-02-26 04:12:10 UTC
The testcase in comment 7 has a bug: You should call 

g_thread_init (NULL)
gdk_threads_init ();
GDK_THREADS_ENTER();

first thing in your program. Calling GDK_THREADS_ENTER() after
gnome_program_init() is too late, since gnome_program_init is making
gtk calls.

Comment 11 Matthias Clasen 2007-02-26 05:58:36 UTC
actually, calling this a bug is a bit strong. This used to work just fine, but 
the a11y stack is now assuming that it is always called under the GDK lock.

Comment 12 Erik van Pienbroek 2007-02-26 06:35:41 UTC
In that case, shouldn't the GTK documentation be updated to clarify this behaviour?

Should upstream be informed about this issue?

Comment 13 Matthias Clasen 2007-02-27 06:37:51 UTC
The GDK threads documentation has always recommended taking the GDK lock right
after gdk_threads_init().

Comment 14 Thorsten Leemhuis 2007-03-03 08:28:41 UTC
Reported upstream:
https://savannah.nongnu.org/bugs/index.php?19189

Comment 15 Thorsten Leemhuis 2007-03-08 13:21:19 UTC
FYI, disabling accessibility features with gnome-at-properties works around the
problem

Comment 16 Bob Agel 2007-03-08 14:06:45 UTC
Confirmed that disabling accessibility with gnome-at-properties is a work-around.

Comment 17 Erik van Pienbroek 2007-03-08 17:29:50 UTC
Based on the comments from Matthias I've created a small patch which fixes the
problem. I've been running mail-notification with it for a few days and haven't
found any difficulties with it. 

Comment 18 Erik van Pienbroek 2007-03-08 17:30:53 UTC
Created attachment 149595 [details]
Patch to fix the deadlock

Comment 19 Thorsten Leemhuis 2007-03-17 20:41:14 UTC
Still waiting for 231767 to get fixed, as mail-notification otherwise fails to build

Comment 20 Matthew Barnes 2007-04-03 16:41:53 UTC
Bug #231767 is fixed now.  Update to evolution-2.10.0-7.fc7.

Comment 21 Thorsten Leemhuis 2007-04-03 16:52:34 UTC
(In reply to comment #20)
> Bug #231767 is fixed now. 

Saw it, but there is another problem now :-( See Bug 235056

Comment 22 Thorsten Leemhuis 2007-04-04 15:08:08 UTC
(In reply to Bug 235056 Comment #3)
> Should be fixed in evolution-2.10.0-9.fc7.

Many thanks for your help Matthew.
 
> Hopefully that's the last of the build issues.

Seems so -- it build fine now and the problem is gone. Erik, thanks for your patch.

Updated package should be pushed out soon.