Segmentation fault with mlab.savefig multiple times using off_screen_rendering and resizing image #302

Closed
kitchoi opened this Issue Feb 29, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@kitchoi
Member

kitchoi commented Feb 29, 2016

I have tested VTK 5.8.0, 5.10.1, 6.2.0, 6.3.0 and only got seg faults for VTK 6.3.0

from __future__ import print_function
from mayavi import mlab


def mlab_save_figs(off_screen_rendering, **kwargs):
    for ifig in xrange(5):
        figure = mlab.figure()
        figure.scene.off_screen_rendering = off_screen_rendering

        mlab.test_contour3d()
        mlab.savefig("test{}.png".format(ifig), **kwargs)

        print("figure {} created".format(ifig))
        mlab.close()


## This is fine but the saved image dimension is different from the figure (window) size
# mlab_save_figs(True)

## This seg fault while making the second/third/... figure
# mlab_save_figs(True,  size=(100, 200))

## This won't segfault but 3/4 of the image is black
## as figure size < image size
# mlab_save_figs(False, size=(800, 700), magnification=1.0)

## This won't segfault and the image seems fine but the size is not exactly (800, 700)
# mlab_save_figs(False, size=(800, 700))

OS: Ubuntu 12.02 LTS 64bit
Branch: master

@kitchoi

This comment has been minimized.

Show comment
Hide comment
@kitchoi

kitchoi Mar 1, 2016

Member

Update: the seg fault does not occur for gui backend being wx, but does for qt4

Member

kitchoi commented Mar 1, 2016

Update: the seg fault does not occur for gui backend being wx, but does for qt4

@mdickinson

This comment has been minimized.

Show comment
Hide comment
@mdickinson

mdickinson Mar 1, 2016

Member

Do you get any sort of traceback or report that you can paste into the issue? (Enabling faulthandler might help.)

Member

mdickinson commented Mar 1, 2016

Do you get any sort of traceback or report that you can paste into the issue? (Enabling faulthandler might help.)

@kitchoi

This comment has been minimized.

Show comment
Hide comment
@kitchoi

kitchoi Mar 1, 2016

Member

Thanks for the tips, that would have saved me some 10 min doing print functions.

Here is the traceback:

Current thread 0x00007f6b4a45e700 (most recent call first):
  File "/mnt/hgfs/VM_shared/ETS/mayavi-vtk630/tvtk/pyface/ui/qt4/QVTKRenderWindowInteractor.py", line 333 in resizeEvent
  File "/mnt/hgfs/VM_shared/ETS/mayavi-vtk630/tvtk/pyface/ui/qt4/scene.py", line 57 in resizeEvent
  File "/mnt/hgfs/VM_shared/ETS/mayavi-vtk630/tvtk/pyface/ui/qt4/scene.py", line 374 in set_size
  File "/mnt/hgfs/VM_shared/ETS/mayavi-vtk630/tvtk/pyface/tvtk_scene.py", line 409 in save
  File "/mnt/hgfs/VM_shared/ETS/mayavi-vtk630/mayavi/tools/figure.py", line 248 in savefig
  File "seg_fault.py", line 16 in mlab_save_figs
  File "seg_fault.py", line 43 in <module>
Segmentation fault (core dumped)
Member

kitchoi commented Mar 1, 2016

Thanks for the tips, that would have saved me some 10 min doing print functions.

Here is the traceback:

Current thread 0x00007f6b4a45e700 (most recent call first):
  File "/mnt/hgfs/VM_shared/ETS/mayavi-vtk630/tvtk/pyface/ui/qt4/QVTKRenderWindowInteractor.py", line 333 in resizeEvent
  File "/mnt/hgfs/VM_shared/ETS/mayavi-vtk630/tvtk/pyface/ui/qt4/scene.py", line 57 in resizeEvent
  File "/mnt/hgfs/VM_shared/ETS/mayavi-vtk630/tvtk/pyface/ui/qt4/scene.py", line 374 in set_size
  File "/mnt/hgfs/VM_shared/ETS/mayavi-vtk630/tvtk/pyface/tvtk_scene.py", line 409 in save
  File "/mnt/hgfs/VM_shared/ETS/mayavi-vtk630/mayavi/tools/figure.py", line 248 in savefig
  File "seg_fault.py", line 16 in mlab_save_figs
  File "seg_fault.py", line 43 in <module>
Segmentation fault (core dumped)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment