Page MenuHome

"RENDER_OT_render" called with "EXEC_DEFAULT" freezes Blender with Eevee motion blur enabled
Confirmed, NormalPublicBUG

Description

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce RTX 2080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 451.67

Blender Version
Broken: version: 2.90.0 Beta, branch: master, commit date: 2020-08-17 19:04, hash: rBe157573fab2a
Worked: (newest version of Blender that worked as expected)

Short description of error
bpy.ops.render.render() called without 'INVOKE_DEFAULT' from the Python Console or script freezes Blender when Eevee motion blur is enabled.
And the same issue is in the 2.91 Alpha version.


Exact steps for others to reproduce the error

  • Open Blender
  • Make sure context scene render engine is Eevee
  • Turn on motion blur
  • Open Python console
  • type in bpy.ops.render.render() and hit enter

*Edit* (added method that doesn't activate via Python).

Exact steps to reproduce the error without activating from Python.

  • Open Blender
  • Make sure context scene render engine is Eevee
  • Turn on motion blur
  • Run this script in the text editor
import bpy
def menu_func_import(self, context):
    layout = self.layout
    layout.operator_context = 'EXEC_DEFAULT'
    layout.operator("render.render", text="Blocking Render")
bpy.types.TOPBAR_MT_render.append(menu_func_import)
  • Run "Render -> Blocking Render" from the top-bar.

Event Timeline

Robert Guetzkow (rjg) changed the task status from Needs Triage to Confirmed.Aug 18 2020, 8:13 PM

I can reproduce this. The 2.83.4 release is unaffected though.

Tagging this as a bug as @Germano Cavalcante (mano-wii) did for T80373.

Quoting Germano’s commit from that report as it contains a stack trace.

I can confirm.
The problem is "solved" if I add an "INVOKE_DEFAULT" to the operator.

 	[External Code]	
>	blender.exe!BLI_ticket_mutex_lock(TicketMutex * ticket) Line 584	C++
 	blender.exe!DRW_notify_view_update(const DRWUpdateContext * update_ctx) Line 1240	C
 	blender.exe!ED_render_scene_update(const DEGEditorUpdateContext * update_ctx, int updated) Line 119	C
 	blender.exe!DEG_ids_check_recalc(Main * bmain, Depsgraph * depsgraph, Scene * scene, ViewLayer * view_layer, bool time) Line 830	C++
 	blender.exe!BKE_scene_graph_update_for_newframe(Depsgraph * depsgraph) Line 1598	C
 	blender.exe!RE_engine_frame_set(RenderEngine * engine, int frame, float subframe) Line 642	C
 	blender.exe!DRW_render_set_time(RenderEngine * engine, Depsgraph * depsgraph, int frame, float subframe) Line 1954	C
 	blender.exe!eevee_render_to_image(void * vedata, RenderEngine * engine, RenderLayer * render_layer, const rcti * rect) Line 484	C
 	blender.exe!DRW_render_to_image(RenderEngine * engine, Depsgraph * depsgraph) Line 1779	C
 	blender.exe!RE_engine_render(Render * re, int do_all) Line 880	C
 	blender.exe!do_render(Render * re) Line 1216	C
 	blender.exe!do_render_composite(Render * re) Line 1354	C
 	blender.exe!do_render_all_options(Render * re) Line 1616	C
 	blender.exe!RE_RenderFrame(Render * re, Main * bmain, Scene * scene, ViewLayer * single_layer, Object * camera_override, int frame, const bool write_still) Line 2015	C
 	blender.exe!screen_render_exec(bContext * C, wmOperator * op) Line 364	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 1312	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 1547	C
 	blender.exe!WM_operator_call_py(bContext * C, wmOperatorType * ot, short context, PointerRNA * properties, ReportList * reports, const bool is_undo) Line 1644	C
 	blender.exe!pyop_call(_object * UNUSED_self, _object * args) Line 279	C
 	python37.dll!_PyMethodDef_RawFastCallKeywords(PyMethodDef * method, _object * self, _object * const * args, __int64 nargs, _object * kwnames) Line 698	C
 	[Inline Frame] python37.dll!_PyCFunction_FastCallKeywords(_object *) Line 734	C
 	python37.dll!call_function(_object * * * pp_stack, __int64 oparg, _object * kwnames) Line 4568	C
 	python37.dll!_PyEval_EvalFrameDefault(_frame * f, int throwflag) Line 3125	C
 	[Inline Frame] python37.dll!PyEval_EvalFrameEx(_frame *) Line 547	C
 	python37.dll!_PyEval_EvalCodeWithName(_object * _co, _object * globals, _object * locals, _object * const * args, __int64 argcount, _object * const * kwnames, _object * const * kwargs, __int64 kwcount, int kwstep, _object * const * defs, __int64 defcount, _object * kwdefs, _object * closure, _object * name, _object * qualname) Line 3930	C
 	python37.dll!_PyFunction_FastCallDict(_object * func, _object * const * args, __int64 nargs, _object * kwargs) Line 376	C
 	python37.dll!_PyObject_Call_Prepend(_object * callable, _object * obj, _object * args, _object * kwargs) Line 908	C
 	python37.dll!slot_tp_call(_object * self, _object * args, _object * kwds) Line 6403	C
 	python37.dll!_PyObject_FastCallKeywords(_object * callable, _object * const * stack, __int64 nargs, _object * kwnames) Line 201	C
 	python37.dll!call_function(_object * * * pp_stack, __int64 oparg, _object * kwnames) Line 4627	C
 	python37.dll!_PyEval_EvalFrameDefault(_frame * f, int throwflag) Line 3140	C
 	[Inline Frame] python37.dll!PyEval_EvalFrameEx(_frame *) Line 547	C
 	python37.dll!_PyEval_EvalCodeWithName(_object * _co, _object * globals, _object * locals, _object * const * args, __int64 argcount, _object * const * kwnames, _object * const * kwargs, __int64 kwcount, int kwstep, _object * const * defs, __int64 defcount, _object * kwdefs, _object * closure, _object * name, _object * qualname) Line 3930	C
 	[Inline Frame] python37.dll!PyEval_EvalCodeEx(_object *) Line 3959	C
 	python37.dll!PyEval_EvalCode(_object * co, _object * globals, _object * locals) Line 530	C
 	blender.exe!python_script_exec(bContext * C, const unsigned char * fn, Text * text, ReportList * reports, const bool do_jump) Line 127	C
 	blender.exe!BPY_run_text(bContext * C, Text * text, ReportList * reports, const bool do_jump) Line 222	C
 	blender.exe!text_run_script(bContext * C, ReportList * reports) Line 760	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 1312	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 1516	C
 	blender.exe!WM_operator_name_call_ptr(bContext * C, wmOperatorType * ot, short context, PointerRNA * properties) Line 1562	C
 	blender.exe!ui_apply_but_funcs_after(bContext * C) Line 925	C
 	blender.exe!ui_handler_region_menu(bContext * C, const wmEvent * event, void * UNUSED_userdata) Line 10732	C
 	blender.exe!wm_handler_ui_call(bContext * C, wmEventHandler_UI * handler, const wmEvent * event, int always_pass) Line 641	C
 	blender.exe!wm_handlers_do_intern(bContext * C, wmEvent * event, ListBase * handlers) Line 2756	C
 	blender.exe!wm_handlers_do(bContext * C, wmEvent * event, ListBase * handlers) Line 2868	C
 	blender.exe!wm_event_do_handlers(bContext * C) Line 3292	C
 	blender.exe!WM_main(bContext * C) Line 485	C
 	blender.exe!main(int argc, const unsigned char * * UNUSED_argv_c) Line 531	C
 	[External Code]
Evan Wilson (EAW) changed the subtype of this task from "Report" to "Bug".Sep 4 2020, 3:32 AM

Confirmed, note that this isn't Python spesific, removed Python project.

Campbell Barton (campbellbarton) renamed this task from bpy.ops.render.render() called from console or script freezes Blender with Eevee motion blur enabled to bpy.ops.render.render() called with "EXEC_DEFAULT" or script freezes Blender with Eevee motion blur enabled.Sep 12 2020, 3:13 AM
Campbell Barton (campbellbarton) renamed this task from bpy.ops.render.render() called with "EXEC_DEFAULT" or script freezes Blender with Eevee motion blur enabled to "RENDER_OT_render" called with "EXEC_DEFAULT" or script freezes Blender with Eevee motion blur enabled.
Campbell Barton (campbellbarton) renamed this task from "RENDER_OT_render" called with "EXEC_DEFAULT" or script freezes Blender with Eevee motion blur enabled to "RENDER_OT_render" called with "EXEC_DEFAULT" freezes Blender with Eevee motion blur enabled.

There is a cyclic lock when the main thread does the rendering

Render -> Motionblur updates the depsgraph for other frame -> Depsgraph signals for view update -> Draw manager wants to lock gl_context in the main thread.

This happens in DRW_notify_view_update. The reason why there is a lock is that this function overwrites the DST to detect the engines of a view and make sure that the engine data is available in the viewport. Workbench and EEVEE only uses the engine data to set some flags.

A solution would be to add a function to add find all needed engines (we could add a ListBase parameter to current functions) and do the GPU update on the viewport itself and not via the DST. This will reduce the lock to viewport drw_viewport_engine_data_ensure and DRW_notify_view_update. The problem still with this solution is that material can still interfere with the update flags. Not sure how big of an issue this is. We could ignore scenes that don't have scenes. By checking if they are they should Can't we ignore material preview by checking if the original scene isn't a preview scene...

@Clément Foucault (fclem) any suggestions?