SDL apps fail to start, and then Xmir crashes on client exit

Bug #1602561 reported by dinamic
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Libertine
Invalid
Medium
Unassigned
libsdl2 (Ubuntu)
Won't Fix
Undecided
Unassigned
Nominated for Xenial by Christopher Townsend
supertux (Ubuntu)
Invalid
Undecided
Unassigned
Nominated for Xenial by Christopher Townsend
xorg-server (Ubuntu)
Fix Released
High
Daniel van Vugt
Nominated for Xenial by Christopher Townsend

Bug Description

[Impact]

A crash in Xmir can be observed sometimes when starting particular X applications.

[Test Case]

1. Create a Libertine container and install supertux.
2. Try to run supertux.

Obverse there is no longer a crash in Xmir in /var/crash.

[Regression Potential]

None observed.

--------------------------------------
Original Description:

supertux doesn't start

Tags: xmir
Revision history for this message
dinamic (dinamic6661) wrote :
Revision history for this message
dinamic (dinamic6661) wrote :

Libertine Dbus session bridge socket is not ready. Waiting...
mbpixbuf: unable to use XShm. DISPLAY remote?
wm_set_cursor_visibility: visible using XCreateFontCursor
[FATAL] /build/supertux-7_Bg7b/supertux-0.4.0/src/supertux/main.cpp:444 Unexpected exception: Couldn't initialize SDL: No available displays
(EE)
(EE) Backtrace:
(EE) 0: Xmir (xorg_backtrace+0x4e) [0x562a70de937e]
(EE) 1: Xmir (0x562a70c48000+0x1a5709) [0x562a70ded709]
(EE) 2: /lib/x86_64-linux-gnu/libpthread.so.0 (0x7f1af9726000+0x113e0) [0x7f1af97373e0]
(EE) 3: Xmir (0x562a70c48000+0x171fc9) [0x562a70db9fc9]
(EE) 4: Xmir (0x562a70c48000+0x177bfc) [0x562a70dbfbfc]
(EE) 5: Xmir (0x562a70c48000+0x3df10) [0x562a70c85f10]
(EE) 6: Xmir (0x562a70c48000+0x3f6a0) [0x562a70c876a0]
(EE) 7: Xmir (0x562a70c48000+0x3a850) [0x562a70c82850]
(EE) 8: Xmir (0x562a70c48000+0x3ade1) [0x562a70c82de1]
(EE) 9: Xmir (0x562a70c48000+0x158487) [0x562a70da0487]
(EE) 10: Xmir (0x562a70c48000+0x10ee7c) [0x562a70d56e7c]
(EE) 11: Xmir (0x562a70c48000+0x1970ea) [0x562a70ddf0ea]
(EE) 12: Xmir (DeleteWindow+0x2a8) [0x562a70de2598]
(EE) 13: Xmir (0x562a70c48000+0x18fd62) [0x562a70dd7d62]
(EE) 14: Xmir (FreeClientResources+0x6c) [0x562a70dd8f8c]
(EE) 15: Xmir (FreeAllResources+0x47) [0x562a70dd9037]
(EE) 16: Xmir (0x562a70c48000+0x16f4d6) [0x562a70db74d6]
(EE) 17: /lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+0xf0) [0x7f1af937d7e0]
(EE) 18: Xmir (_start+0x29) [0x562a70c81459]
(EE)
(EE) Segmentation fault at address 0xb0
(EE)
Fatal server error:
(EE) Caught signal 11 (Segmentation fault). Server aborting
(EE)

Revision history for this message
Larry Price (larryprice) wrote :

Interesting - I've seen supertuxkart run on frieza, though it was unplayable. This could potentially have something to do with the nouveau drivers (https://www.phoronix.com/scan.php?page=news_item&px=MTg2NTk).

dinamic: are you running with the open-source or proprietary drivers? Does supertuxkart work in a unity 7 session on the same machine?

Stephen M. Webb (bregma)
Changed in libertine:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
dinamic (dinamic6661) wrote :

i'm using nouveau and runs on unity7, and it used to run on on xmir and native on mir (since it's just an SDL2 game), but something in the latest updates broke it (i'm using 16.10 + proposed)

mir https://www.youtube.com/watch?v=AIWGHJ7n8is
xmir https://www.youtube.com/watch?v=zFgxQSZgpFQ (oldish video), but it i run it a couple of weeks ago in xmir but not with libertine but i guess libertine does the same ...

Revision history for this message
dinamic (dinamic6661) wrote :

this is the only one that doesn't work for me, here's more apps installed with libertine https://www.youtube.com/watch?v=HDX3mC6hSks

Revision history for this message
dinamic (dinamic6661) wrote :

btw, it's not supertux kart :D it's just supertux :D (it's a diff game, hehe)

Revision history for this message
Stephen M. Webb (bregma) wrote :

For the record, I can reproduce this on Intel drivers. It appears to be a crash in x.org possibly related to cursor handling or maybe XSHM.

tags: added: xmir
Changed in xorg-server (Ubuntu):
status: New → Confirmed
importance: Undecided → High
summary: - supertux doesn't start
+ Some X apps like supertux2 now crash Xmir
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Re: Some X apps like supertux2 now crash Xmir

I've encountered half a dozen different bugs in trying to test this. Eventually I figured out how to reproduce the crash mentioned so I'll focus on that one. Suffice to say any crash of the Xmir process is probably fixable in Xmir.

Changed in xorg-server (Ubuntu):
assignee: nobody → Daniel van Vugt (vanvugt)
status: Confirmed → In Progress
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Valgrind says:

==4395== Invalid read of size 8
==4395== at 0x1419F5: xmir_handle_buffer_received (xmir.c:591)
==4395== by 0x52AEF3D: ??? (in /usr/lib/x86_64-linux-gnu/libmirclient.so.9)
==4395== by 0x52B63AE: ??? (in /usr/lib/x86_64-linux-gnu/libmirclient.so.9)
==4395== by 0x52A8BE7: ??? (in /usr/lib/x86_64-linux-gnu/libmirclient.so.9)
==4395== by 0x52B39BC: ??? (in /usr/lib/x86_64-linux-gnu/libmirclient.so.9)
==4395== by 0x52B3F48: mir_connection_release (in /usr/lib/x86_64-linux-gnu/libmirclient.so.9)
==4395== by 0x141D91: xmir_close_screen (xmir.c:1254)
==4395== by 0x1892C7: CursorCloseScreen (cursor.c:187)
==4395== by 0x20D303: AnimCurCloseScreen (animcur.c:106)
==4395== by 0x210E61: present_close_screen (present_screen.c:64)
==4395== by 0x275666: dix_main (main.c:352)
==4395== by 0x6EAD7DF: (below main) (libc-start.c:291)
==4395== Address 0x170f1a30 is 16 bytes inside a block of size 264 free'd
==4395== at 0x4C2EDEB: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4395== by 0x29E2C6: DeleteWindow (window.c:990)
==4395== by 0x294291: doFreeResource (resource.c:872)
==4395== by 0x29534B: FreeClientResources (resource.c:1138)
==4395== by 0x2953F6: FreeAllResources (resource.c:1153)
==4395== by 0x27557D: dix_main (main.c:321)
==4395== by 0x6EAD7DF: (below main) (libc-start.c:291)
==4395== Block was alloc'd at
==4395== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4395== by 0x28ED99: _dixAllocateScreenObjectWithPrivates (privates.c:712)
==4395== by 0x29BBF2: CreateRootWindow (window.c:449)
==4395== by 0x275433: dix_main (main.c:229)
==4395== by 0x6EAD7DF: (below main) (libc-start.c:291)

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

OK, there are several issues here...

1. wm_set_cursor_visibility: visible using XCreateFontCursor

Ignore that. It's just a log message from matchbox-window-manager.

2. supertux2 fails to start with:
[FATAL] /build/supertux-7_Bg7b/supertux-0.4.0/src/supertux/main.cpp:444 Unexpected exception: Couldn't initialize SDL: No available displays

That's a bug in Supertux and/or SDL for someone else to fix.

3. Xmir crashes with the above stack starting from around FreeAllResources.

That's a bug in Xmir where it will crash, but only after the last client has disconnected from the server.

So the Xmir crash is triggered by the supertux2 failure and not vice-versa. I will try to fix Xmir but that won't fix Supertux2/SDL ... someone else will need to look into that still.

summary: - Some X apps like supertux2 now crash Xmir
+ supertux2 fails to start, and then Xmir crashes on client exit
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Re: supertux2 fails to start, and then Xmir crashes on client exit

Actually #2:

[FATAL] /build/supertux-7_Bg7b/supertux-0.4.0/src/supertux/main.cpp:444 Unexpected exception: Couldn't initialize SDL: No available displays

Is probably due to an old Xmir feature/bug 1504422. That one was inherited from the previous Xmir author. I thought it was harmless (and a feature) but maybe it's not any more. What would have changed is Unity8's window management behaviour. If it just resizes the Xmir window once then it will trigger bug 1504422, which is possibly now causing Supertux2/SDL to fail to start.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

OK, half fixed.

Xmir won't crash any more:
https://git.launchpad.net/~xmir-team/xorg-server/+git/xmir/commit/?id=f72fad2cd4b8d6fbdef0335fbfa11e2ca38d3f86

But more work is required to make Supertux2 actually start...

Revision history for this message
dinamic (dinamic6661) wrote :

if i run supertux on Xmir from terminal i get this error

X Error of failed request: BadMatch (invalid parameter attributes)
  Major opcode of failed request: 7 (X_ReparentWindow)
  Serial number of failed request: 173
  Current serial number in output stream: 175

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

It's fine. I've done half the fix and will do the other half next week.

Changed in libsdl2 (Ubuntu):
status: New → Invalid
Changed in libertine:
status: Triaged → Invalid
Changed in libsdl2 (Ubuntu):
status: Invalid → Won't Fix
Changed in supertux (Ubuntu):
status: New → Won't Fix
status: Won't Fix → Invalid
Revision history for this message
Stephen M. Webb (bregma) wrote :

If I run Xmir with -rootless SuperTux2 starts and runs (with other issues, I do not believe those are relevant to this bug).

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Correct, rootless works, seemingly because that's a workaround for bug 1504422 :)

Revision history for this message
Daniel van Vugt (vanvugt) wrote :
Changed in xorg-server (Ubuntu):
status: In Progress → Fix Committed
summary: - supertux2 fails to start, and then Xmir crashes on client exit
+ SDL apps fail to start, and then Xmir crashes on client exit
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xorg-server - 2:1.18.4-1ubuntu3

---------------
xorg-server (2:1.18.4-1ubuntu3) yakkety; urgency=medium

  * debian/patches/xmir.patch:
    - Fix bottom/right edge corruption. (LP: #1510849)
    - Fix key repeat. (LP: #1591356)
    - Don't delete outputs without replacing them. (LP: #1504422) (LP: #1602561)
    - Xmir -debug: Log WM types by name and number.
    - Implement fake GLX frame notification/timing.
    - Improve focus tracking.

 -- Robert Ancell <email address hidden> Thu, 21 Jul 2016 11:42:03 +0200

Changed in xorg-server (Ubuntu):
status: Fix Committed → Fix Released
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.