Crash when trying to delete particle system or undo CTRL+Z #74786

Open
opened 2020-03-15 18:33:11 +01:00 by juan · 13 comments

Blender Version
Broken: version: 2.82 (sub 7), branch: master, commit date: 2020-03-12 05:06, hash: 375c7dc4ca
Worked: 2.79

Short description of error
After updating from 2.79 to 2.8 this file file crashes when I try to delete the Plane. When I go to Edit mode, trying to rotate, grab or do anything it crashes. Plane has a particle system on it. When i try to delete it crashes too. Basically if i touch the Plane in any way it will crash and there is no way to get rid off it. Cannot delete the particle system either. Also, when i try to undo the last step CTRL it also makes it crash.

Exact steps for others to reproduce the error

  • Open the attached file
  • Try to delete the plane or its particle system
    Crash.

T74786_2-83.blend

**Blender Version** Broken: version: 2.82 (sub 7), branch: master, commit date: 2020-03-12 05:06, hash: `375c7dc4ca` Worked: 2.79 **Short description of error** After updating from 2.79 to 2.8 this file file crashes when I try to delete the Plane. When I go to Edit mode, trying to rotate, grab or do anything it crashes. Plane has a particle system on it. When i try to delete it crashes too. Basically if i touch the Plane in any way it will crash and there is no way to get rid off it. Cannot delete the particle system either. Also, when i try to undo the last step CTRL it also makes it crash. **Exact steps for others to reproduce the error** - Open the attached file - Try to delete the plane or its particle system Crash. [T74786_2-83.blend](https://archive.blender.org/developer/F8415319/T74786_2-83.blend)
Author

Added subscriber: @kokotek

Added subscriber: @kokotek

Added subscriber: @mano-wii

Added subscriber: @mano-wii

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

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

Something is wrong with the attached file.
Please submit again.

Something is wrong with the attached file. Please submit again.
Member

Added subscriber: @ankitm

Added subscriber: @ankitm
Member

https://developer.blender.org/file/edit/8408189
change the file view permissions

https://developer.blender.org/file/edit/8408189 change the file view permissions
Author

crash plane.blend

I chaned in 'Get info' read and write to 'Everyone'. Is that what you meant? Sorry, this is the first time I'm submitting

[crash plane.blend](https://archive.blender.org/developer/F8414501/crash_plane.blend) I chaned in 'Get info' read and write to 'Everyone'. Is that what you meant? Sorry, this is the first time I'm submitting
Member

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

Changed status from 'Needs User Info' to: 'Confirmed'
Member
Couldn't unmap memory
Blender(1776,0x11c3135c0) malloc: *** error for object 0x600003c82060: pointer being freed was not allocated
Blender(1776,0x11c3135c0) malloc: *** set a breakpoint in malloc_error_break to debug
(lldb) 
- 5	 in MEM_lockfree_freeN at blender/intern/guardedalloc/intern/mallocn_lockfree_impl.c:157
- 6	 in free_hair at blender/source/blender/blenkernel/intern/particle.c:578
- 7	 in psys_free at blender/source/blender/blenkernel/intern/particle.c:738
- 8	 in BKE_object_free_particlesystems at blender/source/blender/blenkernel/intern/object.c:403
- 9	 in BKE_object_free_modifiers at blender/source/blender/blenkernel/intern/object.c:439
- 10	 in object_free_data at blender/source/blender/blenkernel/intern/object.c:279
- 11	 in BKE_libblock_free_datablock at blender/source/blender/blenkernel/intern/lib_id_delete.c:132
- 12	 in DEG::deg_free_copy_on_write_datablock(ID*) at blender/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc:1071
- 13	 in DEG::(anonymous namespace)::free_copy_on_write_datablock(void*) at blender/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc:126
- 14	 in ghash_free_cb at blender/source/blender/blenlib/intern/BLI_ghash.c:652
- 15	 in BLI_ghash_free at blender/source/blender/blenlib/intern/BLI_ghash.c:1025
- 16	 in DEG::DepsgraphNodeBuilder::~DepsgraphNodeBuilder() at blender/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc:155
- 17	 in DEG::DepsgraphNodeBuilder::~DepsgraphNodeBuilder() at blender/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc:153
- 18	 in ::DEG_graph_build_from_view_layer(Depsgraph *, Main *, Scene *, ViewLayer *) at blender/source/blender/depsgraph/intern/depsgraph_build.cc:261
- 19	 in ::DEG_graph_relations_update(Depsgraph *, Main *, Scene *, ViewLayer *) at blender/source/blender/depsgraph/intern/depsgraph_build.cc:499
- 20	 in scene_graph_update_tagged at blender/source/blender/blenkernel/intern/scene.c:1306
- 21	 in BKE_scene_graph_update_tagged at blender/source/blender/blenkernel/intern/scene.c:1353
- 22	 in wm_event_do_depsgraph at blender/source/blender/windowmanager/intern/wm_event_system.c:359
- 23	 in wm_event_do_refresh_wm_and_depsgraph at blender/source/blender/windowmanager/intern/wm_event_system.c:385
- 24	 in wm_event_do_notifiers at blender/source/blender/windowmanager/intern/wm_event_system.c:550
- 25	 in WM_main at blender/source/blender/windowmanager/intern/wm.c:450
- 26	 in main at blender/source/creator/creator.c:522

I copied the contents in a 2.83 empty file & even things like changing visibility of plane crashes it. T74786_2-83.blend

``` Couldn't unmap memory Blender(1776,0x11c3135c0) malloc: *** error for object 0x600003c82060: pointer being freed was not allocated Blender(1776,0x11c3135c0) malloc: *** set a breakpoint in malloc_error_break to debug (lldb) ``` ```lines=7 - 5 in MEM_lockfree_freeN at blender/intern/guardedalloc/intern/mallocn_lockfree_impl.c:157 - 6 in free_hair at blender/source/blender/blenkernel/intern/particle.c:578 - 7 in psys_free at blender/source/blender/blenkernel/intern/particle.c:738 - 8 in BKE_object_free_particlesystems at blender/source/blender/blenkernel/intern/object.c:403 - 9 in BKE_object_free_modifiers at blender/source/blender/blenkernel/intern/object.c:439 - 10 in object_free_data at blender/source/blender/blenkernel/intern/object.c:279 - 11 in BKE_libblock_free_datablock at blender/source/blender/blenkernel/intern/lib_id_delete.c:132 - 12 in DEG::deg_free_copy_on_write_datablock(ID*) at blender/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc:1071 - 13 in DEG::(anonymous namespace)::free_copy_on_write_datablock(void*) at blender/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc:126 - 14 in ghash_free_cb at blender/source/blender/blenlib/intern/BLI_ghash.c:652 - 15 in BLI_ghash_free at blender/source/blender/blenlib/intern/BLI_ghash.c:1025 - 16 in DEG::DepsgraphNodeBuilder::~DepsgraphNodeBuilder() at blender/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc:155 - 17 in DEG::DepsgraphNodeBuilder::~DepsgraphNodeBuilder() at blender/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc:153 - 18 in ::DEG_graph_build_from_view_layer(Depsgraph *, Main *, Scene *, ViewLayer *) at blender/source/blender/depsgraph/intern/depsgraph_build.cc:261 - 19 in ::DEG_graph_relations_update(Depsgraph *, Main *, Scene *, ViewLayer *) at blender/source/blender/depsgraph/intern/depsgraph_build.cc:499 - 20 in scene_graph_update_tagged at blender/source/blender/blenkernel/intern/scene.c:1306 - 21 in BKE_scene_graph_update_tagged at blender/source/blender/blenkernel/intern/scene.c:1353 - 22 in wm_event_do_depsgraph at blender/source/blender/windowmanager/intern/wm_event_system.c:359 - 23 in wm_event_do_refresh_wm_and_depsgraph at blender/source/blender/windowmanager/intern/wm_event_system.c:385 - 24 in wm_event_do_notifiers at blender/source/blender/windowmanager/intern/wm_event_system.c:550 - 25 in WM_main at blender/source/blender/windowmanager/intern/wm.c:450 - 26 in main at blender/source/creator/creator.c:522 ``` I copied the contents in a 2.83 empty file & even things like changing visibility of plane crashes it. [T74786_2-83.blend](https://archive.blender.org/developer/F8415319/T74786_2-83.blend)
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Member

Ok, so the issue here is that the particles have hair data, even though though they are not hair particles.

When the COW copy is made by the depsgraph, it will make a shallow copy of the particle_data->hair pointer. If the particle system type would be Hair, it would make deep copies of the hair data for every particle. Now, when the particle system is removed, it will remove the hair data on the original object and on the cow object. Since both are pointing to the same hair data, there is a double free.

Possible solutions:

  • Change psys_copy_particles so that it either always copies the hair data, or sets the hair data to null on every particle.
  • Fix the .blend file in readfile.c. Doing that is a bit tricky, because the particle type is not known during direct linking afaik. So, it would have to be done during/after library linking.
  • Fix the .blend file in versioning. This does not solve the issue when it is created in new files. This only makes sense when we figure out why the hair data exists per particle in the first place.

I couldn't figure out where this incorrect particle state comes from, yet. I was not able to reproduce it from scratch in a new file.

@kokotek @ankitm, is one of you able to reproduce the issue in a new file, without copying anything from another file?

Ok, so the issue here is that the particles have hair data, even though though they are not hair particles. When the COW copy is made by the depsgraph, it will make a shallow copy of the `particle_data->hair` pointer. If the particle system type would be `Hair`, it would make deep copies of the hair data for every particle. Now, when the particle system is removed, it will remove the hair data on the original object and on the cow object. Since both are pointing to the same hair data, there is a double free. Possible solutions: * Change `psys_copy_particles` so that it either always copies the hair data, or sets the hair data to `null` on every particle. * Fix the .blend file in `readfile.c`. Doing that is a bit tricky, because the particle type is not known during direct linking afaik. So, it would have to be done during/after library linking. * Fix the .blend file in versioning. This does not solve the issue when it is created in new files. This only makes sense when we figure out why the hair data exists per particle in the first place. I couldn't figure out where this incorrect particle state comes from, yet. I was not able to reproduce it from scratch in a new file. @kokotek @ankitm, is one of you able to reproduce the issue in a new file, without copying anything from another file?
Member

is one of you able to reproduce the issue in a new file, without copying anything from another file?

If it's just adding a plane and applying a particle modifier to it, then no. I can move it around, change its visibility, get nice bubbles out of it, make it hair, back to emitter etc.

Also, the original file will crash if you open it, click in viewport, attempt to close it and pick "don't save" . Though that can be the undo step as said in the report.

> is one of you able to reproduce the issue in a new file, without copying anything from another file? If it's just adding a plane and applying a particle modifier to it, then no. I can move it around, change its visibility, get nice bubbles out of it, make it hair, back to emitter etc. Also, the original file will crash if you open it, click in viewport, attempt to close it and pick "don't save" . Though that can be the undo step as said in the report.
Author

Same thing here, in a new file everything works fine, lets me add particle system , emitter, hair...works ok.
when I append the problematic Plane from Crash plane file i will crash straight away.

Same thing here, in a new file everything works fine, lets me add particle system , emitter, hair...works ok. when I append the problematic Plane from Crash plane file i will crash straight away.
Philipp Oeser removed the
Interest
Nodes & Physics
label 2023-02-10 08:47:03 +01:00
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
4 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#74786
No description provided.