Bug 41124

Summary: Xorg crashes while resizing OpenGL windows
Product: xorg Reporter: Michal Suchanek <hramrach>
Component: Server/Ext/GLXAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED WORKSFORME QA Contact: Xorg Project Team <xorg-team>
Severity: blocker    
Priority: high CC: jeremyhu, matthieu.herrb
Version: 7.6 (2010.12)Keywords: regression
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard: 2012BRB_Reviewed
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 40982, 44202    
Attachments:
Description Flags
stack trace
none
st/dri: Guard against NULL drawable
none
stack trace with glx module
none
st/dri: Guard against NULL drawable (v2)
none
backtrace with the new patch none

Description Michal Suchanek 2011-09-22 09:58:26 UTC
To reproduce:

0) Download and build piglit (OpenGL test suite runninng many small OpenGL programs); install dwm or other tiling window manager

1) run X with a tiling window manager (eg dwm)

2) make sure you are in tiling mode - run two terminals and they should appear side by side (or one below other)

3) run piglit from each 

./piglit-run.py tests/all.test results/all.1

./piglit-run.py tests/all.test results/all.2


watch the X server crash in a few minutes.

X server 1.10.4
card: r600 or Evergreen

Backtrace:
0: Xorg (xorg_backtrace+0x26) [0x4618e6]
1: Xorg (0x400000+0x65d09) [0x465d09]
2: /lib/x86_64-linux-gnu/libpthread.so.0 (0x7fe615c54000+0xf020) [0x7fe615c63020]
3: /usr/lib/x86_64-linux-gnu/dri/r600_dri.so (0x7fe611bce000+0x45931) [0x7fe611c13931]
4: /usr/lib/xorg/modules/extensions/libdri2.so (0x7fe612bc3000+0x1ab2) [0x7fe612bc4ab2]
5: /usr/lib/xorg/modules/extensions/libdri2.so (0x7fe612bc3000+0x1b87) [0x7fe612bc4b87]
6: Xorg (0x400000+0xa7c93) [0x4a7c93]
7: Xorg (ConfigureWindow+0x222) [0x457352]
8: Xorg (0x400000+0x2d99b) [0x42d99b]
9: Xorg (0x400000+0x32ee9) [0x432ee9]
10: Xorg (0x400000+0x26ffe) [0x426ffe]
11: /lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+0xfd) [0x7fe614991ead]
12: Xorg (0x400000+0x272ed) [0x4272ed]
Segmentation fault at address 0x4d
Comment 1 Alex Deucher 2011-09-22 10:56:53 UTC
Can you install debugging symbols and get a proper backtrace with gdb?
Comment 2 Michal Suchanek 2011-09-23 04:20:11 UTC
Created attachment 51539 [details]
stack trace

X.Org X Server 1.11.0
Release Date: 2011-08-26
X Protocol Version 11, Revision 0
Build Operating System: Linux 3.0.0-1-amd64 x86_64 Debian
Build Date: 28 August 2011  10:58:30AM
xorg-server 2:1.11.0-1 (Cyril Brulebois <kibi@debian.org>) 
Current version of pixman: 0.22.2
Comment 3 Michel Dänzer 2011-09-29 10:55:32 UTC
Created attachment 51770 [details] [review]
st/dri: Guard against NULL drawable

Does this Mesa patch fix the problem?

P.S. Are you running piglit with indirect rendering on purpose?
Comment 4 Michal Suchanek 2011-09-30 06:16:43 UTC
I am running with direct rendering enabled:

libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/tls/r600_dri.so
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /root/.drirc: No such file or directory.
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /root/.drirc: No such file or directory.
name of display: :1.0
display: :1  screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4

Backtrace:
0: X (xorg_backtrace+0x26) [0x5689d6]
1: X (0x400000+0x16c5c9) [0x56c5c9]
2: /lib/x86_64-linux-gnu/libpthread.so.0 (0x7fe049340000+0xf020) [0x7fe04934f020]
3: /usr/lib/x86_64-linux-gnu/dri/r600_dri.so (0x7fe0452bd000+0x45755) [0x7fe045302755]
4: /usr/lib/xorg/modules/extensions/libdri2.so (0x7fe0462b0000+0x1aca) [0x7fe0462b1aca]
5: /usr/lib/xorg/modules/extensions/libdri2.so (0x7fe0462b0000+0x1b97) [0x7fe0462b1b97]
6: X (0x400000+0xbc783) [0x4bc783]
7: X (ConfigureWindow+0x222) [0x45e2d2]
8: X (0x400000+0x3257b) [0x43257b]
9: X (0x400000+0x37ae9) [0x437ae9]
10: X (0x400000+0x26eaa) [0x426eaa]
11: /lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+0xfd) [0x7fe04807dead]
12: X (0x400000+0x2719d) [0x42719d]
Segmentation fault at address (nil)
Comment 5 Michal Suchanek 2011-09-30 06:24:01 UTC
The patch does not seem to make any difference unless the X server needs to load the patched mesa somehow.

I run only the application with LD_LIBRARY_PATH.

unpatched:


Backtrace:
0: X (xorg_backtrace+0x26) [0x5689d6]
1: X (0x400000+0x16c5c9) [0x56c5c9]
2: /lib/x86_64-linux-gnu/libpthread.so.0 (0x7f1fa6277000+0xf020) [0x7f1fa6286020]
3: /usr/lib/xorg/modules/extensions/libglx.so (0x7f1fa3a0a000+0x3e124) [0x7f1fa3a48124]
4: /usr/lib/xorg/modules/extensions/libdri2.so (0x7f1fa31e7000+0x1aca) [0x7f1fa31e8aca]
5: /usr/lib/xorg/modules/extensions/libdri2.so (0x7f1fa31e7000+0x1b97) [0x7f1fa31e8b97]
6: X (0x400000+0xbc783) [0x4bc783]
7: X (ConfigureWindow+0x222) [0x45e2d2]
8: X (0x400000+0x3257b) [0x43257b]
9: X (0x400000+0x37ae9) [0x437ae9]
10: X (0x400000+0x26eaa) [0x426eaa]
11: /lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+0xfd) [0x7f1fa4fb4ead]
12: X (0x400000+0x2719d) [0x42719d]
Segmentation fault at address 0xa8


patched:

Backtrace:
0: X (xorg_backtrace+0x26) [0x5689d6]
1: X (0x400000+0x16c5c9) [0x56c5c9]
2: /lib/x86_64-linux-gnu/libpthread.so.0 (0x7f264a877000+0xf020) [0x7f264a886020]
3: /usr/lib/xorg/modules/extensions/libglx.so (0x7f264800a000+0x3e124) [0x7f2648048124]
4: /usr/lib/xorg/modules/extensions/libdri2.so (0x7f26477e7000+0x1aca) [0x7f26477e8aca]
5: /usr/lib/xorg/modules/extensions/libdri2.so (0x7f26477e7000+0x1b97) [0x7f26477e8b97]
6: X (0x400000+0xbc783) [0x4bc783]
7: X (ConfigureWindow+0x222) [0x45e2d2]
8: X (0x400000+0x3257b) [0x43257b]
9: X (0x400000+0x37ae9) [0x437ae9]
10: X (0x400000+0x26eaa) [0x426eaa]
11: /lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+0xfd) [0x7f26495b4ead]
12: X (0x400000+0x2719d) [0x42719d]
Segmentation fault at address (nil)
Comment 6 Michel Dänzer 2011-09-30 06:42:18 UTC
(In reply to comment #5)
> The patch does not seem to make any difference unless the X server needs to
> load the patched mesa somehow.

It does.

(In reply to comment #4)
> I am running with direct rendering enabled:

The crash can only happen with indirect rendering, so at least some OpenGL app(s) end up using indirect rendering or you.
Comment 7 Michal Suchanek 2011-09-30 06:55:41 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > The patch does not seem to make any difference unless the X server needs to
> > load the patched mesa somehow.
> 
> It does.

Running the X server with LD_LIBRARY_PATH set to the patched mesa does not make a difference either.

> 
> (In reply to comment #4)
> > I am running with direct rendering enabled:
> 
> The crash can only happen with indirect rendering, so at least some OpenGL
> app(s) end up using indirect rendering or you.

Then it is a bug in itself that some applications use indirect rendering at random.
Comment 8 Michel Dänzer 2011-09-30 07:01:43 UTC
(In reply to comment #7)
> Running the X server with LD_LIBRARY_PATH set to the patched mesa does not make
> a difference either.

Did you check the log file that it actually loaded the patched r600_dri.so?


> Then it is a bug in itself that some applications use indirect rendering at
> random.

More likely a configuration/setup issue.
Comment 9 Michel Dänzer 2011-09-30 07:03:42 UTC
(In reply to comment #8)
> More likely a configuration/setup issue.

Or maybe some piglit tests force indirect rendering.
Comment 10 Michal Suchanek 2011-09-30 07:32:43 UTC
I copied the patched libraries over the system libraries and the X server still crashes.

It might be crashing in different place, though. The original stack trace does not seem to include the glx module.
Comment 11 Michal Suchanek 2011-09-30 07:49:41 UTC
Created attachment 51796 [details]
stack trace with glx module
Comment 12 Michel Dänzer 2011-09-30 07:59:15 UTC
Created attachment 51797 [details] [review]
st/dri: Guard against NULL drawable (v2)

How about this patch instead?
Comment 13 Michal Suchanek 2011-09-30 08:41:04 UTC
Created attachment 51800 [details]
backtrace with the new patch

still crashes in glx
Comment 14 Michel Dänzer 2011-09-30 09:20:01 UTC
Looks like an xserver GLX/DRI2 issue then.
Comment 15 Michal Suchanek 2011-09-30 09:39:33 UTC
Looking at the test logs it seems one of the tests running at the time X crashed was a glx (=possibly indirect) test.

So it might be that X server fails at running indirect applications together with direct applications (possibly after some non-trivial number of attempts).
Comment 16 Jeremy Huddleston Sequoia 2011-10-02 13:54:30 UTC
I expect that this is still an issue in 1.11.1, but can you please confirm.  
Thanks.
Comment 17 Michal Suchanek 2011-10-03 00:21:35 UTC
yes, the last stack traces were with 1.11.1
Comment 18 Michal Suchanek 2012-06-15 07:40:06 UTC
cannot reproduce with X server 1.12.2/mesa 8.1-dev

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.