Regression: Blender crashes when texture painting (caused by boolean modifers) #99191

Closed
opened 2022-06-26 21:35:57 +02:00 by smol · 25 comments

System Information
Operating system: Windows-10-10.0.22000-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 516.40

Blender Version
Broken: version: 3.2.0, branch: master, commit date: 2022-06-08 10:22, hash: e05e1e3691
Worked: 3.1.2

Caused by 1a6d0ec71c.

Short description of error
Blender crashes when texture painting a model.
Reason is boolean modifiers will leaving "invalid" mat_nr around.

Exact steps for others to reproduce the error
T99191_repro.blend

  • cube with one material that is
  • booled by another cube (which has no material) that is
  • booled by another cube (which also has no material)
  • open file and do a stroke
  • crash

Original report Exact steps for others to reproduce the error
I created a simple material to render peeling paint on a metal surface, I try to paint a black and white image to generate the normal bump. But Blender crashes after the third clicks.
Here my blend file :
terminals2.blend
and here my crash file :
terminals2.crash.txt

My graphic card's drivers are updated and I also tried Blender 2.92, but the crash still occurs.

**System Information** Operating system: Windows-10-10.0.22000-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 516.40 **Blender Version** Broken: version: 3.2.0, branch: master, commit date: 2022-06-08 10:22, hash: `e05e1e3691` Worked: 3.1.2 Caused by 1a6d0ec71c. **Short description of error** Blender crashes when texture painting a model. Reason is boolean modifiers will leaving "invalid" `mat_nr` around. **Exact steps for others to reproduce the error** [T99191_repro.blend](https://archive.blender.org/developer/F13235201/T99191_repro.blend) - cube with one material that is - booled by another cube (which has no material) that is - booled by another cube (which also has no material) - open file and do a stroke - crash **Original report Exact steps for others to reproduce the error** I created a simple material to render peeling paint on a metal surface, I try to paint a black and white image to generate the normal bump. But Blender crashes after the third clicks. Here my blend file : [terminals2.blend](https://archive.blender.org/developer/F13231320/terminals2.blend) and here my crash file : [terminals2.crash.txt](https://archive.blender.org/developer/F13231323/terminals2.crash.txt) My graphic card's drivers are updated and I also tried Blender 2.92, but the crash still occurs.
Author

Added subscriber: @smol

Added subscriber: @smol
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'
Member

Hi, thanks for the report.
I've not been able to repro crash in 3.3 (but I can in 3.2)
@smol, could you check in 3.2.1 or 3.3: https://builder.blender.org/download/daily/ (I'll also check in 3.2.1)

Hi, thanks for the report. I've not been able to repro crash in 3.3 (but I can in 3.2) @smol, could you check in 3.2.1 or 3.3: https://builder.blender.org/download/daily/ (I'll also check in 3.2.1)
Member

Changed status from 'Needs User Info' to: 'Confirmed'

Changed status from 'Needs User Info' to: 'Confirmed'
Member

Can replicate crash in 3.2.1 too. Bisecting (I mean finding the commit for backporting).

Can replicate crash in 3.2.1 too. Bisecting (I mean finding the commit for backporting).
Member

I did some cleanup in your file and I can now repro crash even in 2.93-3.3
lowering the priority.

  • Open file
  • Switch to texture paint workspace
  • Draw over model
Stack trace:
blender.exe         :0x00007FF68E7FD320  project_paint_prepare_all_faces C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\editors\sculpt_paint\paint_image_proj.c:4298
blender.exe         :0x00007FF68E7FB240  project_paint_begin C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\editors\sculpt_paint\paint_image_proj.c:4545
blender.exe         :0x00007FF68E7F6930  paint_proj_new_stroke C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\editors\sculpt_paint\paint_image_proj.c:5964
blender.exe         :0x00007FF68E8400E0  blender::ed::sculpt_paint::image::ops::paint::texture_paint_init C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\editors\sculpt_paint\paint_image_ops_paint.cc:311
blender.exe         :0x00007FF68E83FEA0  blender::ed::sculpt_paint::image::ops::paint::paint_stroke_test_start C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\editors\sculpt_paint\paint_image_ops_paint.cc:437
blender.exe         :0x00007FF68E832190  paint_stroke_modal C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\editors\sculpt_paint\paint_stroke.c:1469
blender.exe         :0x00007FF68E83FB60  blender::ed::sculpt_paint::image::ops::paint::paint_invoke C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\editors\sculpt_paint\paint_image_ops_paint.cc:459
blender.exe         :0x00007FF68DE246A0  wm_operator_invoke C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\windowmanager\intern\wm_event_system.c:1391
blender.exe         :0x00007FF68DE22030  wm_handler_operator_call C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\windowmanager\intern\wm_event_system.c:2424
blender.exe         :0x00007FF68DE23A50  wm_handlers_do_keymap_with_keymap_handler C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\windowmanager\intern\wm_event_system.c:2819
blender.exe         :0x00007FF68DE231F0  wm_handlers_do_intern C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\windowmanager\intern\wm_event_system.c:3139
blender.exe         :0x00007FF68DE22650  wm_handlers_do C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\windowmanager\intern\wm_event_system.c:3282
blender.exe         :0x00007FF68DE1F250  wm_event_do_handlers C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\windowmanager\intern\wm_event_system.c:3923
blender.exe         :0x00007FF68DE09A40  WM_main C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\windowmanager\intern\wm.c:626
blender.exe         :0x00007FF68DE051C0  main C:\Users\Pratik\Desktop\BlenderOSP\blender\source\creator\creator.c:552
blender.exe         :0x00007FF68EFA3514  __scrt_common_main_seh d:\a01\_work\12\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
KERNEL32.DLL        :0x00007FF90E387020  BaseThreadInitThunk
ntdll.dll           :0x00007FF90F7A2630  RtlUserThreadStart```
I did some cleanup in your file and I can now repro crash even in 2.93-3.3 lowering the priority. - Open file - Switch to texture paint workspace - Draw over model ```lines=10 Stack trace: blender.exe :0x00007FF68E7FD320 project_paint_prepare_all_faces C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\editors\sculpt_paint\paint_image_proj.c:4298 blender.exe :0x00007FF68E7FB240 project_paint_begin C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\editors\sculpt_paint\paint_image_proj.c:4545 blender.exe :0x00007FF68E7F6930 paint_proj_new_stroke C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\editors\sculpt_paint\paint_image_proj.c:5964 blender.exe :0x00007FF68E8400E0 blender::ed::sculpt_paint::image::ops::paint::texture_paint_init C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\editors\sculpt_paint\paint_image_ops_paint.cc:311 blender.exe :0x00007FF68E83FEA0 blender::ed::sculpt_paint::image::ops::paint::paint_stroke_test_start C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\editors\sculpt_paint\paint_image_ops_paint.cc:437 blender.exe :0x00007FF68E832190 paint_stroke_modal C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\editors\sculpt_paint\paint_stroke.c:1469 blender.exe :0x00007FF68E83FB60 blender::ed::sculpt_paint::image::ops::paint::paint_invoke C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\editors\sculpt_paint\paint_image_ops_paint.cc:459 blender.exe :0x00007FF68DE246A0 wm_operator_invoke C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\windowmanager\intern\wm_event_system.c:1391 blender.exe :0x00007FF68DE22030 wm_handler_operator_call C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\windowmanager\intern\wm_event_system.c:2424 blender.exe :0x00007FF68DE23A50 wm_handlers_do_keymap_with_keymap_handler C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\windowmanager\intern\wm_event_system.c:2819 blender.exe :0x00007FF68DE231F0 wm_handlers_do_intern C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\windowmanager\intern\wm_event_system.c:3139 blender.exe :0x00007FF68DE22650 wm_handlers_do C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\windowmanager\intern\wm_event_system.c:3282 blender.exe :0x00007FF68DE1F250 wm_event_do_handlers C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\windowmanager\intern\wm_event_system.c:3923 blender.exe :0x00007FF68DE09A40 WM_main C:\Users\Pratik\Desktop\BlenderOSP\blender\source\blender\windowmanager\intern\wm.c:626 blender.exe :0x00007FF68DE051C0 main C:\Users\Pratik\Desktop\BlenderOSP\blender\source\creator\creator.c:552 blender.exe :0x00007FF68EFA3514 __scrt_common_main_seh d:\a01\_work\12\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288 KERNEL32.DLL :0x00007FF90E387020 BaseThreadInitThunk ntdll.dll :0x00007FF90F7A2630 RtlUserThreadStart```
Author

@PratikPB2123 Thank you for your time. I also tried in 3.2.1 but it still crashes. Do you have any idea on how can I avoid this crash until the problem is fixed ?

@PratikPB2123 Thank you for your time. I also tried in 3.2.1 but it still crashes. Do you have any idea on how can I avoid this crash until the problem is fixed ?
Member

Added subscribers: @howardt, @lichtwerk

Added subscribers: @howardt, @lichtwerk
Member

Ha! I think we finally found a case where the boolean modifier screws with material indices?
Disabling all boolean modifiers lets you paint on the thing, enabling one and trying to paint makes it go Boom!

Then, there is BMFace with mat_nr -1 which crashes here for me

1   __pthread_kill_implementation                                                                                                                                                                                          0x7ffff7a90f0c 
2   raise                                                                                                                                                                                                                  0x7ffff7a40a36 
3   abort                                                                                                                                                                                                                  0x7ffff7a2a82f 
4   _BLI_assert_abort                                                                                                                                                                            BLI_assert.c         46   0x120c3ece     
5   blender::Array<short, 4l, blender::GuardedAllocator>::operator[]                                                                                                                             BLI_array.hh         197  0x4f8053b      
6   BMD_mesh_intersection                                                                                                                                                                        MOD_boolean.cc       335  0x4f7f58b      
7   modifyMesh                                                                                                                                                                                   MOD_boolean.cc       500  0x4f7fe73      
8   BKE_modifier_modify_mesh                                                                                                                                                                     modifier.c           972  0x40f39d4      
9   modifier_modify_mesh_and_geometry_set                                                                                                                                                        DerivedMesh.cc       689  0x4614c8e      
10  mesh_calc_modifiers                                                                                                                                                                          DerivedMesh.cc       1032 0x4615af5      
11  mesh_build_data                                                                                                                                                                              DerivedMesh.cc       1620 0x4617c51      
12  makeDerivedMesh                                                                                                                                                                              DerivedMesh.cc       1791 0x461829b      
13  BKE_object_handle_data_update                                                                                                                                                                object_update.c      168  0x4172028      
14  BKE_object_eval_uber_data                                                                                                                                                                    object_update.c      331  0x4172816      
15  operator()                                                                                                                                                                                   deg_builder_nodes.cc 1453 0x4d72c90      
16  std::__invoke_impl<void, blender::deg::DepsgraphNodeBuilder::build_object_data_geometry(Object *)::<lambda(Depsgraph *)>&, Depsgraph *>(std::__invoke_other, struct {...} &)                 invoke.h             61   0x4d7e30a      
17  std::__invoke_r<void, blender::deg::DepsgraphNodeBuilder::build_object_data_geometry(Object *)::<lambda(Depsgraph *)>&, Depsgraph *>(struct {...} &)                                         invoke.h             111  0x4d7b7f1      
18  std::_Function_handler<void(Depsgraph *), blender::deg::DepsgraphNodeBuilder::build_object_data_geometry(Object *)::<lambda(Depsgraph *)>>::_M_invoke(const std::_Any_data &, Depsgraph *&&) std_function.h       290  0x4d787dc      
19  std::function<void (Depsgraph *)>::operator()(Depsgraph *) const                                                                                                                             std_function.h       591  0x4d53521      
20  blender::deg::(anonymous namespace)::evaluate_node                                                                                                                                           deg_eval.cc          102  0x4d52717      
... <More>       

CC @howardt

Ha! I think we finally found a case where the boolean modifier screws with material indices? Disabling all boolean modifiers lets you paint on the thing, enabling one and trying to paint makes it go Boom! Then, there is BMFace with mat_nr -1 which crashes here for me ``` 1 __pthread_kill_implementation 0x7ffff7a90f0c 2 raise 0x7ffff7a40a36 3 abort 0x7ffff7a2a82f 4 _BLI_assert_abort BLI_assert.c 46 0x120c3ece 5 blender::Array<short, 4l, blender::GuardedAllocator>::operator[] BLI_array.hh 197 0x4f8053b 6 BMD_mesh_intersection MOD_boolean.cc 335 0x4f7f58b 7 modifyMesh MOD_boolean.cc 500 0x4f7fe73 8 BKE_modifier_modify_mesh modifier.c 972 0x40f39d4 9 modifier_modify_mesh_and_geometry_set DerivedMesh.cc 689 0x4614c8e 10 mesh_calc_modifiers DerivedMesh.cc 1032 0x4615af5 11 mesh_build_data DerivedMesh.cc 1620 0x4617c51 12 makeDerivedMesh DerivedMesh.cc 1791 0x461829b 13 BKE_object_handle_data_update object_update.c 168 0x4172028 14 BKE_object_eval_uber_data object_update.c 331 0x4172816 15 operator() deg_builder_nodes.cc 1453 0x4d72c90 16 std::__invoke_impl<void, blender::deg::DepsgraphNodeBuilder::build_object_data_geometry(Object *)::<lambda(Depsgraph *)>&, Depsgraph *>(std::__invoke_other, struct {...} &) invoke.h 61 0x4d7e30a 17 std::__invoke_r<void, blender::deg::DepsgraphNodeBuilder::build_object_data_geometry(Object *)::<lambda(Depsgraph *)>&, Depsgraph *>(struct {...} &) invoke.h 111 0x4d7b7f1 18 std::_Function_handler<void(Depsgraph *), blender::deg::DepsgraphNodeBuilder::build_object_data_geometry(Object *)::<lambda(Depsgraph *)>>::_M_invoke(const std::_Any_data &, Depsgraph *&&) std_function.h 290 0x4d787dc 19 std::function<void (Depsgraph *)>::operator()(Depsgraph *) const std_function.h 591 0x4d53521 20 blender::deg::(anonymous namespace)::evaluate_node deg_eval.cc 102 0x4d52717 ... <More> ``` CC @howardt
Philipp Oeser changed title from Blender crashes when texture painting to Blender crashes when texture painting (caused by boolean modifers) 2022-06-28 11:56:45 +02:00
Member

@PratikPB2123 : do you have the cleaned up file that also crashes in 2.93? (cannot repro)

@PratikPB2123 : do you have the cleaned up file that also crashes in 2.93? (cannot repro)
Member

terminals2-cleanup.blend
This file and the one attached in the report gives identical call stack to me

[terminals2-cleanup.blend](https://archive.blender.org/developer/F13234823/terminals2-cleanup.blend) This file and the one attached in the report gives identical call stack to me
Member

Added subscriber: @HooglyBoogly

Added subscriber: @HooglyBoogly
Member

@PratikPB2123 : have you done the cleanup [applying the booleans] in 3.2 (or a later build)?
If you do the same cleanup in 2.93, does it also crash?

In your backtracke, the root problem is the same : a borked mat_nr (this time on MPoly)

To me, this is caused by 1a6d0ec71c.
From that commit on, the original file asserts on open (see my stacktrace)
Applying boolean modifiers will leave those "invalid" mat_nr around.

Also found a simpler repro case:

  • cube with one material that is
  • booled by another cube (which has no material) that is
  • booled by another cube (which also has no material)
  • open file and do a stroke
  • crash
    T99191_repro.blend

And will raise prio since this looks like a regression to me.

CC @HooglyBoogly

@PratikPB2123 : have you done the cleanup [applying the booleans] in 3.2 (or a later build)? If you do the same cleanup in 2.93, does it also crash? In your backtracke, the root problem is the same : a borked `mat_nr` (this time on `MPoly`) To me, this is caused by 1a6d0ec71c. From that commit on, the original file asserts on open (see my stacktrace) Applying boolean modifiers will leave those "invalid" `mat_nr` around. Also found a simpler repro case: - cube with one material that is - booled by another cube (which has no material) that is - booled by another cube (which also has no material) - open file and do a stroke - crash [T99191_repro.blend](https://archive.blender.org/developer/F13235201/T99191_repro.blend) And will raise prio since this looks like a regression to me. CC @HooglyBoogly
Philipp Oeser changed title from Blender crashes when texture painting (caused by boolean modifers) to Regression: Blender crashes when texture painting (caused by boolean modifers) 2022-06-28 21:50:44 +02:00
Member

Not quite sure why those material_remaps Arrays always have a minimum size of 1?
Even if both participating objects dont have materials at all (nothing gets done with that array then)?
Could it be uninitialized memory (I do see all sorts of other indices in mat_nr, not only -1 ...)

Not quite sure why those `material_remaps` Arrays always have a minimum size of 1? Even if both participating objects dont have materials at all (nothing gets done with that array then)? Could it be uninitialized memory (I do see all sorts of other indices in mat_nr, not only -1 ...)
Member

Hmm, I think the invalid part might be that the material_remaps are created on the object level. Maybe it works in some cases, but I think including object-linked materials in these remaps is problematic and more trouble than its worth.
To me, object-level materials seem more like a post-evaluation step that shouldn't be considered when retrieving data from other objects.
I guess it depends how much behavior change we can accept, but to me the best/simplest solution is using the same code for remapping as the node.

Hmm, I think the invalid part might be that the `material_remaps` are created on the object level. Maybe it works in some cases, but I think including object-linked materials in these remaps is problematic and more trouble than its worth. To me, object-level materials seem more like a post-evaluation step that shouldn't be considered when retrieving data from other objects. I guess it depends how much behavior change we can accept, but to me the best/simplest solution is using the same code for remapping as the node.
Member

If you do the same cleanup in 2.93, does it also crash?

No crash if I do so.

> If you do the same cleanup in 2.93, does it also crash? No crash if I do so.
Member

#99371, #99349, #99174 seem to be other incarnations of this

#99371, #99349, #99174 seem to be other incarnations of this
Hans Goudey self-assigned this 2022-07-04 14:21:27 +02:00
Member

In #99191#1384506, @lichtwerk wrote:
#99371, #99349, #99174 seem to be other incarnations of this

#99322, #98705 also.

> In #99191#1384506, @lichtwerk wrote: > #99371, #99349, #99174 seem to be other incarnations of this #99322, #98705 also.

This issue was referenced by a2d59b2dac

This issue was referenced by a2d59b2dac9e68d158c11723a5cc30ecd4102804
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Member

Changed status from 'Resolved' to: 'Confirmed'

Changed status from 'Resolved' to: 'Confirmed'
Member

I'll reopen this until the patch is committed to master as well.

I'll reopen this until the patch is committed to master as well.

This issue was referenced by 5723bf926d

This issue was referenced by 5723bf926dcb387224dd0de2a4c562bc316e8edc
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#99191
No description provided.