Object.to_mesh(preserve_all_data_layers=True, depsgraph=depsgraph) with no modifiers or shapekeys = crash #65285

Closed
opened 2019-05-29 23:51:37 +02:00 by Tom Wilson · 12 comments

Blender Version
Broken: blender-2.80.0-git.89207df7222a-windows64

Short description of error
I'm running a mesh export operator that uses the Object.to_mesh(preserve_all_data_layers=True, depsgraph=depsgraph) function with parameters so vertex groups carry over to the new mesh. And I always end with Object.to_mesh_clear().
But if I run the operator on an object with no modifiers or shapekeys, it crashes.
I've tried to chase down the exact point it crashes through a debugger, but it's random, it crashes at different lines of code which don't relate to the cause. No matter what though, it crashes before the operator finishes.
If I add a modifier or shape key to the object in question, it does not crash.
Or if I use Object.to_mesh() without parameters, no crash.
Or if I run a snippet of my operator's problmatic code in the script area, no crash.

I'm sorry I can't provide an example right now, I've tried to recreate it in a simple blend script but I can only trigger the crash in an addon that I'm working on.
Hopefully someone could look into the recently made changes and spot the bug that's causing Blender to become unstable after calling this function on simple objects.

Update:
Running Blender in debug mode prevents crashing, but I get the following error in the console during each operation:

Memoryblock CDMVert: double free
Memoryblock free: pointer not in memlist

Update 2:
I tried the latest release with the material bug fix (#65238), still no luck.
I also tried running blender_debug_log.cmd, when it crashes I get the following error:

Error   : EXCEPTION_ACCESS_VIOLATION
Address : 0x00007FF68B0302D8
Module  : C:\Dev\Blender\blender-2.80.0\blender.exe
**Blender Version** Broken: blender-2.80.0-git.89207df7222a-windows64 **Short description of error** I'm running a mesh export operator that uses the Object.to_mesh(preserve_all_data_layers=True, depsgraph=depsgraph) function with parameters so vertex groups carry over to the new mesh. And I always end with Object.to_mesh_clear(). But if I run the operator on an object with no modifiers or shapekeys, it crashes. I've tried to chase down the exact point it crashes through a debugger, but it's random, it crashes at different lines of code which don't relate to the cause. No matter what though, it crashes before the operator finishes. If I add a modifier or shape key to the object in question, it does not crash. Or if I use Object.to_mesh() without parameters, no crash. Or if I run a snippet of my operator's problmatic code in the script area, no crash. I'm sorry I can't provide an example right now, I've tried to recreate it in a simple blend script but I can only trigger the crash in an addon that I'm working on. Hopefully someone could look into the recently made changes and spot the bug that's causing Blender to become unstable after calling this function on simple objects. Update: Running Blender in debug mode prevents crashing, but I get the following error in the console during each operation: ``` Memoryblock CDMVert: double free Memoryblock free: pointer not in memlist ``` Update 2: I tried the latest release with the material bug fix (#65238), still no luck. I also tried running blender_debug_log.cmd, when it crashes I get the following error: ``` Error : EXCEPTION_ACCESS_VIOLATION Address : 0x00007FF68B0302D8 Module : C:\Dev\Blender\blender-2.80.0\blender.exe ```
Author

Added subscriber: @hedgehog90-3

Added subscriber: @hedgehog90-3
Sergey Sharybin self-assigned this 2019-05-30 13:36:24 +02:00

This issue was referenced by 963917e1b9

This issue was referenced by 963917e1b9beaa8dc0863f1e4a9b54620d3610fa

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Author

Unfortunately it's still crashing for me for objects without modifiers or shapekeys, and I'm building from the latest source.

"Memoryblock free: pointer not in memlist"

I've never tried debugging from source but I will give it a go and maybe see if I can pin point the issue further.

Unfortunately it's still crashing for me for objects without modifiers or shapekeys, and I'm building from the latest source. "Memoryblock free: pointer not in memlist" I've never tried debugging from source but I will give it a go and maybe see if I can pin point the issue further.
Author

Changed status from 'Resolved' to: 'Open'

Changed status from 'Resolved' to: 'Open'

Provide the simple .blend file and script which demonstrates the issue.

Provide the simple .blend file and script which demonstrates the issue.
Author

Here's the stack trace when it crashes:

blender.exe!issue_debug_notification(const wchar_t * const message) Line 28
	at minkernel\crts\ucrt\src\appcrt\internal\report_runtime_error.cpp(28)
blender.exe!__acrt_report_runtime_error(const wchar_t * message) Line 154
	at minkernel\crts\ucrt\src\appcrt\internal\report_runtime_error.cpp(154)
blender.exe!abort() Line 61
	at minkernel\crts\ucrt\src\appcrt\startup\abort.cpp(61)
blender.exe!bpy_bmesh_to_mesh(BPy_BMesh * self, _object * args) Line 1092
	at c:\dev\blender\blender\blender\source\blender\python\bmesh\bmesh_py_types.c(1092)
[External Code]
blender.exe!bpy_class_call(bContext * C, PointerRNA * ptr, FunctionRNA * func, ParameterList * parms) Line 8276
	at c:\dev\blender\blender\blender\source\blender\python\intern\bpy_rna.c(8276)
blender.exe!rna_operator_execute_cb(bContext * C, wmOperator * op) Line 1282
	at c:\dev\blender\blender\blender\source\blender\makesrna\intern\rna_wm.c(1282)
blender.exe!wm_handler_fileselect_do(bContext * C, ListBase * handlers, wmEventHandler_Op * handler, int val) Line 2394
	at c:\dev\blender\blender\blender\source\blender\windowmanager\intern\wm_event_system.c(2394)
blender.exe!wm_handler_fileselect_call(bContext * C, ListBase * handlers, wmEventHandler_Op * handler, const wmEvent * event) Line 2493
	at c:\dev\blender\blender\blender\source\blender\windowmanager\intern\wm_event_system.c(2493)
blender.exe!wm_handlers_do_intern(bContext * C, wmEvent * event, ListBase * handlers) Line 2807
	at c:\dev\blender\blender\blender\source\blender\windowmanager\intern\wm_event_system.c(2807)
blender.exe!wm_handlers_do(bContext * C, wmEvent * event, ListBase * handlers) Line 2859
	at c:\dev\blender\blender\blender\source\blender\windowmanager\intern\wm_event_system.c(2859)
blender.exe!wm_event_do_handlers(bContext * C) Line 3223
	at c:\dev\blender\blender\blender\source\blender\windowmanager\intern\wm_event_system.c(3223)
blender.exe!WM_main(bContext * C) Line 420
	at c:\dev\blender\blender\blender\source\blender\windowmanager\intern\wm.c(420)
blender.exe!main(int argc, const unsigned char * * UNUSED_argv_c) Line 502
	at c:\dev\blender\blender\blender\source\creator\creator.c(502)
[External Code]

It appears to be happening in the middle of BM_mesh_bm_to_me(), however in visual studio the current line is pointing to an BLI assertion above the call.

Here's the stack trace when it crashes: ``` blender.exe!issue_debug_notification(const wchar_t * const message) Line 28 at minkernel\crts\ucrt\src\appcrt\internal\report_runtime_error.cpp(28) blender.exe!__acrt_report_runtime_error(const wchar_t * message) Line 154 at minkernel\crts\ucrt\src\appcrt\internal\report_runtime_error.cpp(154) blender.exe!abort() Line 61 at minkernel\crts\ucrt\src\appcrt\startup\abort.cpp(61) blender.exe!bpy_bmesh_to_mesh(BPy_BMesh * self, _object * args) Line 1092 at c:\dev\blender\blender\blender\source\blender\python\bmesh\bmesh_py_types.c(1092) [External Code] blender.exe!bpy_class_call(bContext * C, PointerRNA * ptr, FunctionRNA * func, ParameterList * parms) Line 8276 at c:\dev\blender\blender\blender\source\blender\python\intern\bpy_rna.c(8276) blender.exe!rna_operator_execute_cb(bContext * C, wmOperator * op) Line 1282 at c:\dev\blender\blender\blender\source\blender\makesrna\intern\rna_wm.c(1282) blender.exe!wm_handler_fileselect_do(bContext * C, ListBase * handlers, wmEventHandler_Op * handler, int val) Line 2394 at c:\dev\blender\blender\blender\source\blender\windowmanager\intern\wm_event_system.c(2394) blender.exe!wm_handler_fileselect_call(bContext * C, ListBase * handlers, wmEventHandler_Op * handler, const wmEvent * event) Line 2493 at c:\dev\blender\blender\blender\source\blender\windowmanager\intern\wm_event_system.c(2493) blender.exe!wm_handlers_do_intern(bContext * C, wmEvent * event, ListBase * handlers) Line 2807 at c:\dev\blender\blender\blender\source\blender\windowmanager\intern\wm_event_system.c(2807) blender.exe!wm_handlers_do(bContext * C, wmEvent * event, ListBase * handlers) Line 2859 at c:\dev\blender\blender\blender\source\blender\windowmanager\intern\wm_event_system.c(2859) blender.exe!wm_event_do_handlers(bContext * C) Line 3223 at c:\dev\blender\blender\blender\source\blender\windowmanager\intern\wm_event_system.c(3223) blender.exe!WM_main(bContext * C) Line 420 at c:\dev\blender\blender\blender\source\blender\windowmanager\intern\wm.c(420) blender.exe!main(int argc, const unsigned char * * UNUSED_argv_c) Line 502 at c:\dev\blender\blender\blender\source\creator\creator.c(502) [External Code] ``` It appears to be happening in the middle of BM_mesh_bm_to_me(), however in visual studio the current line is pointing to an BLI assertion above the call.
Author

In #65285#692093, @Sergey wrote:
Provide the simple .blend file and script which demonstrates the issue.

I tried to simplify the script to the problematic to_mesh() call within the addon script, but it would never trigger the crash if run in isolation.

So I've included the addon directory, the blend file, and inside the blend file a script that will install the addon and run it, triggering the crash.

godot-blender-exporter.zip

> In #65285#692093, @Sergey wrote: > Provide the simple .blend file and script which demonstrates the issue. I tried to simplify the script to the problematic to_mesh() call within the addon script, but it would never trigger the crash if run in isolation. So I've included the addon directory, the blend file, and inside the blend file a script that will install the addon and run it, triggering the crash. [godot-blender-exporter.zip](https://archive.blender.org/developer/F7081192/godot-blender-exporter.zip)

In order for the bug to be fixed we need to be able to reproduce it. Stack trace is not enough.

In order for the bug to be fixed we need to be able to reproduce it. Stack trace is not enough.

Oh, think i've replied at the same time a you've been writing a followup.
After some tinkering around managed to get everything installed. Not sure yet what;s going on. Seems like bpy_bmesh_to_mesh doesn't like meshes which are not in the main database. Need to understand reasoning behind that.

Oh, think i've replied at the same time a you've been writing a followup. After some tinkering around managed to get everything installed. Not sure yet what;s going on. Seems like `bpy_bmesh_to_mesh` doesn't like meshes which are not in the main database. Need to understand reasoning behind that.

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Committed fix in 72a563c.

if there are more issue please make a new report. Otherwise keeping track of the issues becomes tricky.

Committed fix in 72a563c. if there are more issue please make a new report. Otherwise keeping track of the issues becomes tricky.
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
3 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#65285
No description provided.