Debug build BM_mesh_triangulate() will hang forever if mesh face count is high. #87625

Open
opened 2021-04-19 13:34:54 +02:00 by YimingWu · 8 comments
Member

System Information
Operating system: Xubuntu 20.04
Graphics card: NVidia K5100M

Blender Version

Broken ONLY WITH Debug build: Blender 3.0.0 Alpha (It should have been broken way earlier)
Worked only with Release and 'RelWithDebInfo' build: Blender 3.0.0 Alpha

Short description of error

The call to BM_mesh_triangulate(bm, quad_method, ngon_method, 4, false, NULL, NULL, NULL) does not exit on some bigger meshes. Specifically, it seems to have been stuck inside BM_face_kill(bm, faces_double->link);.

(if you call it with bmesh op and slot_in/out arguments it will run properly)

Exact steps for others to reproduce the error

  1. Open 0_rougue_bucket.blend provided below.
  2. Add -> GPencil -> Scene Line Art OR go into sculpt mode and enable dynatopo (where it uses the same triangulation call).

On my machine the bucket runs fine with subdiv levels 1-2 and above 3 the bug shows. The subdiv value in that file is 3.

Note that the bug is only reproducible in Debug build. Seems that function doesn't like meshes that has face count higher than a certain amount...

My guess would be there's a lot of checks in debug code path in the function, somewhere it reaches a case where the memory pool gets corrupted. It never quits, in the task manager, memory doesn't show any changes at all. (It's way below my 32G system memory so it can't be there being not enough memory).

Since this triangulation call is related to sculpt as well so I'm gonna ask if this happens to @PabloDobarro in debug build...

0_rouge_bucket.blend

**System Information** Operating system: Xubuntu 20.04 Graphics card: NVidia K5100M **Blender Version** **Broken ONLY WITH `Debug` build**: Blender 3.0.0 Alpha (It should have been broken way earlier) Worked only with `Release` and 'RelWithDebInfo' build: Blender 3.0.0 Alpha **Short description of error** The call to `BM_mesh_triangulate(bm, quad_method, ngon_method, 4, false, NULL, NULL, NULL)` does not exit on some bigger meshes. Specifically, it seems to have been stuck inside `BM_face_kill(bm, faces_double->link);`. (if you call it with bmesh `op` and `slot_in/out` arguments it will run properly) **Exact steps for others to reproduce the error** 1. Open 0_rougue_bucket.blend provided below. 2. Add -> GPencil -> Scene Line Art **OR** go into sculpt mode and enable dynatopo (where it uses the same triangulation call). On my machine the bucket runs fine with subdiv levels 1-2 and above 3 the bug shows. The subdiv value in that file is 3. Note that the bug is only reproducible in `Debug` build. Seems that function doesn't like meshes that has face count higher than a certain amount... My guess would be there's a lot of checks in debug code path in the function, somewhere it reaches a case where the memory pool gets corrupted. It never quits, in the task manager, memory doesn't show any changes at all. (It's way below my 32G system memory so it can't be there being not enough memory). Since this triangulation call is related to sculpt as well so I'm gonna ask if this happens to @PabloDobarro in debug build... [0_rouge_bucket.blend](https://archive.blender.org/developer/F9988596/0_rouge_bucket.blend)
Author
Member

Added subscribers: @PabloDobarro, @ChengduLittleA

Added subscribers: @PabloDobarro, @ChengduLittleA
Member

Added subscriber: @ankitm

Added subscriber: @ankitm
Member

It's not stuck as in a lock or a freeze. It's doing the work in the first #ifndef NDEBUG section of BLI_mempool_free.
That explains it being a problem in debug build.

It's not stuck as in a lock or a freeze. It's doing the work in the first `#ifndef NDEBUG` section of `BLI_mempool_free`. That explains it being a problem in debug build.

Added subscribers: @Sergey, @dfelinto

Added subscribers: @Sergey, @dfelinto

@Sergey you added this (the NDEBUG code in BLI_mempool_free) 8 years ago. Care to comment on this?

@Sergey you added this (the NDEBUG code in BLI_mempool_free) 8 years ago. Care to comment on this?
Member

After 20 minutes, Blender becomes functional again.

After 20 minutes, Blender becomes functional again.

@dfelinto, clearly that was a way to catch issues with misuse of memory pools, to ensure only addresses from the pool are freed.

You can move the check inside of if (UNLIKELY(mempool_debug_memset)) {(maybe call the flag more explicit). But you should also check that the pool is used properly. The fact that the code shows up in the profiles means that there are a lot of chunks, meaning, pool might not be really saving up on allocations. It might be all fine, but that's what you need to check.

@dfelinto, clearly that was a way to catch issues with misuse of memory pools, to ensure only addresses from the pool are freed. You can move the check inside of `if (UNLIKELY(mempool_debug_memset)) {`(maybe call the flag more explicit). But you should also check that the pool is used properly. The fact that the code shows up in the profiles means that there are a lot of chunks, meaning, pool might not be really saving up on allocations. It might be all fine, but that's what you need to check.
Member

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

Changed status from 'Needs Triage' to: 'Confirmed'
Philipp Oeser removed the
Interest
Core
label 2023-02-09 14:43:12 +01: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 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#87625
No description provided.