Crash on exit with Metal backend #108792

Closed
opened 2023-06-09 10:25:18 +02:00 by Sergey Sharybin · 7 comments

System Information
Operating system: macOS-13.4-arm64-arm-64bit 64 Bits
Graphics card: Metal API Apple M2 Max 1.2

Blender Version
Broken: version: 3.6.0 Beta, branch: blender-v3.6-release, commit date: 2023-06-08 19:55, hash: fd74b280d95b
Worked: Perhaps 3.5

Short description of error

Blender 3.6 Beta and 4.0 Alpha very often crash on exit. When built with ASAN the following hint is reported:

=================================================================
==33707==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x0001692a0fb0 at pc 0x0001262961f4 bp 0x00016d44a7b0 sp 0x00016d44a7a8
READ of size 8 at 0x0001692a0fb0 thread T0
    #0 0x1262961f0 in blender::gpu::MTLBuffer::~MTLBuffer() mtl_memory.mm:589
    #1 0x12627c438 in blender::gpu::MTLBuffer::~MTLBuffer() mtl_memory.mm:588
    #2 0x12627ba48 in blender::gpu::MTLBufferPool::free() mtl_memory.mm:58
    #3 0x12627b6a4 in blender::gpu::MTLBufferPool::~MTLBufferPool() mtl_memory.mm:50
    #4 0x12627c3dc in blender::gpu::MTLBufferPool::~MTLBufferPool() mtl_memory.mm:49
    #5 0x1261d43c8 in blender::gpu::MTLContext::global_memory_manager_release_ref() mtl_context.hh:907
    #6 0x1261d1490 in blender::gpu::MTLContext::~MTLContext() mtl_context.mm:352
    #7 0x1261bba58 in blender::gpu::MTLContext::~MTLContext() mtl_context.mm:263
    #8 0x1261bbaac in blender::gpu::MTLContext::~MTLContext() mtl_context.mm:263
    #9 0x125cb671c in GPU_context_discard gpu_context.cc:121
    #10 0x109096920 in DRW_opengl_context_destroy draw_manager.c:3238
    #11 0x1076d6ee8 in WM_exit_ex wm_init_exit.cc:673
    #12 0x1076d6008 in WM_exit wm_init_exit.cc:716
    #13 0x1076d5eac in wm_exit_handler(bContext*, wmEvent const*, void*) wm_init_exit.cc:453
    #14 0x107646640 in wm_handler_ui_call(bContext*, wmEventHandler_UI*, wmEvent const*, bool) wm_event_system.cc:817
    #15 0x10763ff20 in wm_handlers_do_intern(bContext*, wmWindow*, wmEvent*, ListBase*) wm_event_system.cc:3313
    #16 0x107634ad4 in wm_handlers_do(bContext*, wmEvent*, ListBase*) wm_event_system.cc:3430
    #17 0x107630884 in wm_event_do_handlers wm_event_system.cc:4057
    #18 0x1075c41e0 in WM_main wm.c:632
    #19 0x102b03c70 in main creator.c:584
    #20 0x19fc73f24  (<unknown module>)

Is hard to reproduce reliably with a simple file, but is ver easy to do with more complex files.

Exact steps for others to reproduce the error

**System Information** Operating system: macOS-13.4-arm64-arm-64bit 64 Bits Graphics card: Metal API Apple M2 Max 1.2 **Blender Version** Broken: version: 3.6.0 Beta, branch: blender-v3.6-release, commit date: 2023-06-08 19:55, hash: `fd74b280d95b` Worked: Perhaps 3.5 **Short description of error** Blender 3.6 Beta and 4.0 Alpha very often crash on exit. When built with ASAN the following hint is reported: ``` ================================================================= ==33707==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x0001692a0fb0 at pc 0x0001262961f4 bp 0x00016d44a7b0 sp 0x00016d44a7a8 READ of size 8 at 0x0001692a0fb0 thread T0 #0 0x1262961f0 in blender::gpu::MTLBuffer::~MTLBuffer() mtl_memory.mm:589 #1 0x12627c438 in blender::gpu::MTLBuffer::~MTLBuffer() mtl_memory.mm:588 #2 0x12627ba48 in blender::gpu::MTLBufferPool::free() mtl_memory.mm:58 #3 0x12627b6a4 in blender::gpu::MTLBufferPool::~MTLBufferPool() mtl_memory.mm:50 #4 0x12627c3dc in blender::gpu::MTLBufferPool::~MTLBufferPool() mtl_memory.mm:49 #5 0x1261d43c8 in blender::gpu::MTLContext::global_memory_manager_release_ref() mtl_context.hh:907 #6 0x1261d1490 in blender::gpu::MTLContext::~MTLContext() mtl_context.mm:352 #7 0x1261bba58 in blender::gpu::MTLContext::~MTLContext() mtl_context.mm:263 #8 0x1261bbaac in blender::gpu::MTLContext::~MTLContext() mtl_context.mm:263 #9 0x125cb671c in GPU_context_discard gpu_context.cc:121 #10 0x109096920 in DRW_opengl_context_destroy draw_manager.c:3238 #11 0x1076d6ee8 in WM_exit_ex wm_init_exit.cc:673 #12 0x1076d6008 in WM_exit wm_init_exit.cc:716 #13 0x1076d5eac in wm_exit_handler(bContext*, wmEvent const*, void*) wm_init_exit.cc:453 #14 0x107646640 in wm_handler_ui_call(bContext*, wmEventHandler_UI*, wmEvent const*, bool) wm_event_system.cc:817 #15 0x10763ff20 in wm_handlers_do_intern(bContext*, wmWindow*, wmEvent*, ListBase*) wm_event_system.cc:3313 #16 0x107634ad4 in wm_handlers_do(bContext*, wmEvent*, ListBase*) wm_event_system.cc:3430 #17 0x107630884 in wm_event_do_handlers wm_event_system.cc:4057 #18 0x1075c41e0 in WM_main wm.c:632 #19 0x102b03c70 in main creator.c:584 #20 0x19fc73f24 (<unknown module>) ``` Is hard to reproduce reliably with a simple file, but is ver easy to do with more complex files. **Exact steps for others to reproduce the error** * Download Mr. Elephant scene from https://www.blender.org/download/demo-files/ * Open the file * Hit F12 * CMD-Q and exit.
Sergey Sharybin added the
Priority
Normal
Status
Needs Triage
Type
Report
labels 2023-06-09 10:25:19 +02:00
Clément Foucault added this to the EEVEE & Viewport project 2023-06-09 10:32:05 +02:00
Clément Foucault added this to the 3.6 LTS milestone 2023-06-09 10:32:15 +02:00

It crashed here immediately when I pressed Cmd+Q, but got different trace and nothing from ASAN. But will confirm.

It crashed here immediately when I pressed Cmd+Q, but got different trace and nothing from ASAN. But will confirm.

Blender 3.6 and 4.0 are crashing on exit after long work sessions whatever the mode with a crash report identical to the first one (see #108836).

Blender 3.6 and 4.0 are crashing on exit _after long work sessions_ whatever the mode with a crash report identical to the first one (see #108836).

Will look into getting this sorted asap!

Will look into getting this sorted asap!
Brecht Van Lommel added
Type
Bug
and removed
Type
Report
labels 2023-06-14 13:12:09 +02:00

@Michael-Parkin-White-Apple I'll be demoing some Blender 3.6 new features (probably also 4.0) over the weekend. I am afraid it will crash on exit. Any chance of having your fix merged by then? 🙏

@Michael-Parkin-White-Apple I'll be demoing some Blender 3.6 new features (probably also 4.0) over the weekend. I am afraid it will crash on exit. Any chance of having your fix merged by then? 🙏

@antonheg PR above is currently in review and feedback so far seems fairly straightforward to address. This should be completed tomorrow, so hopefully the patch will be able to land before the weekend!

@antonheg PR above is currently in review and feedback so far seems fairly straightforward to address. This should be completed tomorrow, so hopefully the patch will be able to land before the weekend!

Have a repro here, Venture 13.3.1 (22E261), M1 Pro.

Will apply #108940 and see if it helps.

Have a repro here, Venture 13.3.1 (22E261), M1 Pro. Will apply https://projects.blender.org/blender/blender/pulls/108940 and see if it helps.

Able to reproduce this problem too, MacBook Air M1 with Ventura 13.4 and Blender 3.6.0 Beta r4e7ee5d9ac50. Tried again, render a simple scene (or a complex one, that does not matter) like the default cube, when done rendering let Blender sit for a few minutes, go to a webbrowser, read some mail, whatever, just let Blender sit in the background. After some minutes, press Cmd-Q to quit Blender which it will do, but after a few seconds the message "Blender quit unexpectedly." appears, with "Reopen" / "Report..." or "Ignore" as options.

The "Report..." option created the following attached file:

Able to reproduce this problem too, MacBook Air M1 with Ventura 13.4 and Blender 3.6.0 Beta r4e7ee5d9ac50. Tried again, render a simple scene (or a complex one, that does not matter) like the default cube, when done rendering let Blender sit for a few minutes, go to a webbrowser, read some mail, whatever, just let Blender sit in the background. After some minutes, press Cmd-Q to quit Blender which it will do, but after a few seconds the message "Blender quit unexpectedly." appears, with "Reopen" / "Report..." or "Ignore" as options. The "Report..." option created the following attached file:
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2023-06-19 20:29:02 +02: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 Assignees
6 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#108792
No description provided.