Crash When Drawing Large Meshes #72175

Closed
opened 2019-12-04 19:42:32 +01:00 by Daniel Santana · 23 comments

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

Blender Version
Broken: version: 2.82 (sub 3), branch: master, commit date: 2019-12-04 15:02, hash: 7868db9343
Worked: (optional)

Short description of error
Crash on increasing the array number of clones.

Exact steps for others to reproduce the error

  • Default scene.
  • Add Array modifier to cube and increase the count to 20.
  • Add another Array modifer and change the offset to affect Z only, increase the count by dragging a few steps at a time (to force a quick change in the parameter).

This happens when increasing the second array copies above 15 by dragging.
Check included file.
thread_pool_error.blend
Stack trace:

blender.exe!task_pool_push(TaskPool * pool, void(*)(TaskPool *, void , int) run, void * taskdata, bool free_taskdata, void()(TaskPool *, void *, int) freedata, TaskPriority priority, int thread_id) Line 825 C

blender.exe!BLI_task_pool_push_ex(TaskPool * pool, void(*)(TaskPool *, void *, int) run, void * taskdata, bool free_taskdata, void(*)(TaskPool *, void *, int) freedata, TaskPriority priority) Line 866	C
blender.exe!BLI_task_pool_push(TaskPool * pool, void(*)(TaskPool *, void *, int) run, void * taskdata, bool free_taskdata, TaskPriority priority) Line 872	C
blender.exe!extract_task_create(TaskPool * task_pool, const MeshRenderData * mr, const MeshExtract * extract, void * buf, int * task_counter) Line 4353	C
blender.exe!mesh_buffer_cache_create_requested(MeshBatchCache * cache, MeshBufferCache mbc, Mesh * me, const bool do_final, const bool do_uvedit, const bool use_subsurf_fdots, const DRW_MeshCDMask * cd_layer_used, const ToolSettings * ts, const bool use_hide) Line 4500	C
blender.exe!DRW_mesh_batch_cache_create_requested(Object * ob, Mesh * me, const Scene * scene, const bool is_paint_mode, const bool use_hide) Line 1410	C
blender.exe!drw_batch_cache_generate_requested(Object * ob) Line 3457	C
blender.exe!drw_engines_cache_populate(Object * ob) Line 1157	C
blender.exe!DRW_draw_render_loop_ex(Depsgraph * depsgraph, RenderEngineType * engine_type, ARegion * ar, View3D * v3d, GPUViewport * viewport, const bContext * evil_C) Line 1559	C
blender.exe!DRW_draw_view(const bContext * C) Line 1486	C
blender.exe!view3d_main_region_draw(const bContext * C, ARegion * ar) Line 1558	C
blender.exe!ED_region_do_draw(bContext * C, ARegion * ar) Line 539	C
blender.exe!wm_draw_window_offscreen(bContext * C, wmWindow * win, bool stereo) Line 628	C
blender.exe!wm_draw_window(bContext * C, wmWindow * win) Line 766	C
blender.exe!wm_draw_update(bContext * C) Line 946	C
blender.exe!WM_main(bContext * C) Line 424	C
blender.exe!main(int argc, const unsigned char * * UNUSED_argv_c) Line 498	C
**System Information** Operating system: Windows-10-10.0.18362 64 Bits Graphics card: GeForce RTX 2080 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 441.28 **Blender Version** Broken: version: 2.82 (sub 3), branch: master, commit date: 2019-12-04 15:02, hash: `7868db9343` Worked: (optional) **Short description of error** Crash on increasing the array number of clones. **Exact steps for others to reproduce the error** - Default scene. - Add Array modifier to cube and increase the count to 20. - Add another Array modifer and change the offset to affect Z only, increase the count by dragging a few steps at a time (to force a quick change in the parameter). This happens when increasing the second array copies above 15 by dragging. Check included file. [thread_pool_error.blend](https://archive.blender.org/developer/F8189790/thread_pool_error.blend) Stack trace: > blender.exe!task_pool_push(TaskPool * pool, void(*)(TaskPool *, void *, int) run, void * taskdata, bool free_taskdata, void(*)(TaskPool *, void *, int) freedata, TaskPriority priority, int thread_id) Line 825 C blender.exe!BLI_task_pool_push_ex(TaskPool * pool, void(*)(TaskPool *, void *, int) run, void * taskdata, bool free_taskdata, void(*)(TaskPool *, void *, int) freedata, TaskPriority priority) Line 866 C blender.exe!BLI_task_pool_push(TaskPool * pool, void(*)(TaskPool *, void *, int) run, void * taskdata, bool free_taskdata, TaskPriority priority) Line 872 C blender.exe!extract_task_create(TaskPool * task_pool, const MeshRenderData * mr, const MeshExtract * extract, void * buf, int * task_counter) Line 4353 C blender.exe!mesh_buffer_cache_create_requested(MeshBatchCache * cache, MeshBufferCache mbc, Mesh * me, const bool do_final, const bool do_uvedit, const bool use_subsurf_fdots, const DRW_MeshCDMask * cd_layer_used, const ToolSettings * ts, const bool use_hide) Line 4500 C blender.exe!DRW_mesh_batch_cache_create_requested(Object * ob, Mesh * me, const Scene * scene, const bool is_paint_mode, const bool use_hide) Line 1410 C blender.exe!drw_batch_cache_generate_requested(Object * ob) Line 3457 C blender.exe!drw_engines_cache_populate(Object * ob) Line 1157 C blender.exe!DRW_draw_render_loop_ex(Depsgraph * depsgraph, RenderEngineType * engine_type, ARegion * ar, View3D * v3d, GPUViewport * viewport, const bContext * evil_C) Line 1559 C blender.exe!DRW_draw_view(const bContext * C) Line 1486 C blender.exe!view3d_main_region_draw(const bContext * C, ARegion * ar) Line 1558 C blender.exe!ED_region_do_draw(bContext * C, ARegion * ar) Line 539 C blender.exe!wm_draw_window_offscreen(bContext * C, wmWindow * win, bool stereo) Line 628 C blender.exe!wm_draw_window(bContext * C, wmWindow * win) Line 766 C blender.exe!wm_draw_update(bContext * C) Line 946 C blender.exe!WM_main(bContext * C) Line 424 C blender.exe!main(int argc, const unsigned char * * UNUSED_argv_c) Line 498 C
Author

Added subscriber: @dgsantana

Added subscriber: @dgsantana

#72195 was marked as duplicate of this issue

#72195 was marked as duplicate of this issue

#72190 was marked as duplicate of this issue

#72190 was marked as duplicate of this issue

#72191 was marked as duplicate of this issue

#72191 was marked as duplicate of this issue

#72186 was marked as duplicate of this issue

#72186 was marked as duplicate of this issue

#72184 was marked as duplicate of this issue

#72184 was marked as duplicate of this issue

Added subscriber: @tomjk

Added subscriber: @tomjk

More information: this occurs under the following conditions:

  1. Have an object with more than 2048 faces
  2. Have overlays turned on
  3. Be in any view mode besides wireframe
  4. Be in object mode (or more specifically, don't have that object in object mode)

In the steps outlined in the report, if you set the second array modifiers count to 18, or have only one modifier with count set to 342, the face count exceeds 2048 and Blender crashes.

edit: crash can happen in edit mode as well, using modifiers:

  1. Default cube, in edit mode.
  2. Add subdiv modifier.
  3. Set subdiv level to 5, blender crashes.

If you first turn "On Cage" on for the modifier, then set level to 5, Blender will not crash.

More information: this occurs under the following conditions: 1. Have an object with more than 2048 faces 2. Have overlays turned on 3. Be in any view mode besides wireframe 4. Be in object mode (or more specifically, don't have that object in object mode) In the steps outlined in the report, if you set the second array modifiers count to 18, or have only one modifier with count set to 342, the face count exceeds 2048 and Blender crashes. edit: crash can happen in edit mode as well, using modifiers: 1. Default cube, in edit mode. 2. Add subdiv modifier. 3. Set subdiv level to 5, blender crashes. If you first turn "On Cage" on for the modifier, then set level to 5, Blender will not crash.

Added subscriber: @SteffenD

Added subscriber: @SteffenD

I can confirm the subdiv level 5 crash with a simple cube on Linux Mint 19.2
Blender 2.82 e203f69bc3

I can confirm the subdiv level 5 crash with a simple cube on Linux Mint 19.2 Blender 2.82 e203f69bc3eb

Bug introduced in commit 9c337fcfe2

Bug introduced in commit 9c337fcfe2a4
Member

Added subscriber: @Jeroen-Bakker

Added subscriber: @Jeroen-Bakker
Jeroen Bakker self-assigned this 2019-12-04 22:33:32 +01:00
Member

Is mine commit. Will look at it! Thanks for reporting.

Is mine commit. Will look at it! Thanks for reporting.

Added subscriber: @fclem

Added subscriber: @fclem

@Jeroen-Bakker Proposed solution

@@ -4318,11 +4318,11 @@ static void extract_task_create(TaskPool *task_pool,
   taskdata->task_counter = task_counter;
   taskdata->start = 0;
   taskdata->end = INT_MAX;
 
   /* Simple heuristic. */
-  const bool use_thread = (mr->loop_len + mr->loop_loose_len) > 8192;
+  const bool use_thread = task_pool && (mr->loop_len + mr->loop_loose_len) > 8192;
   if (use_thread && extract->use_threading) {
     /* Divide task into sensible chunks. */
     const int chunk_size = 8192;
     if (taskdata->iter_type & MR_ITER_LOOPTRI) {
       for (int i = 0; i < mr->tri_len; i += chunk_size) {
@@ -4487,18 +4487,20 @@ void mesh_buffer_cache_create_requested(MeshBatchCache *cache,
 
   /* TODO(fclem) Ideally, we should have one global pool for all
    * objects and wait for finish only before drawing when buffers
    * need to be ready. */
   BLI_task_pool_work_and_wait(task_pool);
-  BLI_task_pool_free(task_pool);
 
   /* The `lines_loose` is a sub buffer from `ibo.lines`.
    * We don't use the extract mechanism due to potential synchronization issues.*/
   if (mbc.ibo.lines_loose) {
     extract_task_create(NULL, mr, &extract_lines_loose, mbc.ibo.lines_loose, task_counters);
+    BLI_task_pool_work_and_wait(task_pool);
   }
 
+  BLI_task_pool_free(task_pool);
+
   MEM_freeN(task_counters);
 
   mesh_render_data_free(mr);
 
 #ifdef DEBUG_TIME
@Jeroen-Bakker Proposed solution ``` @@ -4318,11 +4318,11 @@ static void extract_task_create(TaskPool *task_pool, taskdata->task_counter = task_counter; taskdata->start = 0; taskdata->end = INT_MAX; /* Simple heuristic. */ - const bool use_thread = (mr->loop_len + mr->loop_loose_len) > 8192; + const bool use_thread = task_pool && (mr->loop_len + mr->loop_loose_len) > 8192; if (use_thread && extract->use_threading) { /* Divide task into sensible chunks. */ const int chunk_size = 8192; if (taskdata->iter_type & MR_ITER_LOOPTRI) { for (int i = 0; i < mr->tri_len; i += chunk_size) { @@ -4487,18 +4487,20 @@ void mesh_buffer_cache_create_requested(MeshBatchCache *cache, /* TODO(fclem) Ideally, we should have one global pool for all * objects and wait for finish only before drawing when buffers * need to be ready. */ BLI_task_pool_work_and_wait(task_pool); - BLI_task_pool_free(task_pool); /* The `lines_loose` is a sub buffer from `ibo.lines`. * We don't use the extract mechanism due to potential synchronization issues.*/ if (mbc.ibo.lines_loose) { extract_task_create(NULL, mr, &extract_lines_loose, mbc.ibo.lines_loose, task_counters); + BLI_task_pool_work_and_wait(task_pool); } + BLI_task_pool_free(task_pool); + MEM_freeN(task_counters); mesh_render_data_free(mr); #ifdef DEBUG_TIME ```

This issue was referenced by f4b7d57551

This issue was referenced by f4b7d57551061350216048d5d30b9b674f741c28
Member

Thanks I had a similar solution.

Thanks I had a similar solution.
Member

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Member

Added subscriber: @moznoz

Added subscriber: @moznoz
Member

Added subscriber: @MarcinTwarowski

Added subscriber: @MarcinTwarowski
Jeroen Bakker changed title from Crash on task_pool_push with a null_ptr on the pool object. to Crash When Drawing Large Meshes 2019-12-05 09:46:30 +01:00
Member

Added subscribers: @jc4d, @lichtwerk

Added subscribers: @jc4d, @lichtwerk
Member

Added subscriber: @alonabrany

Added subscriber: @alonabrany
Member

Added subscriber: @Oxer-1

Added subscriber: @Oxer-1
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
7 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#72175
No description provided.