Moguri / BlenderPanda

Blender addon for integrating Panda3D
MIT License
76 stars 11 forks source link

Blender crashes when exiting rendered viewport mode before render is done #30

Open rdb opened 6 years ago

rdb commented 6 years ago

Whenever I leave Rendered Viewport mode right after entering it (while it is still black), Blender consistently gives a segmentation fault. This is especially noticeable on bigger scenes (I can provide if requested) where the viewport stays black for longer.

Connected to external process
Writing: /tmp/world.crash.txt
Received zero-length msg header, aborting
Server thread has terminated, closing program
Segmentation fault (core dumped)

The gdb traceback varies from time to time, sometimes the crash occurs on the main thread and sometimes on another.

#0  0x000000080cac6c7c in pthread_cleanup_pop () from /lib/libthr.so.3
#1  0x000000080cac4a1c in _pthread_cond_wait () from /lib/libthr.so.3
#2  0x0000000803d1e136 in PyEval_InitThreads () from /usr/local/lib/libpython3.5m.so.1.0
#3  0x0000000803d1e6b9 in PyEval_RestoreThread () from /usr/local/lib/libpython3.5m.so.1.0
#4  0x0000000803d4b9dc in PyGILState_Ensure () from /usr/local/lib/libpython3.5m.so.1.0
#5  0x0000000000e01302 in BPY_DECREF_RNA_INVALIDATE ()
#6  0x0000000000d8c827 in RE_engine_free ()
#7  0x0000000000adf1fd in ED_view3d_shade_update ()
#8  0x000000000124ddc9 in RNA_property_update ()
#9  0x0000000000bfd4ad in ui_but_clipboard_free ()
#10 0x0000000000bfa3e7 in ui_but_clipboard_free ()
#11 0x0000000000a11dd1 in WM_event_is_tablet ()
#12 0x0000000000a0eddc in wm_event_do_handlers ()
#13 0x0000000000a0e4a2 in wm_event_do_handlers ()
#14 0x0000000000a07510 in WM_main ()
#15 0x0000000000a0393b in main ()
#0  0x0000000803cb1ebb in PyObject_RichCompare () from /usr/local/lib/libpython3.5m.so.1.0
#1  0x0000000803d22650 in PyEval_EvalFrameEx () from /usr/local/lib/libpython3.5m.so.1.0
#2  0x0000000803d28099 in PyEval_CallObjectWithKeywords () from /usr/local/lib/libpython3.5m.so.1.0
#3  0x0000000803d1ea44 in PyEval_EvalCodeEx () from /usr/local/lib/libpython3.5m.so.1.0
#4  0x0000000803c91cee in PyFunction_SetAnnotations () from /usr/local/lib/libpython3.5m.so.1.0
#5  0x0000000803c6bcd6 in PyObject_Call () from /usr/local/lib/libpython3.5m.so.1.0
#6  0x0000000803c7e1fb in PyMethod_New () from /usr/local/lib/libpython3.5m.so.1.0
#7  0x0000000803c6bcd6 in PyObject_Call () from /usr/local/lib/libpython3.5m.so.1.0
#8  0x0000000803cc8978 in _PyType_LookupId () from /usr/local/lib/libpython3.5m.so.1.0
#9  0x0000000803cc8056 in _PyType_LookupId () from /usr/local/lib/libpython3.5m.so.1.0
#10 0x0000000803d24509 in PyEval_EvalFrameEx () from /usr/local/lib/libpython3.5m.so.1.0
#11 0x0000000803d28099 in PyEval_CallObjectWithKeywords () from /usr/local/lib/libpython3.5m.so.1.0
#12 0x0000000803d2896a in _PyEval_SliceIndexNotNone () from /usr/local/lib/libpython3.5m.so.1.0
#13 0x0000000803d20bfb in PyEval_EvalFrameEx () from /usr/local/lib/libpython3.5m.so.1.0
#14 0x0000000803d28099 in PyEval_CallObjectWithKeywords () from /usr/local/lib/libpython3.5m.so.1.0
#15 0x0000000803d2896a in _PyEval_SliceIndexNotNone () from /usr/local/lib/libpython3.5m.so.1.0
#16 0x0000000803d20bfb in PyEval_EvalFrameEx () from /usr/local/lib/libpython3.5m.so.1.0
#17 0x0000000803d28099 in PyEval_CallObjectWithKeywords () from /usr/local/lib/libpython3.5m.so.1.0
#18 0x0000000803d2896a in _PyEval_SliceIndexNotNone () from /usr/local/lib/libpython3.5m.so.1.0
#19 0x0000000803d20bfb in PyEval_EvalFrameEx () from /usr/local/lib/libpython3.5m.so.1.0
#20 0x0000000803d28099 in PyEval_CallObjectWithKeywords () from /usr/local/lib/libpython3.5m.so.1.0
#21 0x0000000803d2896a in _PyEval_SliceIndexNotNone () from /usr/local/lib/libpython3.5m.so.1.0
#22 0x0000000803d20bfb in PyEval_EvalFrameEx () from /usr/local/lib/libpython3.5m.so.1.0
#23 0x0000000803d289e3 in _PyEval_SliceIndexNotNone () from /usr/local/lib/libpython3.5m.so.1.0
#24 0x0000000803d20bfb in PyEval_EvalFrameEx () from /usr/local/lib/libpython3.5m.so.1.0
#25 0x0000000803d289e3 in _PyEval_SliceIndexNotNone () from /usr/local/lib/libpython3.5m.so.1.0
#26 0x0000000803d20bfb in PyEval_EvalFrameEx () from /usr/local/lib/libpython3.5m.so.1.0
#27 0x0000000803d289e3 in _PyEval_SliceIndexNotNone () from /usr/local/lib/libpython3.5m.so.1.0
#28 0x0000000803d20bfb in PyEval_EvalFrameEx () from /usr/local/lib/libpython3.5m.so.1.0
#29 0x0000000803d28099 in PyEval_CallObjectWithKeywords () from /usr/local/lib/libpython3.5m.so.1.0
#30 0x0000000803d1ea44 in PyEval_EvalCodeEx () from /usr/local/lib/libpython3.5m.so.1.0
#31 0x0000000803c91cee in PyFunction_SetAnnotations () from /usr/local/lib/libpython3.5m.so.1.0
#32 0x0000000803c6bcd6 in PyObject_Call () from /usr/local/lib/libpython3.5m.so.1.0
#33 0x0000000803c7e1fb in PyMethod_New () from /usr/local/lib/libpython3.5m.so.1.0
#34 0x0000000803c6bcd6 in PyObject_Call () from /usr/local/lib/libpython3.5m.so.1.0
#35 0x0000000803d2784f in PyEval_CallObjectWithKeywords () from /usr/local/lib/libpython3.5m.so.1.0
#36 0x0000000803d68046 in PyInit__thread () from /usr/local/lib/libpython3.5m.so.1.0
#37 0x000000080cab8bc5 in pthread_create () from /lib/libthr.so.3
Moguri commented 6 years ago

I was unable to reproduce this segfault. I held down the shift key and kept pressing Z to enter/exit the rendered viewport as fast as I could. I added some reliability tweaks (guards, try/except) in f1c9313ba1735adddd8a83f9f2ceb7205c0e42cf, would you mind re-testing this issue?

rdb commented 6 years ago

I can still reproduce this crash. However, since I'm testing this on FreeBSD, it may exist only in my particular configuration. I'll make a mental note to try it with the same model in Linux.

Moguri commented 5 years ago

This may be fixed by the new rendered viewport code from 41d527e57cf61a172c1d91c9fc4b2d19aed8d73e. If/when you get the chance, could you please re-test this on FreeBSD?