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 96423 - [PATCH] gnome-panel dies with a SIGBUS on exit
[PATCH] gnome-panel dies with a SIGBUS on exit
Status: RESOLVED FIXED
Product: gnome-panel
Classification: Other
Component: panel
2.2.x
Other FreeBSD
: High major
: ---
Assigned To: Panel Maintainers
Panel Maintainers
Depends on:
Blocks:
 
 
Reported: 2002-10-21 18:05 UTC by Joe Marcus Clarke
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.0


Attachments
Patch to correct bus error on panel exit (530 bytes, patch)
2003-08-02 04:46 UTC, Joe Marcus Clarke
none Details | Review

Description Joe Marcus Clarke 2002-10-21 18:04:11 UTC
Package: gnome-panel
Severity: normal
Version: 2.0.10
Synopsis: gnome-panel dies with a SIGBUS on exit
Bugzilla-Product: gnome-panel
Bugzilla-Component: Panel

Description:
If a drawer widget is in the panel, gnome-panel will die with a SIGBUS
when it receives a session exit.  The problem is in the GTK_IS_WIDGET of
pd->panel in the panel_session_die function.  I haven't been able to
track down exactly what's causing this, but replacing the
gtk_widget_destroy with a simple:

pd->panel = NULL;

Works around the problem.  This problem only seems to happen on FreeBSD
-CURRENT which uses:

Using built-in specs.
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.2.1 [FreeBSD] 20021009 (prerelease)

FreeBSD 4.x does not exhibit this problem.  -CURRENT has some malloc
debugs enabled, but I don't believe that's the culprit.  Here is a back
trace from gdb:

Program received signal SIGBUS, Bus error.
0x2850cdda in gtk_widget_destroy () from
/usr/X11R6/lib/libgtk-x11-2.0.so.0
(gdb) bt
  • #0 gtk_widget_destroy
    from /usr/X11R6/lib/libgtk-x11-2.0.so.0
  • #1 panel_session_die
  • #2 g_cclosure_marshal_VOID__VOID
    from /usr/local/lib/libgobject-2.0.so.0
  • #3 g_closure_invoke
    from /usr/local/lib/libgobject-2.0.so.0
  • #4 signal_emit_unlocked_R
    from /usr/local/lib/libgobject-2.0.so.0
  • #5 g_signal_emit_valist
    from /usr/local/lib/libgobject-2.0.so.0
  • #6 g_signal_emit
    from /usr/local/lib/libgobject-2.0.so.0
  • #7 gnome_window_icon_init
    from /usr/X11R6/lib/libgnomeui-2.so.0
  • #8 _SmcProcessMessage
    from /usr/X11R6/lib/libSM.so.6
  • #9 IceProcessMessages
    from /usr/X11R6/lib/libICE.so.6
  • #10 gnome_href_set_label
    from /usr/X11R6/lib/libgnomeui-2.so.0
  • #11 g_io_unix_dispatch
    from /usr/local/lib/libglib-2.0.so.0
  • #12 g_main_dispatch
    from /usr/local/lib/libglib-2.0.so.0
  • #13 g_main_context_dispatch
    from /usr/local/lib/libglib-2.0.so.0
  • #14 g_main_context_iterate
    from /usr/local/lib/libglib-2.0.so.0
  • #15 g_main_loop_run
    from /usr/local/lib/libglib-2.0.so.0
  • #16 gtk_main
    from /usr/X11R6/lib/libgtk-x11-2.0.so.0




------- Bug moved to this database by unknown@bugzilla.gnome.org 2002-10-21 14:04 -------

Reassigning to the default owner of the component, gnome-panel-maint@bugzilla.gnome.org.

Comment 1 Vincent Untz 2003-01-09 16:02:21 UTC
Sorry to have not answered before.
Does it still happen ? Did you try gnome-panel 2.0.11 and/or 2.1.x ?
Comment 2 Joe Marcus Clarke 2003-01-09 18:29:55 UTC
It still happens iff malloc is configured to scrub freed memory with
junk for debugging.  Therefore, there is malloc'd that is not being
initialized in gnome-panel, or in one of the underlying components. 
If I turn off malloc debugging, the problem goes away.  I am unable to
try gnome-panel 2.1.x on this machine at this time.

FreeBSD uses 0xd0d0d0d0 as junk to fill malloc'd memory.  This can be
done by setting the J option for malloc in /etc/malloc.conf.  I can
probably get a back trace with debugging symbols if that will help.
Comment 3 Joe Marcus Clarke 2003-01-09 18:30:43 UTC
Hmmm, I just read my earlier comments.  Looks like the malloc
debugging _is_ the issue.
Comment 4 Kjartan Maraas 2003-07-02 23:18:11 UTC
A backtrace with debugging info would be nice if it still happens with
the 2.2.x sources.
Comment 5 Joe Marcus Clarke 2003-07-02 23:39:37 UTC
This is fixed in 2.2.  Sorry for not updating sooner.
Comment 6 Joe Marcus Clarke 2003-08-02 04:44:49 UTC
Sorry, this wasn't fixed, just masked by not having malloc debugging
enabled.  The good news is, I found the problem.  What happens is that
drawers on other panels are being free'd asynchronously, thus causing
a bus error in panel_session_die().  I added some debugging code to
panel.c and session.c so this can be somewhat visualized.  Take a
look.  The XXX lines occur as soon as I logout:

** (gnome-panel:62418): WARNING **: XXX: panel_list = 8212e98
                                                                     
          
** (gnome-panel:62418): WARNING **: XXX: i = 0
                                                                     
          
** (gnome-panel:62418): WARNING **: XXX: Entering panel_destroy for
822a120
                                                                     
          
** (gnome-panel:62418): WARNING **: XXX: Found pd 822a120 in panel_list.
                                                                     
          
** (gnome-panel:62418): WARNING **: XXX: Leaving panel_destroy for 822a120
                                                                     
          
** (gnome-panel:62418): WARNING **: XXX: i = 1
                                                                     
          
** (gnome-panel:62418): WARNING **: XXX: Entering panel_destroy for
822ad00
                                                                     
          
** (gnome-panel:62418): WARNING **: XXX: Found pd 822ad00 in panel_list.
                                                                     
          
** (gnome-panel:62418): WARNING **: XXX: Leaving panel_destroy for 822ad00
                                                                     
          
** (gnome-panel:62418): WARNING **: XXX: Entering panel_destroy for
830f780
                                                                     
          
** (gnome-panel:62418): WARNING **: XXX: Found pd 830f780 in panel_list.

** (gnome-panel:62418): WARNING **: XXX: Leaving panel_destroy for 830f780
                                                                     
          
** (gnome-panel:62418): WARNING **: XXX: i = 2
(Crash on SIGBUS)

Note what happens.  The i lines are printed in session.c each time the
loop through panels_to_destroy in panel_session_die() is started. 
Normally, as soon as a panel widget is destroyed, gtk_widget_destroy()
calls panel_destroy() in panel.c.  But, if you have a drawer within a
panel (panel with i == 1), the drawer is also destroyed by
panel_destroy().  This would be fine since panel_session_die() checks
to see that pd->panel is not NULL.  However, you're assuming that
g_free() will render a pointer NULL.  This is not always the case. 
With FreeBSD's malloc scrubbing enabled (default for 5.x -CURRENT),
each free'd pointer is set to 0xd0d0d0d0.

While I don't think my attached patch is a perfect solution, it
definitely solves the problem we're seeing.  I think the best solution
would be to destroy each sub-panel in order in panel_session_die() so
that it isn't "accidentally" destroyed in panel_destroy().  However,
since gnome-panel 2.3.x changes this whole thing, I'm not yet sure
this bug exists in HEAD.  It would be nice if this patch could be
applied to the gnome-2-2 branch, though.

I hope this explanation makes sense.  Let me know if you require
additional info.
Comment 7 Joe Marcus Clarke 2003-08-02 04:46:21 UTC
Created attachment 18840 [details] [review]
Patch to correct bus error on panel exit
Comment 8 Mark McLoughlin 2003-08-05 13:17:13 UTC
Okay, I'm a bit confused about all this, but I think I see what you're
getting at - does the patch below fix the problem ?

Note, this is for gnome-panel HEAD ...

a similar thing could be done with 2.2 by doing

   if (DRAWER_IS_WIDGET (l->data))
      continue;


Could you test this out and let me know ? Thanks.

Comment 9 Joe Marcus Clarke 2003-08-05 14:46:59 UTC
There was no patch below.  However, as a note, I tested gnome-panel
HEAD yesterday, and I could not reproduce the crash.
Comment 10 Vincent Untz 2003-09-02 22:49:25 UTC
Joe: Is it ok to close the bug ?
Comment 11 Joe Marcus Clarke 2003-09-02 23:14:03 UTC
Yeah, I haven't been able to reproduce the crash in GNOME 2.3.  Thanks.