Page MenuHome

Blender crashes when I import an .OBJ file during a frame_change_pre callback while rendering an animation
Closed, DuplicatePublic

Description

System Information
Operating system: Windows 10, 64-bit
Graphics card: NVIDIA Quadro M1200

Blender Version
Broken: 2.82

Short description of error
If I try to import an OBJ file in a frame_change_pre callback function while rendering an animation, Blender crashes after a few frames.

Exact steps for others to reproduce the error
Start Blender in debug mode: ./blender.exe --debug --debug-memory --debug-python
Get a hold of a sequence of .OBJ files, each with file numbers (e.g. mesh_0.obj, mesh_1.obj, mesh_2.obj, etc.): https://drive.google.com/open?id=11OGN-H6K9QgtDgBTXSRQ0nMCvNZuBcz8
Create a script, add the following code, providing a path to your mesh sequence:

import bpy
import os
def load_mesh(dummy):
    frameNum = bpy.context.scene.frame_current
    filePath = os.path.join("path\to\file", "filePrefix_" + str(frameNum) + ".obj")
    bpy.ops.import_scene.obj(filepath=filePath)

bpy.app.handlers.frame_change_pre.append(load_mesh)

Click the "Run Script" button

Start rendering an animation (Ctrl+F12). After a few frames, Blender will crash. The console sometimes has the following error:

mesh_ensure_tessellation_customdata: warning! Tessellation uvs or vcol data got out of sync, had to reset!
    CD_MTFACE: 0 != CD_MLOOPUV: 1 || CD_MCOL: 0 != CD_MLOOPCOL: 0

I also get this error in every case:

Error   : EXCEPTION_ACCESS_VIOLATION
Address : 0x00007FF7853369BF
Module  : C:\Program Files\Blender Foundation\Blender 2.82\blender.exe

This script works fine if I play the animation in the 3D viewport, but fails and crashes when I try to run it while rendering an animation.

Event Timeline

Can you please upload animation to site, where registration is not required? Like google docs for example.

crash on frame 10, because only on 10th frame mesh is actually loaded

crashed (thread):

id_node was freed

>	blender.exe!DEG_graph_tag_relations_update(Depsgraph * graph) Line 487	C++
 	blender.exe!DEG_relations_tag_update(Main * bmain) Line 508	C++
 	blender.exe!rna_Material_use_nodes_update(bContext * C, PointerRNA * ptr) Line 201	C
 	blender.exe!rna_property_update(bContext * C, Main * bmain, Scene * scene, PointerRNA * ptr, PropertyRNA * prop) Line 2235	C
 	blender.exe!RNA_property_update(bContext * C, PointerRNA * ptr, PropertyRNA * prop) Line 2304	C
 	blender.exe!pyrna_py_to_prop(PointerRNA * ptr, PropertyRNA * prop, void * data, _object * value, const unsigned char * error_prefix) Line 2208	C
 	blender.exe!pyrna_struct_setattro(BPy_StructRNA * self, _object * pyname, _object * value) Line 4521	C
 	[Externí kód]	
 	blender.exe!bpy_class_call(bContext * C, PointerRNA * ptr, FunctionRNA * func, ParameterList * parms) Line 8325	C
 	blender.exe!rna_operator_execute_cb(bContext * C, wmOperator * op) Line 1307	C
 	blender.exe!wm_operator_invoke(bContext * C, wmOperatorType * ot, wmEvent * event, PointerRNA * properties, ReportList * reports, const bool poll_only, bool use_last_properties) Line 1279	C
 	blender.exe!wm_operator_call_internal(bContext * C, wmOperatorType * ot, PointerRNA * properties, ReportList * reports, const short context, const bool poll_only, wmEvent * event) Line 1514	C
 	blender.exe!WM_operator_call_py(bContext * C, wmOperatorType * ot, short context, PointerRNA * properties, ReportList * reports, const bool is_undo) Line 1614	C
 	blender.exe!pyop_call(_object * UNUSED_self, _object * args) Line 268	C
 	[Externí kód]	
 	blender.exe!bpy_app_generic_callback(Main * UNUSED_main, PointerRNA * * pointers, const int num_pointers, void * arg) Line 344	C
 	blender.exe!BKE_callback_exec(Main * bmain, PointerRNA * * pointers, const int num_pointers, eCbEvent evt) Line 43	C
 	blender.exe!BKE_callback_exec_id(Main * bmain, ID * id, eCbEvent evt) Line 59	C
 	blender.exe!BKE_scene_graph_update_for_newframe(Depsgraph * depsgraph, Main * bmain) Line 1412	C
 	blender.exe!engine_depsgraph_init(RenderEngine * engine, ViewLayer * view_layer) Line 525	C
 	blender.exe!RE_engine_render(Render * re, int do_all) Line 770	C
 	blender.exe!do_render_3d(Render * re) Line 1166	C
 	blender.exe!do_render(Render * re) Line 1245	C
 	blender.exe!do_render_composite(Render * re) Line 1464	C
 	blender.exe!do_render_all_options(Render * re) Line 1729	C
 	blender.exe!RE_RenderAnim(Render * re, Main * bmain, Scene * scene, ViewLayer * single_layer, Object * camera_override, int sfra, int efra, int tfra) Line 2689	C
 	blender.exe!render_startjob(void * rjv, short * stop, short * do_update, float * progress) Line 668	C
 	blender.exe!do_job_thread(void * job_v) Line 384	C
 	blender.exe!tslot_thread_start(void * tslot_p) Line 261	C
 	[Externí kód]

main (seems to cause race condition):

>	blender.exe!DEG::Node::~Node() Line 302	C++
 	blender.exe!DEG::OperationNode::~OperationNode() Line 205	C++
 	[Externí kód]	
 	blender.exe!OBJECT_GUARDED_DESTRUCTOR<DEG::OperationNode>(DEG::OperationNode * what) Line 265	C++
 	blender.exe!DEG::ComponentNode::clear_operations() Line 248	C++
 	blender.exe!DEG::ComponentNode::~ComponentNode() Line 122	C++
 	[Externí kód]	
 	blender.exe!OBJECT_GUARDED_DESTRUCTOR<DEG::ComponentNode>(DEG::ComponentNode * what) Line 265	C++
 	blender.exe!DEG::id_deps_node_hash_value_free(void * value_v) Line 98	C++
 	blender.exe!ghash_free_cb(GHash * gh, void(*)(void *) keyfreefp, void(*)(void *) valfreefp) Line 654	C
 	blender.exe!BLI_ghash_free(GHash * gh, void(*)(void *) keyfreefp, void(*)(void *) valfreefp) Line 1028	C
 	blender.exe!DEG::IDNode::destroy() Line 164	C++
 	blender.exe!DEG::IDNode::~IDNode() Line 152	C++
 	[Externí kód]	
 	blender.exe!OBJECT_GUARDED_DESTRUCTOR<DEG::IDNode>(DEG::IDNode * what) Line 265	C++
 	blender.exe!DEG::Depsgraph::clear_id_nodes() Line 170	C++
 	blender.exe!DEG::Depsgraph::clear_all_nodes() Line 242	C++
 	blender.exe!DEG::DepsgraphNodeBuilder::begin_build() Line 352	C++
 	blender.exe!DEG_graph_build_from_view_layer(Depsgraph * graph, Main * bmain, Scene * scene, ViewLayer * view_layer) Line 247	C++
 	blender.exe!DEG_graph_relations_update(Depsgraph * graph, Main * bmain, Scene * scene, ViewLayer * view_layer) Line 500	C++
 	blender.exe!scene_graph_update_tagged(Depsgraph * depsgraph, Main * bmain, bool only_if_tagged) Line 1352	C
 	blender.exe!BKE_scene_graph_update_tagged(Depsgraph * depsgraph, Main * bmain) Line 1396	C
 	blender.exe!wm_event_do_depsgraph(bContext * C, bool is_after_open_file) Line 360	C
 	blender.exe!wm_event_do_refresh_wm_and_depsgraph(bContext * C) Line 387	C
 	blender.exe!wm_event_do_notifiers(bContext * C) Line 553	C
 	blender.exe!WM_main(bContext * C) Line 424	C
 	blender.exe!main(int argc, const unsigned char * * UNUSED_argv_c) Line 520	C
Richard Antalik (ISS) changed the task status from Needs Triage to Confirmed.Feb 26 2020, 7:17 PM