
After pulling in a few recent patches I've been having problems with xmonad crashing when I close windows from Thunderbird. I haven't extensively tested whether there are other applications that this happens with. xmonad dies with the following information. I'm compiling with ghc 6.6 on Linux. Let me know if there is some additional information that I can provide. Xlib: extension "XINERAMA" missing on display ":0.0". test: 24: /home/geoffw/.dmenu_cache: unexpected operator test: 24: /home/geoffw/.dmenu_cache: unexpected operator test: 24: /home/geoffw/.dmenu_cache: unexpected operator *** glibc detected *** /home/geoffw/bin/xmonad: free(): invalid pointer: 0x0818d7a4 *** ======= Backtrace: ========= /lib/tls/i686/cmov/libc.so.6[0xb7d637cd] /lib/tls/i686/cmov/libc.so.6(cfree+0x90)[0xb7d66e30] /usr/lib/libX11.so.6(XFree+0x1d)[0xb7efbdbd] /home/geoffw/bin/xmonad[0x80b0be8] ======= Memory map: ======== 08048000-0818b000 r-xp 00000000 03:03 3604679 /home/geoffw/bin/xmonad 0818b000-0819c000 rwxp 00143000 03:03 3604679 /home/geoffw/bin/xmonad 0819c000-081e0000 rwxp 0819c000 00:00 0 [heap] b7900000-b7921000 rwxp b7900000 00:00 0 b7921000-b7a00000 ---p b7921000 00:00 0 b7b00000-b7c00000 rwxp b7b00000 00:00 0 b7c0d000-b7c18000 r-xp 00000000 03:03 2900764 /lib/libgcc_s.so.1 b7c18000-b7c19000 rwxp 0000a000 03:03 2900764 /lib/libgcc_s.so.1 b7c19000-b7cda000 r-xs 00000000 00:08 311820296 /SYSV00000000 (deleted) b7cda000-b7cdc000 rwxp b7cda000 00:00 0 b7cdc000-b7cef000 r-xp 00000000 03:03 2900078 /lib/tls/i686/cmov/libpthread-2.5.so b7cef000-b7cf1000 rwxp 00013000 03:03 2900078 /lib/tls/i686/cmov/libpthread-2.5.so b7cf1000-b7cf3000 rwxp b7cf1000 00:00 0 b7cf3000-b7cf7000 r-xp 00000000 03:03 2311161 /usr/lib/libXdmcp.so.6.0.0 b7cf7000-b7cf8000 rwxp 00003000 03:03 2311161 /usr/lib/libXdmcp.so.6.0.0 b7cf8000-b7cfa000 r-xp 00000000 03:03 2311140 /usr/lib/libXau.so.6.0.0 b7cfa000-b7cfb000 rwxp 00001000 03:03 2311140 /usr/lib/libXau.so.6.0.0 b7cfb000-b7cfc000 rwxp b7cfb000 00:00 0 b7cfc000-b7e37000 r-xp 00000000 03:03 2900016 /lib/tls/i686/cmov/libc-2.5.so b7e37000-b7e38000 r-xp 0013b000 03:03 2900016 /lib/tls/i686/cmov/libc-2.5.so b7e38000-b7e3a000 rwxp 0013c000 03:03 2900016 /lib/tls/i686/cmov/libc-2.5.so b7e3a000-b7e3d000 rwxp b7e3a000 00:00 0 b7e3d000-b7e44000 r-xp 00000000 03:03 2900080 /lib/tls/i686/cmov/librt-2.5.so b7e44000-b7e46000 rwxp 00006000 03:03 2900080 /lib/tls/i686/cmov/librt-2.5.so b7e46000-b7e8a000 r-xp 00000000 03:03 2310430 /usr/lib/libgmp.so.3.4.1 b7e8a000-b7e8b000 rwxp 00044000 03:03 2310430 /usr/lib/libgmp.so.3.4.1 b7e8b000-b7eb0000 r-xp 00000000 03:03 2900043 /lib/tls/i686/cmov/libm-2.5.so b7eb0000-b7eb2000 rwxp 00024000 03:03 2900043 /lib/tls/i686/cmov/libm-2.5.so b7eb2000-b7ebf000 r-xp 00000000 03:03 2314013 /usr/lib/libXext.so.6.4.0 b7ebf000-b7ec0000 rwxp 0000d000 03:03 2314013 /usr/lib/libXext.so.6.4.0 b7ec0000-b7fad000 r-xp 00000000 03:03 2311650 /usr/lib/libX11.so.6.2.0 b7fad000-b7fb1000 rwxp 000ed000 03:03 2311650 /usr/lib/libX11.so.6.2.0 b7fb1000-b7fb2000 rwxp b7fb1000 00:00 0 b7fb2000-b7fb4000 r-xp 00000000 03:03 2311665 /usr/lib/libXinerama.so.1.0.0 b7fb4000-b7fb5000 rwxp 00001000 03:03 2311665 /usr/lib/libXinerama.so.1.0.0 b7fb5000-b7fb7000 r-xp 00000000 03:03 2900041 /lib/tls/i686/cmov/libdl-2.5.so b7fb7000-b7fb9000 rwxp 00001000 03:03 2900041 /lib/tls/i686/cmov/libdl-2.5.so b7fd0000-b7fd2000 rwxp b7fd0000 00:00 0 b7fd2000-b7feb000 r-xp 00000000 03:03 2900027 /lib/ld-2.5.so b7feb000-b7fed000 rwxp 00019000 03:03 2900027 /lib/ld-2.5.so bfc41000-bfc58000 rwxp bfc41000 00:00 0 [stack] ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso] The application 'Gecko' lost its connection to the display :0.0; most likely the X server was shut down or you killed/destroyed the application. The application 'Gecko' lost its connection to the display :0.0; most likely the X server was shut down or you killed/destroyed the application. The application 'Gecko' lost its connection to the display :0.0; most likely the X server was shut down or you killed/destroyed the application. Xlib: extension "XINERAMA" missing on display ":0.0". test: 24: /home/geoffw/.dmenu_cache: unexpected operator

On Mon, Jul 09, 2007 at 12:06:55AM -0400, Geoffrey Alan Washburn wrote:
After pulling in a few recent patches I've been having problems with xmonad crashing when I close windows from Thunderbird. I haven't extensively tested whether there are other applications that this happens with. xmonad dies with the following information. I'm compiling with ghc 6.6 on Linux. Let me know if there is some additional information that I can provide.
Very interesting! Auditing the uses of XFree in xmonad/X11-extras, I see some very fishy code... queryTree :: Display -> Window -> IO (Window, Window, [Window]) queryTree d w = alloca $ \root_return -> alloca $ \parent_return -> alloca $ \children_return -> alloca $ \nchildren_return -> do xQueryTree d w root_return parent_return children_return nchildren_return p <- peek children_return n <- fmap fromIntegral $ peek nchildren_return ws <- peekArray n p xFree p liftM3 (,,) (peek root_return) (peek parent_return) (return ws) This specifically looks like the culprit - there's no check for xQueryTree succeeding, so if things race wrong (quite plausable if you're closing windows!) the pointer will be freed without being initialized. Due to subtleties of the GHC storage manager, uninitialized alloca'd memory almost certainly contains pointers into the Haskell heap - which is where your "invalid pointer" points. If you change that code in X11-extras (Graphics/X11/Xlib/Extras.hsc) to: queryTree :: Display -> Window -> IO (Window, Window, [Window]) queryTree d w = alloca $ \root_return -> alloca $ \parent_return -> alloca $ \children_return -> alloca $ \nchildren_return -> do status <- xQueryTree d w root_return parent_return children_return nchildren_return if status == 0 then return (none, none, []) -- we ought to throw an -- exception here... else do p <- peek children_return n <- fmap fromIntegral $ peek nchildren_return ws <- peekArray n p xFree p liftM3 (,,) (peek root_return) (peek parent_return) (return ws) can you still reproduce it? Stefan

On Sun, 8 Jul 2007 21:48:55 -0700
"Stefan O'Rear"
On Mon, Jul 09, 2007 at 12:06:55AM -0400, Geoffrey Alan Washburn wrote:
After pulling in a few recent patches I've been having problems with xmonad crashing when I close windows from Thunderbird. I haven't extensively tested whether there are other applications that this happens with. xmonad dies with the following information. I'm compiling with ghc 6.6 on Linux. Let me know if there is some additional information that I can provide.
Very interesting! Auditing the uses of XFree in xmonad/X11-extras, I see some very fishy code...
queryTree :: Display -> Window -> IO (Window, Window, [Window]) queryTree d w = alloca $ \root_return -> alloca $ \parent_return -> alloca $ \children_return -> alloca $ \nchildren_return -> do xQueryTree d w root_return parent_return children_return nchildren_return p <- peek children_return n <- fmap fromIntegral $ peek nchildren_return ws <- peekArray n p xFree p liftM3 (,,) (peek root_return) (peek parent_return) (return ws)
This specifically looks like the culprit - there's no check for xQueryTree succeeding, so if things race wrong (quite plausable if you're closing windows!) the pointer will be freed without being initialized. Due to subtleties of the GHC storage manager, uninitialized alloca'd memory almost certainly contains pointers into the Haskell heap - which is where your "invalid pointer" points.
If you change that code in X11-extras (Graphics/X11/Xlib/Extras.hsc) to:
queryTree :: Display -> Window -> IO (Window, Window, [Window]) queryTree d w = alloca $ \root_return -> alloca $ \parent_return -> alloca $ \children_return -> alloca $ \nchildren_return -> do status <- xQueryTree d w root_return parent_return children_return nchildren_return if status == 0 then return (none, none, []) -- we ought to throw an -- exception here... else do p <- peek children_return n <- fmap fromIntegral $ peek nchildren_return ws <- peekArray n p xFree p liftM3 (,,) (peek root_return) (peek parent_return) (return ws)
can you still reproduce it?
Stefan
queryTree is only run once, at start up. It seems unlikely that this is causing the described issue. Cheers, Spencer Janssen

On Tue, Jul 10, 2007 at 09:49:28AM -0400, Geoffrey Alan Washburn wrote:
Spencer Janssen wrote:
queryTree is only run once, at start up. It seems unlikely that this is causing the described issue.
Indeed, further testing indicates that it only occurs when I am using the Tabbed layout.
I cannot reproduce it here. Can you give me instructions to reproduce it with Tabbed and Thuderbird? I tried closing secondary windows, but XMonad never crashes. Thanks Andrea

Andrea Rossato wrote:
I cannot reproduce it here. Can you give me instructions to reproduce it with Tabbed and Thuderbird? I tried closing secondary windows, but XMonad never crashes.
I've attached my Config.hs file to this e-mail. Other than a custom configuration input for the tabbed layout, changing which programs "Alt-Shift-Enter" and "Alt-p" execute, and having a tabbed layout as my only layout, it is mostly the same as the stock version. My .xinitrc looks like the following: #!/usr/bin/env zsh echo "Running on $HOST @ `date`" >>& ~/xmonad.log exec ssh-agent ~/bin/xmonad >>& ~/xmonad.log Upon logging in via gdm, I (1) hit "Alt-p" to open dmenu, (2) type in "thunderbird", (3) once Thunderbird is open, double click on the first message in my inbox (and made sure to send myself mail beforehand if it were to be empty). This opens up a second window, (4) hit "Alt-Shift-c" And the session dies returning me to gdm. This is the contents of the generated xmonad.log: Running on babylon @ Tue Jul 10 13:18:30 EDT 2007 Xlib: extension "XINERAMA" missing on display ":0.0". The application 'Gecko' lost its connection to the display :0.0; most likely the X server was shut down or you killed/destroyed the application. Before running the above test I made sure I had pulled all the latest xmonad and xmonadcontrib patches. I'm building with GHC 6.6 installed on Ubuntu Linux through the package system.

On Tue, Jul 10, 2007 at 01:33:20PM -0400, Geoffrey Alan Washburn wrote:
Upon logging in via gdm, I (1) hit "Alt-p" to open dmenu, (2) type in "thunderbird", (3) once Thunderbird is open, double click on the first message in my inbox (and made sure to send myself mail beforehand if it were to be empty). This opens up a second window, (4) hit "Alt-Shift-c" And the session dies returning me to gdm.
With only 2 differences: I do not have the fonts you are using for Tabs and I do not run gdm. Anyway, I cannot reproduce with these steps: XMoban keeps on running. These steps always lead to a crash of the X server? It could be related to something else? The log doesn't tell anything, unluckily.
Before running the above test I made sure I had pulled all the latest xmonad and xmonadcontrib patches. I'm building with GHC 6.6 installed on Ubuntu Linux through the package system.
running 6.6.1 but I hardly believe this is the issue. Hope someone comes up with a way to reproduce it regularly. For the time being there's very little I can do. (Anyway I don't see where a bug that could make X crash can be hidden in Tabbed.hs. I've been able to make X die quite a few time when hacking that code, so I should have a bit of experience...;-) All the best, Andrea

Andrea Rossato wrote:
With only 2 differences: I do not have the fonts you are using for Tabs and I do not run gdm. Anyway, I cannot reproduce with these steps: XMoban keeps on running.
I can look into testing with the default font and without using gdm, but I suspect that it will not really make much of a difference.
These steps always lead to a crash of the X server?
Yes.
It could be related to something else? The log doesn't tell anything, unluckily.
Well, it would have to be something really strange. I can reliably reproduce the problem while running xmonad with the tabbed layout; so reliably I've had to switch back to using ion3. However, when running ion3 and xmonad without the tabbed layout it never happens (or at least it has not occurred yet for a sample size of a few hours).
Before running the above test I made sure I had pulled all the latest xmonad and xmonadcontrib patches. I'm building with GHC 6.6 installed on Ubuntu Linux through the package system.
running 6.6.1 but I hardly believe this is the issue.
Hope someone comes up with a way to reproduce it regularly. For the time being there's very little I can do.
Is there some kind of tracing that I could be doing that would provide more information?
(Anyway I don't see where a bug that could make X crash can be hidden in Tabbed.hs. I've been able to make X die quite a few time when hacking that code, so I should have a bit of experience...;-)
Yeah, it doesn't seem very plausible to me either, which is why I didn't think to try testing without the tabbed layout until this morning. But given that I am not running any software that interacts with the X server, other than Thunderbird and xmonad, one would like to think that it is reasonable to conclude problem is with one of the two. Given that Thunderbird does not exhibit problems when running under ion3 and without the tabbed layout, I am giving it the benefit of the doubt that the problem lies somewhere in xmonad. However, it is entirely possible that both Thunderbird and xmonad are implemented entirely correctly, and that somehow when tabbed layout is used with Thunderbird it just manages to exercise some obscure corner case in my X server.

Andrea Rossato
Indeed, further testing indicates that it only occurs when I am using the Tabbed layout.
I think it's the same here, but I'm not exactly sure.
I cannot reproduce it here. Can you give me instructions to reproduce it with Tabbed and Thuderbird?
It's really hard to reproduce. Yesterday xmonad crashed about 4 or 5 times, today (with a new checkout made this morning (CEST)) it crashed only once. It always happened after I closed a conkeror frame, but now that I'm creating and deleting frames like mad, it stays alive without problems. Bye, Tassilo -- People say that if you play Microsoft CD's backwards, you hear satanic things, but that's nothing, because if you play them forwards, they install Windows.

On Tue, Jul 10, 2007 at 08:11:02PM +0200, Tassilo Horn wrote:
Indeed, further testing indicates that it only occurs when I am using the Tabbed layout.
I think it's the same here, but I'm not exactly sure.
I'd like to add my voice and report that I've been experiencing intermittent crashing too, as of the last few days (perhaps since the weekend?). I'll investigate further later and try to pin it down a bit more but roughly: - ghc 6.6, latest everything from darcs - Tabbed layout - xdm not gdm - gajim and jpilot both seem particularly keen culprits. Often/sometimes when closing a window belonging to either of these apps using Shift-Mod-C I get kicked out. I might only be seeing it with these apps because in other apps (eg xterm), I tend not to close/kill the window from xmonad, but rather exit the app from within itself (eg Ctrl-D in an xterm, File/Quit in Firefox, etc.); it does _seem_ to be related to killing from xmonad. - .xsession-errors contains similar errors to those reported just earlier ("such-and-such app lost connection to X server", though I note that "such-and-such app" in these cases is not the one which crashed, but other ones which were running - IIRC). Don't have time to go any deeper right now (and not at the crashing computer), but will try to find out more later. Cheers, -Andy -- Andy Gimblett Computer Science Department University of Wales Swansea http://www.cs.swan.ac.uk/~csandy/

A.M.Gimblett:
On Tue, Jul 10, 2007 at 08:11:02PM +0200, Tassilo Horn wrote:
Indeed, further testing indicates that it only occurs when I am using the Tabbed layout.
I think it's the same here, but I'm not exactly sure.
I'd like to add my voice and report that I've been experiencing intermittent crashing too, as of the last few days (perhaps since the weekend?). I'll investigate further later and try to pin it down a bit more but roughly:
- ghc 6.6, latest everything from darcs
- Tabbed layout
- xdm not gdm
- gajim and jpilot both seem particularly keen culprits. Often/sometimes when closing a window belonging to either of these apps using Shift-Mod-C I get kicked out. I might only be seeing it with these apps because in other apps (eg xterm), I tend not to close/kill the window from xmonad, but rather exit the app from within itself (eg Ctrl-D in an xterm, File/Quit in Firefox, etc.); it does _seem_ to be related to killing from xmonad.
- .xsession-errors contains similar errors to those reported just earlier ("such-and-such app lost connection to X server", though I note that "such-and-such app" in these cases is not the one which crashed, but other ones which were running - IIRC).
Don't have time to go any deeper right now (and not at the crashing computer), but will try to find out more later.
Cheers,
Ok, noted. We'll follow this up. -- Don

Andy Gimblett on 2007-07-11 10:39:44 +0100:
On Tue, Jul 10, 2007 at 08:11:02PM +0200, Tassilo Horn wrote:
Indeed, further testing indicates that it only occurs when I am using the Tabbed layout.
I think it's the same here, but I'm not exactly sure.
I'd like to add my voice and report that I've been experiencing intermittent crashing too, as of the last few days (perhaps since the weekend?).
I updated for the first time in several days and can reliably crash xmonad by running glxgears. I haven't run glxgears in a while, but I have run it in the past few weeks with xmonad and neither crashed. I am seeing a slightly different error, though; instead of an error on free() as in the original report, xmonad dies on a munmap_chunk: *** glibc detected *** xmonad: munmap_chunk(): invalid pointer: 0x000000000045b9c0 *** ======= Backtrace: ========= /lib/libc.so.6(cfree+0x1b6)[0x2ac3f68fe816] /usr/lib/libX11.so.6(XFree+0x9)[0x2ac3f5fee4d9] xmonad[0x478498] Additionally, this error happens if I run glxgears, not if I try to close it, as some of the others have reported. When running with dwm, I don't see the same crash.

alec:
Andy Gimblett on 2007-07-11 10:39:44 +0100:
On Tue, Jul 10, 2007 at 08:11:02PM +0200, Tassilo Horn wrote:
Indeed, further testing indicates that it only occurs when I am using the Tabbed layout.
I think it's the same here, but I'm not exactly sure.
I'd like to add my voice and report that I've been experiencing intermittent crashing too, as of the last few days (perhaps since the weekend?).
I updated for the first time in several days and can reliably crash xmonad by running glxgears. I haven't run glxgears in a while, but I have run it in the past few weeks with xmonad and neither crashed.
I am seeing a slightly different error, though; instead of an error on free() as in the original report, xmonad dies on a munmap_chunk:
*** glibc detected *** xmonad: munmap_chunk(): invalid pointer: 0x000000000045b9c0 *** ======= Backtrace: ========= /lib/libc.so.6(cfree+0x1b6)[0x2ac3f68fe816] /usr/lib/libX11.so.6(XFree+0x9)[0x2ac3f5fee4d9] xmonad[0x478498]
Additionally, this error happens if I run glxgears, not if I try to close it, as some of the others have reported. When running with dwm, I don't see the same crash.
So just: $ glxgears ? Can anyone else reproduce this? -- Don

On Wednesday 11 July 2007 18:39:48 Alec Berryman wrote:
Andy Gimblett on 2007-07-11 10:39:44 +0100:
On Tue, Jul 10, 2007 at 08:11:02PM +0200, Tassilo Horn wrote:
Indeed, further testing indicates that it only occurs when I am using the Tabbed layout.
I think it's the same here, but I'm not exactly sure.
I'd like to add my voice and report that I've been experiencing intermittent crashing too, as of the last few days (perhaps since the weekend?).
I updated for the first time in several days and can reliably crash xmonad by running glxgears. I haven't run glxgears in a while, but I have run it in the past few weeks with xmonad and neither crashed.
I am seeing a slightly different error, though; instead of an error on free() as in the original report, xmonad dies on a munmap_chunk:
*** glibc detected *** xmonad: munmap_chunk(): invalid pointer: 0x000000000045b9c0 *** ======= Backtrace: ========= /lib/libc.so.6(cfree+0x1b6)[0x2ac3f68fe816] /usr/lib/libX11.so.6(XFree+0x9)[0x2ac3f5fee4d9] xmonad[0x478498]
Additionally, this error happens if I run glxgears, not if I try to close it, as some of the others have reported. When running with dwm, I don't see the same crash.
For which layouts does this occur? Just Tabbed? Every layout? We must have a double or otherwise invalid free somewhere. Cheers, Spencer Janssen

Spencer Janssen on 2007-07-11 19:11:25 -0500:
On Wednesday 11 July 2007 18:39:48 Alec Berryman wrote:
I updated for the first time in several days and can reliably crash xmonad by running glxgears. I haven't run glxgears in a while, but I have run it in the past few weeks with xmonad and neither crashed.
I am seeing a slightly different error, though; instead of an error on free() as in the original report, xmonad dies on a munmap_chunk:
*** glibc detected *** xmonad: munmap_chunk(): invalid pointer: 0x000000000045b9c0 *** ======= Backtrace: ========= /lib/libc.so.6(cfree+0x1b6)[0x2ac3f68fe816] /usr/lib/libX11.so.6(XFree+0x9)[0x2ac3f5fee4d9] xmonad[0x478498]
Additionally, this error happens if I run glxgears, not if I try to close it, as some of the others have reported. When running with dwm, I don't see the same crash.
For which layouts does this occur? Just Tabbed? Every layout? We must have a double or otherwise invalid free somewhere.
Just tabbed; I can't reproduce it using the tiled layout. To answer Don's question, yes, just fire up glxgears - you can almost see the gears before everything crashes. Works every time. I haven't seen anything similar happen with any other programs, but I don't run much besides iceweasel, urxvt, and emacs. I have reproduced this both on an amd64 with Xinerama and on an i386 without. In both cases I'm running Debian testing with ghc-6.6.1. For some reason the i386 doesn't show a message in ~/.xsession-errors like the one above from the amd64.

On Wed, Jul 11, 2007 at 08:38:47PM -0500, Alec Berryman wrote:
I have reproduced this both on an amd64 with Xinerama and on an i386 without. In both cases I'm running Debian testing with ghc-6.6.1. For some reason the i386 doesn't show a message in ~/.xsession-errors like the one above from the amd64.
ok, reproduced here too. a workaround has already been sent here. Thank you. All the best. Andrea

On Sunday 08 July 2007 23:06:55 Geoffrey Alan Washburn wrote:
After pulling in a few recent patches I've been having problems with xmonad crashing when I close windows from Thunderbird. I haven't extensively tested whether there are other applications that this happens with. xmonad dies with the following information. I'm compiling with ghc 6.6 on Linux. Let me know if there is some additional information that I can provide.
I believe this issue has been fixed with the latest version of X11-extras. Please pull the latest X11-extras patches and test. Remember, you need to 'runhaskell Setup clean' both xmonad and X11-extras, and be sure to build and install X11-extras before rebuilding xmonad. Everyone that has experienced this crash, please reply whether the fix works for you. Cheers, Spencer Janssen

Spencer Janssen
Everyone that has experienced this crash, please reply whether the fix works for you.
I didn't have any crashes since the last update, even with glxgears runing. Thanks, Tassilo -- Windows: So easy to admin, even a worm can do it.

Tassilo Horn wrote:
Spencer Janssen
writes: Hi Spencer,
Everyone that has experienced this crash, please reply whether the fix works for you.
I didn't have any crashes since the last update, even with glxgears runing.
Same here. No crashing with Thunderbird when closing windows, and no crashing with glxgears -- though I didn't test it before I applied the patches and rebuilt xmonad. Thanks!
participants (8)
-
Alec Berryman
-
Andrea Rossato
-
Andy Gimblett
-
dons@cse.unsw.edu.au
-
Geoffrey Alan Washburn
-
Spencer Janssen
-
Stefan O'Rear
-
Tassilo Horn