Bug 1872980 - Segmentation fault when running script on Blender built with python 3.8 and up
Summary: Segmentation fault when running script on Blender built with python 3.8 and up
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: blender
Version: 33
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Luya Tshimbalanga
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-27 04:37 UTC by Jan ONDREJ
Modified: 2020-12-04 19:51 UTC (History)
21 users (show)

Fixed In Version: blender-2.83.5-5.fc32 blender-2.83.5-5.fc31 blender-2.90.0-3.fc33 blender-2.91.0-2.fc33
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-12-04 19:51:56 UTC
Type: Bug


Attachments (Terms of Use)
crash.log of blender-2.91.0-2.fc33.x86_64 (25.26 KB, text/plain)
2020-11-29 09:29 UTC, Jan ONDREJ
no flags Details

Description Jan ONDREJ 2020-08-27 04:37:20 UTC
Description of problem:
Blender crashes when running my python script. This script has been ported to blender 2.8, worked well, but currently crashes with segmentation fault. I tested upstream bleder tar package, where everything works well, no crash. Looks like Fedora's build is broken.

Version-Release number of selected component (if applicable):
blender-2.83.5-4.fc32.x86_64
I think all versions from 2.82, at least one 2.8x version worked for me.

How reproducible:
always

Steps to Reproduce:
Unable to describe specially, because my python scripts are needed for this, but I can do more debugging if needed.

Actual results:
BLT_lang_init: 'locale' data path for translations not found, continuing
Read prefs: ~/.config/blender/2.83/config/userpref.blend
Writing: /tmp/blender.crash.txt
Segmentation fault (core dumped)

Expected results:
No crash.

Additional info:
Here are blender.crash file contents:

# Blender 2.83.5, Commit date: 1970-01-01 00:00, Hash unknown
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(0, 0, 2.5))  # Operator
bpy.ops.transform.resize(value=(30, 20, 5), mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False)  # Operator
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)  # Operator
bpy.ops.object.editmode_toggle()  # Operator
bpy.ops.mesh.select_all(action='DESELECT')  # Operator
bpy.ops.object.editmode_toggle()  # Operator
bpy.ops.object.editmode_toggle()  # Operator
bpy.ops.mesh.delete(type='FACE')  # Operator
bpy.ops.mesh.select_all(action='SELECT')  # Operator
bpy.ops.object.editmode_toggle()  # Operator
bpy.ops.object.editmode_toggle()  # Operator
bpy.ops.object.modifier_add(type='SOLIDIFY')  # Operator
bpy.ops.object.editmode_toggle()  # Operator
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Solidify")  # Operator
bpy.ops.mesh.make_main_box(location=(0, 0, 0))  # Operator
bpy.ops.object.editmode_toggle()  # Operator
bpy.ops.object.editmode_toggle()  # Operator
bpy.ops.object.select_all(action='DESELECT')  # Operator
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)  # Operator
bpy.ops.object.editmode_toggle()  # Operator
bpy.ops.mesh.select_all(action='DESELECT')  # Operator
bpy.ops.object.editmode_toggle()  # Operator
bpy.ops.object.editmode_toggle()  # Operator
bpy.ops.mesh.loop_multi_select(ring=False)  # Operator
bpy.ops.object.editmode_toggle()  # Operator
bpy.ops.object.editmode_toggle()  # Operator
bpy.ops.mesh.select_all(action='DESELECT')  # Operator
bpy.ops.mesh.bridge_edge_loops()  # Operator
bpy.ops.mesh.select_all(action='DESELECT')  # Operator
bpy.ops.object.editmode_toggle()  # Operator
bpy.ops.object.editmode_toggle()  # Operator
bpy.ops.mesh.loop_multi_select(ring=False)  # Operator
bpy.ops.object.editmode_toggle()  # Operator
bpy.ops.object.editmode_toggle()  # Operator
bpy.ops.mesh.extrude_region_move(MESH_OT_extrude_region={"use_normal_flip":False, "mirror":False}, TRANSFORM_OT_translate={"value":(0, 0, -2), "orient_type":'GLOBAL', "orient_matrix":((0, 0, 0), (0, 0, 0), (0, 0, 0)), "orient_matrix_type":'GLOBAL', "constraint_axis":(False, False, False), "mirror":False, "use_proportional_edit":False, "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "use_proportional_connected":False, "use_proportional_projected":False, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "gpencil_strokes":False, "cursor_transform":False, "texture_space":False, "remove_on_cancel":False, "release_confirm":False, "use_accurate":False})  # Operator
bpy.ops.mesh.edge_face_add()  # Operator
bpy.ops.mesh.select_all(action='DESELECT')  # Operator
bpy.ops.object.editmode_toggle()  # Operator

# backtrace
blender(BLI_system_backtrace+0x37) [0x55855815ac47]
blender(+0xce461a) [0x558555ec661a]
/lib64/libc.so.6(+0x3ca70) [0x7f85ab590a70]
/lib64/libpython3.8.so.1.0(_PyEval_EvalFrameDefault+0x5a85) [0x7f85abe018d5]
/lib64/libpython3.8.so.1.0(+0x116177) [0x7f85abe0a177]
/lib64/libpython3.8.so.1.0(PyVectorcall_Call+0x70) [0x7f85abe12a90]
blender(+0x1304a4d) [0x5585564e6a4d]
blender(+0x12ddb39) [0x5585564bfb39]
blender(+0xfa8ffb) [0x55855618affb]
blender(WM_operator_name_call_ptr+0x44) [0x55855618bb44]
blender(+0x1625ce4) [0x558556807ce4]
blender(+0x1636da1) [0x558556818da1]
blender(+0xfad3da) [0x55855618f3da]
blender(+0xfada5c) [0x55855618fa5c]
blender(wm_event_do_handlers+0x4e6) [0x558556190316]
blender(WM_main+0x20) [0x5585561867b0]
blender(main+0x31b) [0x558555e9a6db]
/lib64/libc.so.6(__libc_start_main+0xf2) [0x7f85ab57b042]
blender(_start+0x2e) [0x558555ec2a1e]

Comment 1 Fedora Update System 2020-09-05 22:59:13 UTC
FEDORA-2020-3f31203bf4 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2020-3f31203bf4

Comment 2 Fedora Update System 2020-09-05 22:59:13 UTC
FEDORA-2020-4712ce29ce has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2020-4712ce29ce

Comment 3 Fedora Update System 2020-09-05 22:59:14 UTC
FEDORA-2020-0661ea4296 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-0661ea4296

Comment 4 Fedora Update System 2020-09-07 17:20:45 UTC
FEDORA-2020-0661ea4296 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-0661ea4296`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-0661ea4296

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 5 Fedora Update System 2020-09-07 17:56:52 UTC
FEDORA-2020-4712ce29ce has been pushed to the Fedora 31 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-4712ce29ce`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-4712ce29ce

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Fedora Update System 2020-09-07 21:44:14 UTC
FEDORA-2020-a9c959e657 has been pushed to the Fedora 33 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-a9c959e657`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-a9c959e657

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Jan ONDREJ 2020-09-08 05:17:48 UTC
blender-2.83.5-5.fc32 doesn't fix this problem.
I am trying to build blender-2.90 from f33 on f32, but without success. Is it possible to build it? Blender-2.90 is not fully addon compatible, but at least want to try.

Comment 8 Fedora Update System 2020-09-15 16:16:03 UTC
FEDORA-2020-0661ea4296 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 9 Jan ONDREJ 2020-09-15 16:30:03 UTC
Not fixed in this release.

Comment 10 Fedora Update System 2020-09-15 17:26:56 UTC
FEDORA-2020-4712ce29ce has been pushed to the Fedora 31 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 11 Fedora Update System 2020-09-25 16:48:41 UTC
FEDORA-2020-a9c959e657 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 12 Jan ONDREJ 2020-10-26 12:19:23 UTC
Same problem on Fedora 33. Blender version:

blender-2.90.1-2.fc33.x86_64

Currently there are multiple problems, for example unable to import STL file, crashes too.

Looks like all python things are broken (STL import is python too).

I am amble to reproduce this with a very simple python script:

cat > test.py << EOF
import bpy
bpy.ops.mesh.primitive_cube_add(size=1.0)
EOF

Then run:
blender -P test.py

Results:
Writing: /tmp/blender.crash.txt
Segmentation fault (core dumped)

If you can't reproduce it, I can attach crash.txt file.
I've removed all my custom configs before run, so don't think this was caused by my settings.

Comment 13 Kei 2020-10-28 23:42:47 UTC
I can confirm the same exact problem on a fresh installed Fedora 33.
The version from Blender official site works as expected.

My specs, if it can be useful:

Intel i7 6700K
GeForce GTX 1060 6GB/PCIe/SSE2

Kernel Version: 5.8.16-300.fc33.x86_64

KDE Plasma Version: 5.20.2
KDE Frameworks Version: 5.75.0
Qt Version 5.15.1

Comment 14 Xinya Zhang 2020-11-06 04:14:37 UTC
Can also confirm on Fedora 33. If clicking the "Script" tab on the main menu it crashes instantly.

The following is the gdb backtrace, if it's helpful:

Thread 1 "blender" received signal SIGSEGV, Segmentation fault.
0x00007ffff2c6cfc9 in PyEval_ReleaseLock () from /lib64/libpython3.9.so.1.0
(gdb) bt
#0  0x00007ffff2c6cfc9 in PyEval_ReleaseLock () at /lib64/libpython3.9.so.1.0
#1  0x00005555567ce90d in rna_ViewLayer_update_tagged ()
#2  0x0000555556918def in pyrna_func_call ()
#3  0x00007ffff2cba8df in _PyObject_MakeTpCall () at /lib64/libpython3.9.so.1.0
#4  0x00007ffff2cb760f in _PyEval_EvalFrameDefault () at /lib64/libpython3.9.so.1.0
#5  0x00007ffff2cbf4bb in function_code_fastcall () at /lib64/libpython3.9.so.1.0
#6  0x00007ffff2cb6cce in _PyEval_EvalFrameDefault () at /lib64/libpython3.9.so.1.0
#7  0x00007ffff2cb0e81 in _PyEval_EvalCode () at /lib64/libpython3.9.so.1.0
#8  0x00007ffff2cbf206 in _PyFunction_Vectorcall () at /lib64/libpython3.9.so.1.0
#9  0x00007ffff2cba462 in _PyObject_FastCallDictTstate () at /lib64/libpython3.9.so.1.0
#10 0x00007ffff2cc6b48 in _PyObject_Call_Prepend () at /lib64/libpython3.9.so.1.0
#11 0x00007ffff2d639ba in slot_tp_call () at /lib64/libpython3.9.so.1.0
#12 0x00007ffff2cba9cb in _PyObject_MakeTpCall () at /lib64/libpython3.9.so.1.0
#13 0x00007ffff2cb7c2f in _PyEval_EvalFrameDefault () at /lib64/libpython3.9.so.1.0
#14 0x00007ffff2cbf4bb in function_code_fastcall () at /lib64/libpython3.9.so.1.0
#15 0x00007ffff2cb2202 in _PyEval_EvalFrameDefault () at /lib64/libpython3.9.so.1.0
#16 0x00007ffff2cbf4bb in function_code_fastcall () at /lib64/libpython3.9.so.1.0
#17 0x00007ffff2cb2202 in _PyEval_EvalFrameDefault () at /lib64/libpython3.9.so.1.0
#18 0x00007ffff2cbf4bb in function_code_fastcall () at /lib64/libpython3.9.so.1.0
#19 0x0000555556930df2 in bpy_class_call ()
#20 0x0000555556904bb8 in rna_operator_execute_cb ()
#21 0x000055555652140a in wm_operator_invoke.part ()
#22 0x0000555556dc3e35 in console_main_region_draw ()
#23 0x000055555694e801 in ED_region_do_draw ()
#24 0x000055555651d21a in wm_draw_update ()
#25 0x0000555556526290 in WM_main ()
#26 0x00005555561e33de in main ()

Comment 15 Luya Tshimbalanga 2020-11-07 07:23:50 UTC
Would you test this build from COPR: https://download.copr.fedorainfracloud.org/results/luya/blender-egl/fedora-33-x86_64/01731399-blender/

Comment 16 Jan ONDREJ 2020-11-07 09:45:34 UTC
Hello. Thank for this build, but still same problem.
You can't test/reproduce it yourself? As mentioned in comment#14, it's enough to click on "Scripting" tab.

Comment 17 Kei 2020-11-07 18:17:19 UTC
Still crashing to me, gdb output:

Thread 1 "blender" received signal SIGSEGV, Segmentation fault.
0x00007ffff2c82fc9 in PyEval_ReleaseLock () from /lib64/libpython3.9.so.1.0

Comment 18 Luya Tshimbalanga 2020-11-08 09:28:30 UTC
(In reply to Jan ONDREJ from comment #16)
> Hello. Thank for this build, but still same problem.
> You can't test/reproduce it yourself? As mentioned in comment#14, it's
> enough to click on "Scripting" tab.

Hence the build on COPR to compare issue. I confirm the traceback and it seems affecting Python 3.8 and up as upstream version is build from Python 3.7.
Unfortunately, there is no devel package for Python 3.7. Assigning to Python team for investigation.

Comment 19 Luya Tshimbalanga 2020-11-08 09:30:09 UTC
Set assignation to investigate the traceback highlighted on comment #12

Comment 20 Xinya Zhang 2020-11-09 03:19:34 UTC
(In reply to Luya Tshimbalanga from comment #18)
> (In reply to Jan ONDREJ from comment #16)
> > Hello. Thank for this build, but still same problem.
> > You can't test/reproduce it yourself? As mentioned in comment#14, it's
> > enough to click on "Scripting" tab.
> 
> Hence the build on COPR to compare issue. I confirm the traceback and it
> seems affecting Python 3.8 and up as upstream version is build from Python
> 3.7.
> Unfortunately, there is no devel package for Python 3.7. Assigning to Python
> team for investigation.

I searched on Blender's issue tracker and its T82520 looks suspicious to me: https://developer.blender.org/T82520
Hope it helps

Comment 21 Luya Tshimbalanga 2020-11-09 06:24:11 UTC
(In reply to Xinya Zhang from comment #20)
>
> I searched on Blender's issue tracker and its T82520 looks suspicious to me:
> https://developer.blender.org/T82520
> Hope it helps

Thanks for the finding. Essentially, the bug in question is upstream and a large patch is available on 
https://developer.blender.org/rBe118426e4695a97d67e65d69677f3c4e2db50a56

Comment 22 Miro Hrončok 2020-11-09 09:36:01 UTC
Python maintainer here. It seems that the upstream links provide the informatika that was requested from us.

Comment 23 Jan ONDREJ 2020-11-09 11:33:48 UTC
Not sure, if this is a solution.

Change from 0 to nullptr in most of places has been started in this patch on 6th november:
https://developer.blender.org/rB16732def37c5a66f3ea28dbe247b09cc6bca6677#change-1Lw0xNX3U8nT

Later some nullptr changed back to 0:
https://developer.blender.org/T82520

In current Fedora build there are zeros, nullptr is not used.
Do you think, changing some of them to nullptr and tp_print to 0 will fix our issue?
Original patch was described only as "modernize" patch, not fixing anything.

Comment 24 Miro Hrončok 2020-11-09 11:51:17 UTC
Thinking about it more,  changing nullptrs to zero or back should not cause segmentation faults. I'd say that there is a problem with GIL somewhere. But I am not familiar with Blender codebase at all.

Comment 25 Luya Tshimbalanga 2020-11-23 01:07:03 UTC
Blender 2.91 is near with more fixes. https://wiki.blender.org/wiki/Reference/Release_Notes/2.91 
I'll push it when available.

Comment 26 Fedora Update System 2020-11-28 21:17:13 UTC
FEDORA-2020-e807be8b1d has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-e807be8b1d

Comment 27 Fedora Update System 2020-11-28 21:17:15 UTC
FEDORA-2020-1aef1e9bca has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2020-1aef1e9bca

Comment 28 Fedora Update System 2020-11-29 02:08:12 UTC
FEDORA-2020-1aef1e9bca has been pushed to the Fedora 33 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-1aef1e9bca`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-1aef1e9bca

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 29 Fedora Update System 2020-11-29 02:13:31 UTC
FEDORA-2020-e807be8b1d has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-e807be8b1d`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-e807be8b1d

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 30 Jan ONDREJ 2020-11-29 09:29:31 UTC
Created attachment 1734543 [details]
crash.log of blender-2.91.0-2.fc33.x86_64

blender-2.91.0-2.fc33.x86_64 works much better. Most of operation works, but still sometimes crashes. Attaching creash.log.

Comment 31 Luya Tshimbalanga 2020-11-29 18:00:24 UTC
(In reply to Jan ONDREJ from comment #30)
> Created attachment 1734543 [details]
> crash.log of blender-2.91.0-2.fc33.x86_64

From the attachment:
"  File "/home/ondrejj/.config/blender/2.91/scripts/addons/boxmaker.py", line 156 in execute"

It seems that add-on has an issue. Disable it and see if the crash occur. I tested the script from comment #12 where the crash no longer occurs.

Comment 32 Jan ONDREJ 2020-11-29 18:29:09 UTC
(In reply to Luya Tshimbalanga from comment #31)
> It seems that add-on has an issue. Disable it and see if the crash occur. I
> tested the script from comment #12 where the crash no longer occurs.

This is my own addon. I know, that blender crashed when using it, but blender shouldn't creash when using python addon. Should throw an exception, but don't crash.

Also I can use my addon without problems with original blender downloaded from blender.org, but sometimes crashes in Fedora's build.

My addon works normally in Fedora's build too, but If I change some object parameters, then crashes.

Comment 33 Luya Tshimbalanga 2020-11-29 20:50:58 UTC
(In reply to Jan ONDREJ from comment #32)
> (In reply to Luya Tshimbalanga from comment #31)
> > It seems that add-on has an issue. Disable it and see if the crash occur. I
> > tested the script from comment #12 where the crash no longer occurs.
> 
> This is my own addon. I know, that blender crashed when using it, but
> blender shouldn't creash when using python addon. Should throw an exception,
> but don't crash.
> 
As observed, the crash occurred with Python 3.8 and up which exposed upstream bug relying to Python 3.7.

Comment 34 Fedora Update System 2020-12-04 19:51:56 UTC
FEDORA-2020-1aef1e9bca has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.