Bug 37177 - Mathematica Plot3D Crash
Summary: Mathematica Plot3D Crash
Status: RESOLVED MOVED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i915 (show other bugs)
Version: git
Hardware: All Linux (All)
: medium normal
Assignee: Ian Romanick
QA Contact:
URL:
Whiteboard:
Keywords:
: 46413 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-05-13 06:42 UTC by Ivan Iakoupov
Modified: 2019-09-18 19:33 UTC (History)
8 users (show)

See Also:
i915 platform:
i915 features:


Attachments
To be used with glretrace (400.11 KB, application/octet-stream)
2011-05-13 06:42 UTC, Ivan Iakoupov
Details

Description Ivan Iakoupov 2011-05-13 06:42:22 UTC
Created attachment 46684 [details]
To be used with glretrace

I'll try attaching apitrace file, hope it's not too big...

OpenGL renderer string: Mesa DRI Mobile Intel® GM45 Express Chipset 
OpenGL version string: 2.1 Mesa 7.11-devel (git-f247b2d)

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7775be5 in dri2InvalidateBuffers (dpy=0x7b7450, drawable=25165827) at dri2_glx.c:678
678	   struct dri2_screen *psc = (struct dri2_screen *) pdraw->psc;
(gdb) bt
#0  0x00007ffff7775be5 in dri2InvalidateBuffers (dpy=0x7b7450, drawable=25165827) at dri2_glx.c:678
#1  0x00007ffff7776a40 in DRI2WireToEvent (dpy=0x7b7450, event=0xc8f568, wire=0xb5b3f0) at dri2.c:136
#2  0x00007ffff74127d1 in _XEnq () from /usr/lib/libX11.so.6
#3  0x00007ffff740fa53 in handle_response () from /usr/lib/libX11.so.6
#4  0x00007ffff74103e0 in _XReply () from /usr/lib/libX11.so.6
#5  0x00007ffff7778261 in DRI2CopyRegion (dpy=0x7b7450, drawable=25165871, region=25165874, dest=0, src=7) at dri2.c:504
#6  0x00007ffff77753e4 in dri2_copy_drawable (priv=0x7e2950, dest=0, src=7) at dri2_glx.c:427
#7  0x00007ffff77754c2 in dri2_wait_gl (gc=0x7e8c60) at dri2_glx.c:453
#8  0x00007ffff7775547 in dri2FlushFrontBuffer (driDrawable=0x7e2a10, loaderPrivate=0x7e2950) at dri2_glx.c:468
#9  0x00007ffff47edeed in intel_flush_front (ctx=0x7ffff7fba010) at intel_context.c:202
#10 0x00007ffff47eed01 in intel_glFlush (ctx=0x7ffff7fba010) at intel_context.c:563
#11 0x00007ffff4867e1f in _mesa_flush (ctx=0x7ffff7fba010) at main/context.c:1668
#12 0x00007ffff4867f41 in _mesa_Flush () at main/context.c:1700
#13 0x00000000004fc9a8 in retrace_glXMakeCurrent (call=...) at /mnt/backup/Checkouts/apitrace/glretrace_glx.cpp:76
#14 0x00000000004fe3d4 in glretrace::retrace_call_glx (call=...) at /mnt/backup/Checkouts/apitrace/glretrace_glx.cpp:637
#15 0x0000000000507a2c in glretrace::display () at /mnt/backup/Checkouts/apitrace/glretrace_main.cpp:194
#16 0x0000000000507e72 in glretrace::main (argc=2, argv=0x7fffffffe3b8) at /mnt/backup/Checkouts/apitrace/glretrace_main.cpp:290
(gdb) print pdraw
$1 = (__GLXDRIdrawable *) 0x0
Comment 1 Ivan Iakoupov 2011-06-01 05:22:51 UTC
I did some updates: libdrm, mesa, xf86-videl-intel to recent'ish versions from master, kernel 2.6.39 (xserver is still 1.9.5 though). Now I cannot reproduce any crash with that apitrace file. I can still reliably reproduce it using Mathematica 8 itself though. Just open a new notebook. Type something like

Plot3D[Sin[x*y], {x, 0, 1}, {y, 0, 1}]

Shift+Enter to run and then rotate the resulting plot with the mouse. Upon releasing the mouse button it crashes. Backtrace is this

Program received signal SIGSEGV, Segmentation fault.
intelDRI2Flush (drawable=<value optimized out>) at intel_screen.c:111
111	   if (intel->gen < 4)
(gdb) bt
#0  intelDRI2Flush (drawable=<value optimized out>) at intel_screen.c:111
#1  0x00007f5517f51d23 in dri2SwapBuffers (pdraw=<value optimized out>, target_msc=0, divisor=0, 
    remainder=0) at dri2_glx.c:542
#2  0x0000000000a9a425 in ?? ()
#3  0x0000000000ad934b in ?? ()
#4  0x0000000000cce6d5 in ?? ()
#5  0x0000000000cd16c2 in ?? ()
#6  0x000000000044174e in ?? ()
#7  0x0000000000441c0a in ?? ()
#8  0x0000000000437bab in ?? ()
#9  0x0000000000990fc4 in ?? ()
#10 0x0000000000992084 in ?? ()
#11 0x00000000009b3d00 in ?? ()
#12 0x00000000009ec0e3 in ?? ()
#13 0x00000000009dd6fc in ?? ()
#14 0x00000000009dd900 in ?? ()
#15 0x00007f5516d5db8f in QWidget::event(QEvent*) ()
   from /home/ivan/Mathematica/8.0/SystemFiles/Libraries/Linux-x86-64/libQtGui.so.4
#16 0x00007f5516d0555f in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /home/ivan/Mathematica/8.0/SystemFiles/Libraries/Linux-x86-64/libQtGui.so.4
#17 0x00007f5516d096b7 in QApplication::notify(QObject*, QEvent*) ()
   from /home/ivan/Mathematica/8.0/SystemFiles/Libraries/Linux-x86-64/libQtGui.so.4
#18 0x00007f55166c6024 in QCoreApplication::notifyInternal(QObject*, QEvent*) ()
   from /home/ivan/Mathematica/8.0/SystemFiles/Libraries/Linux-x86-64/libQtCore.so.4
#19 0x00007f5516d08b86 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) ()
   from /home/ivan/Mathematica/8.0/SystemFiles/Libraries/Linux-x86-64/libQtGui.so.4
#20 0x00007f5516d88569 in ?? ()
   from /home/ivan/Mathematica/8.0/SystemFiles/Libraries/Linux-x86-64/libQtGui.so.4
#21 0x00007f5516d873d7 in QApplication::x11ProcessEvent(_XEvent*) ()
   from /home/ivan/Mathematica/8.0/SystemFiles/Libraries/Linux-x86-64/libQtGui.so.4
#22 0x00007f5516db0252 in ?? ()
   from /home/ivan/Mathematica/8.0/SystemFiles/Libraries/Linux-x86-64/libQtGui.so.4
#23 0x00007f55132f67ae in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#24 0x00007f55132f6f98 in g_main_context_iterate.clone.6 () from /usr/lib/libglib-2.0.so.0
#25 0x00007f55132f722d in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#26 0x00007f55166f0705 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /home/ivan/Mathematica/8.0/SystemFiles/Libraries/Linux-x86-64/libQtCore.so.4
#27 0x00007f5516db007f in ?? ()
   from /home/ivan/Mathematica/8.0/SystemFiles/Libraries/Linux-x86-64/libQtGui.so.4
#28 0x00007f55166c73ac in QCoreApplication::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /home/ivan/Mathematica/8.0/SystemFiles/Libraries/Linux-x86-64/libQtCore.so.4
#29 0x00000000009e76f6 in ?? ()
#30 0x00007f5515508c7d in __libc_start_main (main=0x9e6c70, argc=3, ubp_av=0x7ffffe0f4e88, 
    init=<value optimized out>, fini=<value optimized out>, rtld_fini=<value optimized out>, 
    stack_end=0x7ffffe0f4e78) at libc-start.c:226
#31 0x000000000042cfca in ?? ()
#32 0x00007ffffe0f4e78 in ?? ()
#33 0x000000000000001c in ?? ()
#34 0x0000000000000003 in ?? ()
#35 0x00007ffffe0f634d in ?? ()
#36 0x00007ffffe0f639f in ?? ()
#37 0x00007ffffe0f63ad in ?? ()
#38 0x0000000000000000 in ?? ()

It seems that somehow "GET_CURRENT_CONTEXT(ctx)" a couple of lines above gets a NULL ctx.
Comment 2 Ivan Iakoupov 2011-06-01 05:44:08 UTC
Also running with LIBGL_ALWAYS_SOFTWARE="True" results in errors like 

X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  11 (X_GLXSwapBuffers)
  Serial number of failed request:  92490
  Current serial number in output stream:  92493

but no crash
Comment 3 Mark van Rossum 2011-06-30 05:34:57 UTC
Confirmed for me on Fedora 15 with Mathematica 7
on VGA compatible controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 0c).
Comment 4 Ivan Iakoupov 2011-06-30 07:43:07 UTC
I did a bisect and it worked prior to this commit:

commit dea5e57861ec998cb7ee913a8819752cb9fa946b
Author: Eric Anholt
Date:   Mon Feb 14 18:57:49 2011 -0800

    intel: Use the current context rather than last bound context for a drawable.
    
    If another thread bound a context to the drawable then unbound it, the
    driContextPriv would end up NULL.
    
    With the previous two fixes, this fixes glx-multithread-makecurrent-2,
    despite the issue not being about the multithreaded makecurrent.

Currently I also get a full gpu freeze when opening a document with a Plot3D with mesa master so this bug gets hidden by that one. I'll try bisecting that freeze and file a new bug report.
Comment 5 Garrett Mitchener 2011-08-02 11:35:33 UTC
I discovered this today on my EEE PC netbook, Intel 945GME graphics controller.  I'm running Fedora 15, XFCE, and mathematica 8 on this netbook: Rotating a 3-D graphic crashes as soon as you let go with the mouse.  I don't see this problem on my Fedora 15 workstation which has a radeon graphics controller.  I just ran yum update (August 2, 2011) but it's still crashing with a segmentation fault and a message about contacting Wolfram about SIGSEGV.
Comment 6 Jason Tibbitts 2011-08-09 11:48:23 UTC
I'm seeing this in Fedora 15 across a range of Intel-based machines, from i945 up through Sandy Bridge kit.  I've moved up to the 3.0.1 kernel, server 1.10.99.1 and Intel driver to 2.15.901 but no luck.  LIBGL_ALWAYS_SOFTWARE=True works as expected.

If anyone has any tips, patches, whatnot, I'm willing to try things out.  Unfortunately I haven't even figured out how to get a backtrace out of mathematica yet so I'm a long way from understanding how to work on this myself, but I can apply patches and rebuild things.
Comment 7 Garrett Mitchener 2011-11-10 07:55:51 UTC
Still seeing this as of November 10, 2011.

Fedora 15
EEE PC
mesa packages all version 7.11
Comment 8 Sean Lawton 2011-11-14 17:00:22 UTC
As of Nov. 14th, this is still a bug.  I just switched to FC15 from FC13 where this problem did NOT exist.
Comment 9 Garrett Mitchener 2011-11-15 06:12:21 UTC
Also present in Fedora 16.
Comment 10 Sean Lawton 2011-12-07 21:52:15 UTC
Has this been assigned to someone?  Is there someone contacting Mathematica about this?
Comment 11 Sean Lawton 2011-12-13 13:31:51 UTC
Is this bug related to any other bugs?  

I have not been able to find anything else, but I doubt it is a Mathematica issue since Mathematica works fine on my FC15 and FC16 systems that do not use intel graphics.

Can anyone find a similar problem with rotating a 3D image crashing outside of Mathematica?
Comment 12 Jason Tibbitts 2011-12-13 13:39:56 UTC
When I chatted with ajax about this on IRC come months ago, he indicated that it was related to a little-used feature of being able to call some GLX functions without a context:

[Tuesday 09 August 2011] [12:48:22] <ajax>      it looks, from that trace, like mathematica is using one of the brain-dead-stupidest glx features
[Tuesday 09 August 2011] [12:48:44] <ajax>      where you can issue swapbuffers on a drawable even if you don't have a glx context, or if you have one but that drawable isn't bound to it.

It _should_ be possible to recreate the circumstances of the crash outside Mathematica, but it would take a far more experienced X programmer than I.

Alternately, I am willing to do pretty much whatever is within my power to help get this fixed, including tweaking code, doing builds, providing access to a machine and software or obtaining a mathematica license for a developer.  But to be honest I don't this even has the attention of any developers who could fix it, and I'm not sure how to get their attention.
Comment 13 Samuel Cavazos 2011-12-22 09:57:57 UTC
I contacted Mathematica about the issue. They suggested running the command "mathematica -mesa" from the terminal. Works, but is painstakingly slow.
Comment 14 Elizabeth 2017-10-27 20:13:02 UTC
Hello, any update on this with latest SW? Otherwise closing soon. Thank you.
Comment 15 Elizabeth 2017-10-27 20:16:02 UTC
*** Bug 46413 has been marked as a duplicate of this bug. ***
Comment 16 Jason Tibbitts 2017-10-27 20:34:34 UTC
I had forgotten all about this bug.  I know I worked around it with LIGBL_ALWAYS_SOFTWARE but at some point in the past year or so I had forgotten why I added it.  Tested without it and everything seemed to be fine so I removed it from all of my machines.  I haven't noticed any user outcry about mathematica problems over the past several months so it does appear to be working OK.

That's on Fedora 26 with 4.13 kernels, xorg 1.19.3 and some snapshot of the Intel DDX from 2016 (xorg-x11-drv-intel-2.99.917-28.20160929.fc26.x86_64 if it matters), and mathematica 11.
Comment 17 GitLab Migration User 2019-09-18 19:33:43 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/693.


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.