mitsuba-renderer/mitsuba-blender

Segfault while exporting in Blender 2.93.18

kirilllzaitsev opened this issue · 6 comments

The exporter throws a segmentation fault when trying to export the default Blender scene.

Bug Description
Upon pressing Mitsuba export in the exporter, Blender exits with the following error:

Writing: /tmp/blender.crash.txt
[1]    66337 segmentation fault (core dumped)  ./blender-2.93.18-linux-x64/blender

To Reproduce
Steps to reproduce the behavior:

  1. Open Blender
  2. Export the default scene to Mitsuba .xml

Expected behavior
It works

Resources
Log:

# Blender 2.93.18, Commit date: 2023-05-22 12:04, Hash cb886aba06d5

# backtrace
./blender-2.93.18-linux-x64/blender(BLI_system_backtrace+0x20) [0xa599130]
./blender-2.93.18-linux-x64/blender() [0xf6072d]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7ff8f0c42520]
./blender-2.93.18-linux-x64/blender() [0x1349f29]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/libmitsuba.so(+0x33ceaf) [0x7ff8a673ceaf]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/libmitsuba.so(_ZN7mitsuba10PropertiesD1Ev+0x38) [0x7ff8a65204e8]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/plugins/diffuse.so(_ZNSt17_Function_handlerIFPN7mitsuba6ObjectERKNS0_10PropertiesEEZNS0_6detail21get_construct_functorINS0_13SmoothDiffuseIfNS0_5ColorIfLm3EEEEELi0EEESt8functionIS6_EvEUlS5_E_E9_M_invokeERKSt9_Any_dataS5_+0x1c3) [0x7ff8c21cf7b3]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/libmitsuba.so(_ZNK7mitsuba5Class9constructERKNS_10PropertiesE+0x1e) [0x7ff8a651275e]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/libmitsuba.so(_ZN7mitsuba13PluginManager13create_objectERKNS_10PropertiesEPKNS_5ClassE+0x81) [0x7ff8a652a511]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/libmitsuba.so(_ZN7mitsuba5ShapeIfNS_5ColorIfLm3EEEEC2ERKNS_10PropertiesE+0x6a6) [0x7ff8a6675216]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/libmitsuba.so(_ZN7mitsuba4MeshIfNS_5ColorIfLm3EEEEC1ERKNS_10PropertiesE+0x19) [0x7ff8a65a90c9]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/plugins/blender.so(_ZN7mitsuba11BlenderMeshIfNS_5ColorIfLm3EEEEC2ERKNS_10PropertiesE+0x1c) [0x7ff8c21f616c]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/plugins/blender.so(_ZNSt17_Function_handlerIFPN7mitsuba6ObjectERKNS0_10PropertiesEEZNS0_6detail21get_construct_functorINS0_11BlenderMeshIfNS0_5ColorIfLm3EEEEELi0EEESt8functionIS6_EvEUlS5_E_E9_M_invokeERKSt9_Any_dataS5_+0x22) [0x7ff8c21f8902]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/libmitsuba.so(_ZNK7mitsuba5Class9constructERKNS_10PropertiesE+0x1e) [0x7ff8a651275e]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/libmitsuba.so(_ZN7mitsuba13PluginManager13create_objectERKNS_10PropertiesEPKNS_5ClassE+0x81) [0x7ff8a652a511]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/mitsuba_scalar_rgb_ext.cpython-39-x86_64-linux-gnu.so(+0xd5dd4) [0x7ff8a62e8dd4]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/mitsuba_scalar_rgb_ext.cpython-39-x86_64-linux-gnu.so(+0xd61d2) [0x7ff8a62e91d2]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/mitsuba_scalar_rgb_ext.cpython-39-x86_64-linux-gnu.so(+0x56b30) [0x7ff8a6269b30]
./blender-2.93.18-linux-x64/blender() [0x87579c3]
./blender-2.93.18-linux-x64/blender(_PyObject_MakeTpCall+0x90) [0x87196a0]
./blender-2.93.18-linux-x64/blender(_PyEval_EvalFrameDefault+0x6b09) [0xf5a869]
./blender-2.93.18-linux-x64/blender() [0xf52dcb]
./blender-2.93.18-linux-x64/blender(_PyEval_EvalFrameDefault+0x59cc) [0xf5972c]
./blender-2.93.18-linux-x64/blender() [0xf52dcb]
./blender-2.93.18-linux-x64/blender(_PyEval_EvalFrameDefault+0x661d) [0xf5a37d]
./blender-2.93.18-linux-x64/blender() [0xf52dcb]
./blender-2.93.18-linux-x64/blender(_PyEval_EvalFrameDefault+0x678a) [0xf5a4ea]
./blender-2.93.18-linux-x64/blender() [0xf52dcb]
./blender-2.93.18-linux-x64/blender(PyVectorcall_Call+0x5f) [0x87190ff]
./blender-2.93.18-linux-x64/blender() [0x187f41d]
./blender-2.93.18-linux-x64/blender() [0x184d4b5]
./blender-2.93.18-linux-x64/blender() [0x1310cb9]
./blender-2.93.18-linux-x64/blender() [0x1314224]
./blender-2.93.18-linux-x64/blender() [0x131450c]
./blender-2.93.18-linux-x64/blender(wm_event_do_handlers+0x426) [0x1314c56]
./blender-2.93.18-linux-x64/blender(WM_main+0x20) [0x130b470]
./blender-2.93.18-linux-x64/blender(main+0x31e) [0xe880ae]
/lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7ff8f0c29d90]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7ff8f0c29e40]
./blender-2.93.18-linux-x64/blender() [0xf5d0ac]

# Python backtrace
  File "/home/user/.config/blender/2.93/scripts/addons/mitsuba-blender/io/exporter/geometry.py", line 58 in convert_mesh
  File "/home/user/.config/blender/2.93/scripts/addons/mitsuba-blender/io/exporter/geometry.py", line 97 in export_object
  File "/home/user/.config/blender/2.93/scripts/addons/mitsuba-blender/io/exporter/__init__.py", line 97 in scene_to_dict
  File "/home/user/.config/blender/2.93/scripts/addons/mitsuba-blender/io/__init__.py", line 136 in execute

Environment (please complete the following information):

  • OS: Ubuntu 22.04
  • Blender Version: 2.93
  • Add-on Version: latest

Additional notes

This add-on works in Blender 3.3 when mitsuba is installed via pip and Blender is started with --python-use-system-env

What version of mitsuba are you using in the addon in blender 2.93 ? You should be able to see this in the addon parameters (it should say something like "found mitsuba version x.x.x"), or in blender's scripting panel, by typing in the python interpreter:

import mitsuba
mitsuba.__version__

I tried with the latest and 3.0.1, installed via Python and compiled from sources

This seems to be related to the fact the the python wheels for Mitsuba were compiled on Ubuntu 20.04. Using a local build on my end works as expected.
If you really need to use blender 2.93, I suggest you use a local build of Mitsuba 3 (make sure you compile the expected release by doing git checkout v3.0.1).
Otherwise, you probably want to use a more recent version of blender anyway as 2.93 is not supported by Blender anymore, and we'll stop supporting it very soon as well.

Can you please try again with the latest version of the add-on ?

Tried with the latest 0.2.0 and 0.3.0. Still segfault in 2.93:

# Blender 2.93.18, Commit date: 2023-05-22 12:04, Hash cb886aba06d5
bpy.data.window_managers["WinMan"].addon_search = "mit"  # Property
Modules Installed (mitsuba-blender) from '/home/user/computer_graphics/mitsuba-addon/mitsuba-blender-0.2.0.zip' into '/home/user/.config/blender/2.93/scripts/addons'  # Info
bpy.context.space_data.bookmarks_active = 1  # Property

# backtrace
/opt/blender-2.93.18-linux-x64/blender(BLI_system_backtrace+0x20) [0xa599130]
/opt/blender-2.93.18-linux-x64/blender() [0xf6072d]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7f45a0c42520]
/opt/blender-2.93.18-linux-x64/blender() [0x1349f29]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/libmitsuba.so(+0x33ceaf) [0x7f456233ceaf]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/libmitsuba.so(_ZN7mitsuba10PropertiesD1Ev+0x38) [0x7f45621204e8]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/plugins/diffuse.so(_ZNSt17_Function_handlerIFPN7mitsuba6ObjectERKNS0_10PropertiesEEZNS0_6detail21get_construct_functorINS0_13SmoothDiffuseIfNS0_5ColorIfLm3EEEEELi0EEESt8functionIS6_EvEUlS5_E_E9_M_invokeERKSt9_Any_dataS5_+0x1c3) [0x7f4572ad17b3]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/libmitsuba.so(_ZNK7mitsuba5Class9constructERKNS_10PropertiesE+0x1e) [0x7f456211275e]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/libmitsuba.so(_ZN7mitsuba13PluginManager13create_objectERKNS_10PropertiesEPKNS_5ClassE+0x81) [0x7f456212a511]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/libmitsuba.so(_ZN7mitsuba5ShapeIfNS_5ColorIfLm3EEEEC2ERKNS_10PropertiesE+0x6a6) [0x7f4562275216]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/libmitsuba.so(_ZN7mitsuba4MeshIfNS_5ColorIfLm3EEEEC1ERKNS_10PropertiesE+0x19) [0x7f45621a90c9]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/plugins/blender.so(_ZN7mitsuba11BlenderMeshIfNS_5ColorIfLm3EEEEC2ERKNS_10PropertiesE+0x1c) [0x7f4572aa616c]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/plugins/blender.so(_ZNSt17_Function_handlerIFPN7mitsuba6ObjectERKNS0_10PropertiesEEZNS0_6detail21get_construct_functorINS0_11BlenderMeshIfNS0_5ColorIfLm3EEEEELi0EEESt8functionIS6_EvEUlS5_E_E9_M_invokeERKSt9_Any_dataS5_+0x22) [0x7f4572aa8902]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/libmitsuba.so(_ZNK7mitsuba5Class9constructERKNS_10PropertiesE+0x1e) [0x7f456211275e]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/libmitsuba.so(_ZN7mitsuba13PluginManager13create_objectERKNS_10PropertiesEPKNS_5ClassE+0x81) [0x7f456212a511]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/mitsuba_scalar_rgb_ext.cpython-39-x86_64-linux-gnu.so(+0xd5dd4) [0x7f4560ee8dd4]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/mitsuba_scalar_rgb_ext.cpython-39-x86_64-linux-gnu.so(+0xd61d2) [0x7f4560ee91d2]
/opt/blender-2.93.18-linux-x64/2.93/python/lib/python3.9/site-packages/mitsuba/mitsuba_scalar_rgb_ext.cpython-39-x86_64-linux-gnu.so(+0x56b30) [0x7f4560e69b30]
/opt/blender-2.93.18-linux-x64/blender() [0x87579c3]
/opt/blender-2.93.18-linux-x64/blender(_PyObject_MakeTpCall+0x90) [0x87196a0]
/opt/blender-2.93.18-linux-x64/blender(_PyEval_EvalFrameDefault+0x6b09) [0xf5a869]
/opt/blender-2.93.18-linux-x64/blender() [0xf52dcb]
/opt/blender-2.93.18-linux-x64/blender(_PyEval_EvalFrameDefault+0x59cc) [0xf5972c]
/opt/blender-2.93.18-linux-x64/blender() [0xf52dcb]
/opt/blender-2.93.18-linux-x64/blender(_PyEval_EvalFrameDefault+0x661d) [0xf5a37d]
/opt/blender-2.93.18-linux-x64/blender() [0xf52dcb]
/opt/blender-2.93.18-linux-x64/blender(_PyEval_EvalFrameDefault+0x678a) [0xf5a4ea]
/opt/blender-2.93.18-linux-x64/blender() [0xf52dcb]
/opt/blender-2.93.18-linux-x64/blender(PyVectorcall_Call+0x5f) [0x87190ff]
/opt/blender-2.93.18-linux-x64/blender() [0x187f41d]
/opt/blender-2.93.18-linux-x64/blender() [0x184d4b5]
/opt/blender-2.93.18-linux-x64/blender() [0x1310cb9]
/opt/blender-2.93.18-linux-x64/blender() [0x1314224]
/opt/blender-2.93.18-linux-x64/blender() [0x131450c]
/opt/blender-2.93.18-linux-x64/blender(wm_event_do_handlers+0x426) [0x1314c56]
/opt/blender-2.93.18-linux-x64/blender(WM_main+0x20) [0x130b470]
/opt/blender-2.93.18-linux-x64/blender(main+0x31e) [0xe880ae]
/lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f45a0c29d90]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7f45a0c29e40]
/opt/blender-2.93.18-linux-x64/blender() [0xf5d0ac]

# Python backtrace
  File "/home/user/.config/blender/2.93/scripts/addons/mitsuba-blender/io/exporter/geometry.py", line 59 in convert_mesh
  File "/home/user/.config/blender/2.93/scripts/addons/mitsuba-blender/io/exporter/geometry.py", line 112 in export_object
  File "/home/user/.config/blender/2.93/scripts/addons/mitsuba-blender/io/exporter/__init__.py", line 97 in scene_to_dict
  File "/home/user/.config/blender/2.93/scripts/addons/mitsuba-blender/io/__init__.py", line 136 in execute 

Then I suggest you either update blender or build mitsuba locally. I will close this as this seems specific to blender 2.93 and we won't be supporting that in the future.