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 422242 - metacity crashed with SIGSEGV in event_callback()
metacity crashed with SIGSEGV in event_callback()
Status: RESOLVED FIXED
Product: metacity
Classification: Other
Component: general
2.19.x
Other Linux
: Normal critical
: ---
Assigned To: Metacity maintainers list
Metacity maintainers list
Depends on:
Blocks:
 
 
Reported: 2007-03-24 11:38 UTC by Sebastien Bacher
Modified: 2008-07-16 22:02 UTC
See Also:
GNOME target: ---
GNOME version: 2.19/2.20


Attachments
verbose debugging log (20.72 KB, application/x-gzip)
2007-04-09 21:48 UTC, Malcolm Parsons
Details

Description Sebastien Bacher 2007-03-24 11:38:31 UTC
The bug has been described on https://launchpad.net/bugs/92502

"Binary package hint: metacity

Same as bug 85763, however, with different hardware. Creating the bug report anyway, even though it is quite likely that it is going to be filed as a duplicate.

I have the i810 in a dual-screen setup. This crash does not occur when there is only one screen. I thought we were past the dual-head problems on the i810…? :-)

ProblemType: Crash
Architecture: i386
CrashCounter: 1
Date: Thu Mar 15 08:28:13 2007
DistroRelease: Ubuntu 7.04
ExecutablePath: /usr/bin/metacity
Package: metacity 1:2.18.0-0ubuntu1
...
.

Thread 1 (process 5375)

  • #0 event_callback
    at display.c line 1840
  • #1 filter_func
    at ui.c line 88
  • #2 gdk_event_apply_filters
    at gdkevents-x11.c line 343
  • #3 gdk_event_translate
    at gdkevents-x11.c line 892
  • #4 _gdk_events_queue
    at gdkevents-x11.c line 2252
  • #5 gdk_event_dispatch
    at gdkevents-x11.c line 2312
  • #6 IA__g_main_context_dispatch
    at gmain.c line 2045
  • #7 g_main_context_iterate
    at gmain.c line 2677
  • #8 IA__g_main_loop_run
    at gmain.c line 2881
  • #9 main
    at main.c line 391
  • #10 ??
  • #11 ??
  • #12 ??
  • #13 ??
  • #14 ??
  • #15 ??

The crash happens when using desktop effects to run compiz
Comment 1 Elijah Newren 2007-03-24 16:42:56 UTC
> The crash happens when using desktop effects to run compiz

NOTGNOME
Comment 2 Sebastien Bacher 2007-03-25 10:33:49 UTC
why? it's metacity crashing
Comment 3 Martin Meyer 2007-03-25 16:18:07 UTC
You should not be running both Metacity and Compiz at the same time. They're both window managers and you should only have one of them running at a time. Compiz is not currently part of the gnome desktop, so if it's a Compiz bug then it's definitely not gnome. However, the top of the stack trace indicates that the binary that crashed was Metacity.

In your Ubuntu bug, it sounds like Metacity is crashing when you're trying to enable visual effects? If that is the case then this might be a crash when compiz --replace is being called. That still leaves the question of whether it's metacity crashing at replacement time or compiz crashing at startup. There isn't really much more to go on in that launchpad bug though :-/
Comment 4 Elijah Newren 2007-03-26 01:02:17 UTC
(In reply to comment #2)
> why? it's metacity crashing

ah, right.  Didn't read that closely, did I?

I won't easily be able to look at it; until I get better hardware (intel stuff as I hear) I can't duplicate.

Comment 5 Elijah Newren 2007-03-26 01:04:39 UTC
(Now marking as needinfo, as per Martin's comments.  It looks like we've got a new knowledgeable metacity contributor.  Woohoo!)
Comment 6 Havoc Pennington 2007-03-26 04:07:02 UTC
The backtrace is pretty good here, presumably looking at display.c:1840 for the right metacity version would narrow it down pretty quick.

It's definitely a metacity bug if metacity crashes. A simple thing to try is whether metacity --replace (replace metacity with metacity) also crashes, then it would be simple to reproduce sans compiz, for anyone with two screens at least.

Comment 7 Thomas Thurman 2007-03-27 03:45:31 UTC
FWIW, in trunk at least, 1840 is attempting to activate the default window on the new screen when the mouse has just entered that screen. It looks up meta_display_screen_for_root for the root window taken from the event, and puts the answer in new_screen; we see from the trace that this is null. It then tries to dereference it, hence the segfault. MDSFR returning null is quite reasonable, though: it just means that the root window requested is not the root window of any of the screens of that display. Why *that* should be, I don't know.

(It bothers me rather that in almost all the places where meta_display_screen_for_root is called, we don't check whether the result is null before dereferencing it. I will add some checks for this.)
Comment 8 Havoc Pennington 2007-03-27 13:11:24 UTC
I believe metacity at least originally was intended to be able to manage only some of the screens on a display, which would imply a NULL MetaScreen for some root windows. I'm sure this has been tested only rarely. But e.g. you would do this if you wanted to do some weird thing on one head, you could run fvwm2 on that head with some weird custom config to e.g. just hold a window at fullscreen. Then on the main head you could run metacity.

So question 1), I would say figure out why metacity is not managing the screen in question.

Question 2), if it's not managing a screen, some events may arrive on that screen anyway, and they should be ignored. I would suggest trying to put this in some global location (e.g. in event_callback) rather than checking for NULL screen everywhere meta_display_screen_for_root is called.
Comment 9 Michael Trausch 2007-03-27 16:08:43 UTC
(In reply to comment #6)
> The backtrace is pretty good here, presumably looking at display.c:1840 for the
> right metacity version would narrow it down pretty quick.
> 
> It's definitely a metacity bug if metacity crashes. A simple thing to try is
> whether metacity --replace (replace metacity with metacity) also crashes, then
> it would be simple to reproduce sans compiz, for anyone with two screens at
> least.
> 

Hello—I am the original reporter of this issue on Launchpad.

“metacity --replace” did it’s job when run from a terminal window manually, without a crash.  I am not sure where in the process this is crashing—I just know that it happens when I have the dual-head setup running.  Without the dual-head configuration, there are no crashes when Desktop Effects is enabled.
Comment 10 Malcolm Parsons 2007-04-09 16:22:25 UTC
With Ubuntu Feisty, dual head (nvidia) display:

malcolm@trillian:~$ metacity --replace &
[1] 10445
malcolm@trillian:~$ 
malcolm@trillian:~$ metacity --replace &
[2] 10461
malcolm@trillian:~$ 
[1]-  Segmentation fault      (core dumped) metacity --replace
malcolm@trillian:~$ 
malcolm@trillian:~$ compiz --replace &
[3] 10545
malcolm@trillian:~$ /usr/bin/compiz.real: glXCreateContext failed
/usr/bin/compiz.real: Failed to manage screen: 1
/usr/bin/compiz.real: Failed to load slide: /usr/share/gdm/themes/Human/ubuntu
/usr/bin/compiz.real: Failed to load slide: /usr/share/gdm/themes/Human/ubuntu.png

[2]-  Segmentation fault      (core dumped) metacity --replace
malcolm@trillian:~$ 

metacity crashes when being replaced, even by itself.
Comment 11 Elijah Newren 2007-04-09 21:33:13 UTC
Havoc, Thomas: A quick check through the code shows that many calls to meta_display_screen_for_root() are indeed followed by checks to see whether the return value is NULL.  It turns out that each and every call that isn't followed by such a check, was code written by me.  (/me starts flogging himself)

Anyway, even with extra checks to handle this, there is the question of why metacity is only managing one of the two screens, so Havoc's suggested list of steps is what we need to do.

To figure out why the screen isn't being managed, a verbose debugging log might be helpful.  Can anyone who can reproduce this bug provide one?
Comment 12 Malcolm Parsons 2007-04-09 21:48:32 UTC
Created attachment 86076 [details]
verbose debugging log

Log of metacity crashing when replaced by itself.
Comment 13 Elijah Newren 2007-04-09 23:24:37 UTC
Thanks Malcolm!  A couple snippets from the log:


Window manager: Added screen 0 (':0.0') root 0x328

Window manager: Added screen 1 (':0.1') root 0x32a

Window manager: Attempting to manage 0x3a00005
Window manager: Deciding not to manage override_redirect window 0x3a00005

EVENTS: SelectionClear on 0x3a00005  serial 4385
Window manager: Got selection clear for screen 0 on display :0.0
Window manager: Unmanaging screen 0 on display :0.0
Window manager: Grabbing display, grab count now 1

EVENTS: EnterNotify on 0x3000093: win: 0x3000093 root: 0x328 subwindow: 0x3000099 mode: NotifyNormal detail: NotifyNonlinearVirtual focus: 0 x: 19 y: 761 serial 4604


So it seems that something is definitely requesting that metacity stop managing the first screen.  And, indeed, the log ends immediately after an EnterNotify event comes showing the mouse has moved to that unmanaged screen.  What the log can't really reveal is who/what is requesting metacity to stop managing the first screen and why?
Comment 14 Malcolm Parsons 2007-04-10 13:37:47 UTC
> The crash happens when using desktop effects to run compiz

...

> What the log can't really reveal is who/what is requesting metacity to stop
> managing the first screen and why?

do you think it might possibly be compiz?
Comment 15 Elijah Newren 2007-04-10 20:23:27 UTC
I had an idea in my head that it was crashing instantly but the log made me think you started to interact with it a bit and it wasn't until you moved your mouse to a different screen that it crashed.  But maybe my mental picture was wrong (maybe EnterNotify events are sent upon launch of a window manager)?

Does this crash happen at the moment you launch compiz?  Or is it can you interact with the windows for a little while until you move your mouse to a new screen?  Does compiz support multiple screens, or is it restricted to a single screen?

Unfortunately, I don't have the graphics hardware/drivers to test.  :(
Comment 16 Malcolm Parsons 2007-04-10 21:47:58 UTC
My understanding of this bug is that when metacity is managing a dual screen display, and another window manager tries to replace it, metacity crashes.

I am not trying to run one window manager on one screen, and a different window manager on the other screen.

I have verified that metacity crashes with several different replacing window managers - compiz, fvwm, or another metacity.

If I keep the mouse still when launching fvwm, and the mouse is over the terminal window, then metacity doesn't crash and exits normally.
metacity crashes immediately when replaced by another metacity.

compiz fails to manage the second screen, but that's a compiz bug.
Both fvwm and metacity are able to replace metacity on both screens.
Comment 17 Elijah Newren 2007-04-10 21:55:49 UTC
Ah, thanks for the explanation.  That answers point 1 mentioned by Havoc to my satisfaction (find out why metacity is only managing one screen).  Makes sense to me that launching with fvwm without moving the mouse wouldn't crash metacity (fvwm is probably better than metacity about preserving stacking order, preventing EnterNotify events from being generated immediately) while metacity replacing metacity would crash.

So, now we just need to add checks around the calls to meta_display_screen_for_root.
Comment 18 Sebastien Bacher 2007-08-23 09:24:46 UTC
https://bugs.launchpad.net/ubuntu/+source/metacity/+bug/134170 is a duplicate on GNOME 2.19.90
Comment 19 Thomas Thurman 2008-07-16 22:02:17 UTC
Oh, I fixed this in the most recent unstable version.  Sorry, I should have closed this.  Well done to the Ubuntu packagers who noticed :)