Render crash when an object is updated with a frame_change_post handler while another object's Show in Render property is keyframed #76422

Closed
opened 2020-05-04 23:49:04 +02:00 by Ryan Guy · 8 comments

System Information
Operating system: Windows 10 Home
Graphics card: GTX 1070 8GB

Blender Version
Broken: Blender 2.90 Alpha, fdebdfa320

Short description of error

This bug was reported to us while developing the FLIP Fluids addon. I have reduced the bug to a simple .blend file and script that can reproduce the issue.

I have an object in my scene that is procedurally updated using the frame_change_post handler with the following script:

import bpy

def frame_change_post(scene, depsgraph):
    # Generate a 2d grid of vertices
    vertices = []
    for j in range(100):
        for i in range(100):
            vertices.append((i * 0.05, j * 0.05, 0.1 * scene.frame_current))
    
    mesh_cache_object = bpy.data.objects.get("MeshCache")
    mesh_cache_object.data.clear_geometry()
    mesh_cache_object.data.from_pydata(vertices, [], [])
    depsgraph.update()
    
bpy.app.handlers.frame_change_post.append(frame_change_post)

I have another object in my scene that is a regular Cube object. This object has the Show in Renders property keyframed from Enabled to Disabled.

When I run the script and render an image or animation, Blender crashes with the following crash report:

bug_report.crash.txt

Additional notes:

  • The crash can be prevented by clearing the Show in Renders keyframes
  • The crash can be prevented by disabling Motion Blur in the Cycles Render Properties
  • The Lock Interface option is enabled, which is recommented to prevent render thread conflicts

Exact steps for others to reproduce the error

Attached is a .blend file that can reproduce the issue:

bug_report.blend

  1. Open .blend file
  2. Run the script
  3. Render > Render Image

Blender crashes

**System Information** Operating system: Windows 10 Home Graphics card: GTX 1070 8GB **Blender Version** Broken: Blender 2.90 Alpha, fdebdfa320ec **Short description of error** This bug was reported to us while developing the FLIP Fluids addon. I have reduced the bug to a simple .blend file and script that can reproduce the issue. I have an object in my scene that is procedurally updated using the **frame_change_post** handler with the following script: ``` import bpy def frame_change_post(scene, depsgraph): # Generate a 2d grid of vertices vertices = [] for j in range(100): for i in range(100): vertices.append((i * 0.05, j * 0.05, 0.1 * scene.frame_current)) mesh_cache_object = bpy.data.objects.get("MeshCache") mesh_cache_object.data.clear_geometry() mesh_cache_object.data.from_pydata(vertices, [], []) depsgraph.update() bpy.app.handlers.frame_change_post.append(frame_change_post) ``` I have another object in my scene that is a regular Cube object. This object has the **Show in Renders** property keyframed from Enabled to Disabled. When I run the script and render an image or animation, Blender crashes with the following crash report: [bug_report.crash.txt](https://archive.blender.org/developer/F8512719/bug_report.crash.txt) Additional notes: - The crash can be prevented by clearing the Show in Renders keyframes - The crash can be prevented by disabling Motion Blur in the Cycles Render Properties - The Lock Interface option is enabled, which is recommented to prevent render thread conflicts **Exact steps for others to reproduce the error** Attached is a .blend file that can reproduce the issue: [bug_report.blend](https://archive.blender.org/developer/F8512726/bug_report.blend) 1. Open .blend file 2. Run the script 3. Render > Render Image Blender crashes
Author

Added subscriber: @rlguy

Added subscriber: @rlguy
Member

Added subscriber: @EAW

Added subscriber: @EAW
Member

Trying to render in a debug build leads to:

**current_exception** was nullptr. occurred```

```blender.exe!BLI_system_backtrace(_iobuf * fp=0x00007ffbb1dafcb0) Line 353
	at C:\blender-git\blender\source\blender\blenlib\intern\system_win32.c(353)

Lines 349-353

{
  SymInitialize(GetCurrentProcess(), NULL, TRUE);
  bli_load_symbols();
  bli_windows_system_backtrace_exception_record(fp, current_exception->ExceptionRecord);

Just before that:

	at C:\blender-git\blender\source\blender\blenkernel\intern\object_update.c(453)

Lines 442-453

                                     Scene *scene,
                                     const int view_layer_index,
                                     Object *object,
                                     int base_index,
                                     const bool is_from_set)
{
  /* TODO(sergey): Avoid list lookup. */
  BLI_assert(view_layer_index >= 0);
  ViewLayer *view_layer = BLI_findlink(&scene->view_layers, view_layer_index);
  BLI_assert(view_layer != NULL);
  BLI_assert(view_layer->object_bases_array != NULL);```
__Trying to render in a debug build leads to:__ ```Exception thrown: read access violation. **current_exception** was nullptr. occurred``` ```blender.exe!BLI_system_backtrace(_iobuf * fp=0x00007ffbb1dafcb0) Line 353 at C:\blender-git\blender\source\blender\blenlib\intern\system_win32.c(353) ``` Lines 349-353 ```void BLI_system_backtrace(FILE *fp) { SymInitialize(GetCurrentProcess(), NULL, TRUE); bli_load_symbols(); bli_windows_system_backtrace_exception_record(fp, current_exception->ExceptionRecord); ``` __Just before that:__ ```blender.exe!BKE_object_eval_eval_base_flags(Depsgraph * depsgraph=0x0000027fe54e9e78, Scene * scene=0x0000027fe7600428, const int view_layer_index=0, Object * object=0x0000027ff24a02e8, int base_index=2, const bool is_from_set=false) Line 453 at C:\blender-git\blender\source\blender\blenkernel\intern\object_update.c(453) ``` Lines 442-453 ```void BKE_object_eval_eval_base_flags(Depsgraph *depsgraph, Scene *scene, const int view_layer_index, Object *object, int base_index, const bool is_from_set) { /* TODO(sergey): Avoid list lookup. */ BLI_assert(view_layer_index >= 0); ViewLayer *view_layer = BLI_findlink(&scene->view_layers, view_layer_index); BLI_assert(view_layer != NULL); BLI_assert(view_layer->object_bases_array != NULL);```

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Seems to be related to #71908

Seems to be related to #71908

Added subscriber: @dr.sybren

Added subscriber: @dr.sybren

Changed status from 'Needs Triage' to: 'Archived'

Changed status from 'Needs Triage' to: 'Archived'
Sybren A. Stüvel self-assigned this 2020-05-07 10:51:53 +02:00

@mano-wii is right, it's exactly the same script as in #71908, but with a different issue.

The crash is avoided when you remove the depsgraph.update() call. This call is also not necessary, which can be actually seen when you add a face to the mesh so that it can be rendered:

import bpy

def frame_change_post(scene, depsgraph):
    # Generate a triangle
    z = scene.frame_current / 10
    vertices = [
        (0, 0, z),
        (1, 0, z),
        (0, 1, z),
    ]
    faces = [(0, 1, 2)]
    
    mesh_cache_object = bpy.data.objects.get("MeshCache")
    mesh_cache_object.data.clear_geometry()
    mesh_cache_object.data.from_pydata(vertices, [], faces)

bpy.app.handlers.frame_change_post.append(frame_change_post)

As changing the frame is done in a way that requires a certain state of the depsgraph, and forcing an update from Python like this disregards that, I don't see how calling depsgraph.update() here could be supported.

@mano-wii is right, it's exactly the same script as in #71908, but with a different issue. The crash is avoided when you remove the `depsgraph.update()` call. This call is also not necessary, which can be actually seen when you add a face to the mesh so that it can be rendered: ``` import bpy def frame_change_post(scene, depsgraph): # Generate a triangle z = scene.frame_current / 10 vertices = [ (0, 0, z), (1, 0, z), (0, 1, z), ] faces = [(0, 1, 2)] mesh_cache_object = bpy.data.objects.get("MeshCache") mesh_cache_object.data.clear_geometry() mesh_cache_object.data.from_pydata(vertices, [], faces) bpy.app.handlers.frame_change_post.append(frame_change_post) ``` As changing the frame is done in a way that requires a certain state of the depsgraph, and forcing an update from Python like this disregards that, I don't see how calling `depsgraph.update()` here could be supported.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
FBX
Interest
Freestyle
Interest
Geometry Nodes
Interest
glTF
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 & 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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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#76422
No description provided.