Segmentation fault in opengl

Bug #721158 reported by Michka Popoff
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenFovea
New
Medium
Unassigned

Bug Description

There is a segmentation fault if you test fovea_toolbox/opengl_gtk.py through command line (with the test matrix). If called through openfovea with a random AFM file, there is no error.

The error is on line 229 in opengl.py (call to pcolor), but may be elsewhere, as segmentation faults can have multiple causes. It seems my version of matplotlib is a newer one : 0.99.3-1ubuntu1 (on ubuntu 10.10), which may be an explanation.

I have run the script through the GDB debugger, here is the complete log of the crash which may help us :

#0 0x00007fffebb09224 in __cxa_allocate_exception () from /usr/lib/libstdc++.so.6
#1 0x00007fffe81cbaf4 in py_to_agg_transformation_matrix(_object*, bool) ()
   from /usr/lib/pymodules/python2.6/matplotlib/_path.so
#2 0x00007fffe81d58fb in _path_module::update_path_extents(Py::Tuple const&) ()
   from /usr/lib/pymodules/python2.6/matplotlib/_path.so
#3 0x00007fffe81e08a7 in Py::ExtensionModule<_path_module>::invoke_method_varargs(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Py::Tuple const&) () from /usr/lib/pymodules/python2.6/matplotlib/_path.so
#4 0x00007fffe81c8480 in method_varargs_call_handler () from /usr/lib/pymodules/python2.6/matplotlib/_path.so
#5 0x00000000004a51ae in PyEval_EvalFrameEx ()
#6 0x00000000004a6bd1 in PyEval_EvalCodeEx ()
#7 0x00000000004a4d59 in PyEval_EvalFrameEx ()
#8 0x00000000004a6bd1 in PyEval_EvalCodeEx ()
#9 0x00000000004a4d59 in PyEval_EvalFrameEx ()
#10 0x00000000004a6bd1 in PyEval_EvalCodeEx ()
#11 0x00000000004a4d59 in PyEval_EvalFrameEx ()
#12 0x00000000004a6bd1 in PyEval_EvalCodeEx ()
#13 0x0000000000535c4d in ?? ()
#14 0x000000000041c9d7 in PyObject_Call ()
#15 0x00000000004a38a1 in PyEval_EvalFrameEx ()
#16 0x00000000004a6bd1 in PyEval_EvalCodeEx ()
#17 0x00000000004a4d59 in PyEval_EvalFrameEx ()
#18 0x00000000004a6bd1 in PyEval_EvalCodeEx ()
#19 0x0000000000535b50 in ?? ()
#20 0x000000000041c9d7 in PyObject_Call ()
#21 0x000000000042570f in ?? ()
#22 0x000000000041c9d7 in PyObject_Call ()
#23 0x000000000047552f in ?? ()
#24 0x000000000046cd9f in ?? ()
#25 0x000000000041c9d7 in PyObject_Call ()
#26 0x00000000004a48c8 in PyEval_EvalFrameEx ()
#27 0x00000000004a6bd1 in PyEval_EvalCodeEx ()
#28 0x0000000000535c4d in ?? ()
#29 0x000000000041c9d7 in PyObject_Call ()
#30 0x000000000042570f in ?? ()
#31 0x000000000041c9d7 in PyObject_Call ()
#32 0x000000000047552f in ?? ()
#33 0x000000000046cd9f in ?? ()
#34 0x000000000041c9d7 in PyObject_Call ()
#35 0x00000000004a48c8 in PyEval_EvalFrameEx ()
#36 0x00000000004a6bd1 in PyEval_EvalCodeEx ()
#37 0x00000000004a4d59 in PyEval_EvalFrameEx ()
#38 0x00000000004a6bd1 in PyEval_EvalCodeEx ()
#39 0x00000000004a6ca2 in PyEval_EvalCode ()
#40 0x00000000004c702e in PyRun_FileExFlags ()
#41 0x00000000004c7244 in PyRun_SimpleFileExFlags ()
#42 0x00000000004180c1 in Py_Main ()
#43 0x00007ffff69dad8e in __libc_start_main () from /lib/libc.so.6
#44 0x00000000004172c9 in _start ()

Changed in openfovea:
importance: Undecided → Medium
Revision history for this message
Michka Popoff (michkapopoff) wrote :

I was able to make a minimalist test case for this bug :

import numpy
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
from matplotlib.pylab import pcolor
pcolor(numpy.array([[1, 1],[1, 1]]))

The segfault disappears if I put the 3 OpenGL imports after the matplotlib import !
BUT :

- If I add : from gtk.gtkgl.apputils import * at the top (before the other imports), the segfault reappears.
- If I add this line after the imports, I get a new type of error :

Traceback (most recent call last):
  File "test.py", line 12, in <module>
    pcolor(numpy.array([[1, 1],[1, 1]]))
  File "/usr/lib/pymodules/python2.6/matplotlib/pyplot.py", line 2077, in pcolor
    ax = gca()
  File "/usr/lib/pymodules/python2.6/matplotlib/pyplot.py", line 582, in gca
    ax = gcf().gca(**kwargs)
  File "/usr/lib/pymodules/python2.6/matplotlib/pyplot.py", line 276, in gcf
    return figure()
  File "/usr/lib/pymodules/python2.6/matplotlib/pyplot.py", line 254, in figure
    **kwargs)
  File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_tkagg.py", line 91, in new_figure_manager
    canvas = FigureCanvasTkAgg(figure, master=window)
  File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_tkagg.py", line 159, in __init__
    self._tkcanvas.create_image(w/2, h/2, image=self._tkphoto)
  File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 2159, in create_image
    return self._create('image', args, kw)
  File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 2150, in _create
    *(args + self._options(cnf, kw))))
_tkinter.TclError: bad screen distance "320.0"

I didn't know that the import order was important. But I think there is something really messed up in the imports.
FYI I did test the code on another PC, same thing.

Do we have the same Python Version ? I have the 2.6.6-2ubuntu2 version.

Revision history for this message
Charles Roduit (charles-roduit) wrote :

Not able to reproduce this bug in Debian testig nor in Ubuntu 10.04 LTS

I think this can be a bug in matplotlib.

Can you give your matplotlib version ?

>>> import matplotlib
>>> print matplotlib.__version__

Thanks.

In debian testing the versions are :

Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40)

OpenGL.__version__
'3.0.1b2'

matplotlib.__version__
'0.99.3'

Revision history for this message
Charles Roduit (charles-roduit) wrote :

Can you try with this :

...
import matplotlib
matplotlib.use('GTKAgg')
from matplotlib.pylab import pcolor
...

because your error tells about tkinter.

Waiting for your answers.

Revision history for this message
Michka Popoff (michkapopoff) wrote :

If I do a test in a separate file (be careful, call order of the imports seems very important !) :

from copy import deepcopy
import numpy
import matplotlib
matplotlib.use('GTKAgg')
from matplotlib.pylab import pcolor
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
from gtk.gtkgl.apputils import *
import time
pcolor(numpy.array([[1, 1],[1, 1]]))

There is no more segfault.
BUT if I put this in opengl_gtk.py, the segfault reappears ... Perhaps because there is one more call to gtk.gtkgl.apputils import * in opengl.py.

Versions are : (on my macbook pro, and a PC workstation)

Python : 2.6.6-2ubuntu2
Python-Opengl : 3.0.1 b2-1
Freeglut3 : 2.6.0-0ubuntu2
Python-matplotlib : 0.99.3-1ubunut1

Or on our MacPro with Ubuntu 10.04 LTS:
Python : 2.6.5-0ubuntu1
Python-Opengl : 3.0.0 0ubunut1
Freeglut3 : 2.6.0-0ubuntu2
Python-matplotlib : 0.99.1.2-3ubunut1

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.