Crash backtrace missing on Linux #111186

Closed
opened 2023-08-16 16:39:51 +02:00 by Brecht Van Lommel · 6 comments

System Information
Operating system: Ubuntu 20.04
Graphics card: N/A

Blender Version
Broken: 4.0 (dd64767)

Short description of error
Since f197b1a, the presence of execinfo.h is no longer detected correctly, and backtraces are missing on crashes. I can reproduce this problem both with my own and buildbot builds, while older releases work ok.

I think this also explains why it was described as barely working in #111006.

It's probably related to check_include_files which we don't use anywhere else.

**System Information** Operating system: Ubuntu 20.04 Graphics card: N/A **Blender Version** Broken: 4.0 (`dd64767`) **Short description of error** Since f197b1a, the presence of `execinfo.h` is no longer detected correctly, and backtraces are missing on crashes. I can reproduce this problem both with my own and buildbot builds, while older releases work ok. I think this also explains why it was described as barely working in #111006. It's probably related to `check_include_files` which we don't use anywhere else.
Author
Owner

It's probably a simple fix, but I won't have time to fix this soon so logging as a bug report.

CC @ideasman42 @mont29

It's probably a simple fix, but I won't have time to fix this soon so logging as a bug report. CC @ideasman42 @mont29
Campbell Barton self-assigned this 2023-08-17 05:25:00 +02:00
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2023-08-17 05:48:22 +02:00

@brecht @ideasman42 note that the issue that lead to !111006 remains though - backtrace generated from this method are essentially useless for me (Debian testing, gcc13): it cannot resolve any address to a readable function name anymore in the Blender binary itself...

@brecht @ideasman42 note that the issue that lead to !111006 remains though - backtrace generated from this method are essentially useless for me (Debian testing, gcc13): it cannot resolve any address to a readable function name anymore in the Blender binary itself...

@mont29 checking and the leak report is working as expected with this patch applied:

diff --git a/intern/guardedalloc/intern/mallocn_guarded_impl.c b/intern/guardedalloc/intern/mallocn_guarded_impl.c
index 526686a579d..fe66cd88a73 100644
--- a/intern/guardedalloc/intern/mallocn_guarded_impl.c
+++ b/intern/guardedalloc/intern/mallocn_guarded_impl.c
@@ -49,7 +49,7 @@
 #if defined(_MSC_VER)
 #  define DEBUG_BACKTRACE
 #else
-//#define DEBUG_BACKTRACE
+#  define DEBUG_BACKTRACE
 #endif
 
 #ifdef DEBUG_MEMCOUNTER
diff --git a/source/blender/windowmanager/intern/wm_init_exit.cc b/source/blender/windowmanager/intern/wm_init_exit.cc
index 9647b228028..21beb8b7c91 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.cc
+++ b/source/blender/windowmanager/intern/wm_init_exit.cc
@@ -475,6 +475,7 @@ void UV_clipboard_free();
 void WM_exit_ex(bContext *C, const bool do_python, const bool do_user_exit_actions)
 {
   wmWindowManager *wm = C ? CTX_wm_manager(C) : nullptr;
+  char *x = (char *)MEM_mallocN(150, __func__);
 
   /* While nothing technically prevents saving user data in background mode,
    * don't do this as not typically useful and more likely to cause problems

Output from running: blender -d

WM_exit_ex len: 152 0x61100041fcf8                                                                                                                                                                 
0x61100041fcc0 is located 0 bytes inside of 216-byte region [0x61100041fcc0,0x61100041fd98)                                                                                                        
allocated by thread T0 here:                                                                                                                                                                       
    #0 0x7f8bee2e1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69                                                                                    
    #1 0x2f7c7cd in MEM_guarded_mallocN /src/blender/intern/guardedalloc/intern/mallocn_guarded_impl.c:394                                                                                         
    #2 0x30063eb in WM_exit_ex(bContext*, bool, bool) /src/blender/source/blender/windowmanager/intern/wm_init_exit.cc:478                                                                         
    #3 0x3007008 in WM_exit(bContext*, int) /src/blender/source/blender/windowmanager/intern/wm_init_exit.cc:717                                                                                   
    #4 0x300620d in wm_exit_handler /src/blender/source/blender/windowmanager/intern/wm_init_exit.cc:453                                                                                           
    #5 0x2fa9345 in wm_handler_ui_call /src/blender/source/blender/windowmanager/intern/wm_event_system.cc:818                                                                                     
    #6 0x2fbd15f in wm_handlers_do_intern /src/blender/source/blender/windowmanager/intern/wm_event_system.cc:3319                                                                                 
    #7 0x2fbe11c in wm_handlers_do /src/blender/source/blender/windowmanager/intern/wm_event_system.cc:3436               
    #8 0x2fc3919 in wm_event_do_handlers(bContext*) /src/blender/source/blender/windowmanager/intern/wm_event_system.cc:4063                                                                       
    #9 0x2f8b5ba in WM_main(bContext*) /src/blender/source/blender/windowmanager/intern/wm.cc:634                                                                                                  
    #10 0x296012c in main /src/blender/source/creator/creator.cc:593                                                                                                                               
    #11 0x7f8beca27ccf  (/usr/lib/libc.so.6+0x27ccf) (BuildId: 316d0d3666387f0e8fb98773f51aa1801027c5ab) 

Attached script used to generate the build (including it's ASAN settings).

@mont29 checking and the leak report is working as expected with this patch applied: ``` diff --git a/intern/guardedalloc/intern/mallocn_guarded_impl.c b/intern/guardedalloc/intern/mallocn_guarded_impl.c index 526686a579d..fe66cd88a73 100644 --- a/intern/guardedalloc/intern/mallocn_guarded_impl.c +++ b/intern/guardedalloc/intern/mallocn_guarded_impl.c @@ -49,7 +49,7 @@ #if defined(_MSC_VER) # define DEBUG_BACKTRACE #else -//#define DEBUG_BACKTRACE +# define DEBUG_BACKTRACE #endif #ifdef DEBUG_MEMCOUNTER diff --git a/source/blender/windowmanager/intern/wm_init_exit.cc b/source/blender/windowmanager/intern/wm_init_exit.cc index 9647b228028..21beb8b7c91 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.cc +++ b/source/blender/windowmanager/intern/wm_init_exit.cc @@ -475,6 +475,7 @@ void UV_clipboard_free(); void WM_exit_ex(bContext *C, const bool do_python, const bool do_user_exit_actions) { wmWindowManager *wm = C ? CTX_wm_manager(C) : nullptr; + char *x = (char *)MEM_mallocN(150, __func__); /* While nothing technically prevents saving user data in background mode, * don't do this as not typically useful and more likely to cause problems ``` Output from running: `blender -d` ``` WM_exit_ex len: 152 0x61100041fcf8 0x61100041fcc0 is located 0 bytes inside of 216-byte region [0x61100041fcc0,0x61100041fd98) allocated by thread T0 here: #0 0x7f8bee2e1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69 #1 0x2f7c7cd in MEM_guarded_mallocN /src/blender/intern/guardedalloc/intern/mallocn_guarded_impl.c:394 #2 0x30063eb in WM_exit_ex(bContext*, bool, bool) /src/blender/source/blender/windowmanager/intern/wm_init_exit.cc:478 #3 0x3007008 in WM_exit(bContext*, int) /src/blender/source/blender/windowmanager/intern/wm_init_exit.cc:717 #4 0x300620d in wm_exit_handler /src/blender/source/blender/windowmanager/intern/wm_init_exit.cc:453 #5 0x2fa9345 in wm_handler_ui_call /src/blender/source/blender/windowmanager/intern/wm_event_system.cc:818 #6 0x2fbd15f in wm_handlers_do_intern /src/blender/source/blender/windowmanager/intern/wm_event_system.cc:3319 #7 0x2fbe11c in wm_handlers_do /src/blender/source/blender/windowmanager/intern/wm_event_system.cc:3436 #8 0x2fc3919 in wm_event_do_handlers(bContext*) /src/blender/source/blender/windowmanager/intern/wm_event_system.cc:4063 #9 0x2f8b5ba in WM_main(bContext*) /src/blender/source/blender/windowmanager/intern/wm.cc:634 #10 0x296012c in main /src/blender/source/creator/creator.cc:593 #11 0x7f8beca27ccf (/usr/lib/libc.so.6+0x27ccf) (BuildId: 316d0d3666387f0e8fb98773f51aa1801027c5ab) ``` Attached script used to generate the build (including it's ASAN settings).

This is generated by ASAN, after the change from !111006/2e79ca3205.

What I am saying is that for me, the backtrace generated from using execinfo.h API is useless, as the call to backtrace_symbols cannot resolve any Blender binary address to function names anymore (at least for me). Which was one of the reasons to decide to switch to ASAN 'backtrace' for the memleaks.

This is generated by ASAN, after the change from !111006/2e79ca3205. What I am saying is that for me, the backtrace generated from using `execinfo.h` API is useless, as the call to `backtrace_symbols` cannot resolve any Blender binary address to function names anymore (at least for me). Which was one of the reasons to decide to switch to ASAN 'backtrace' for the memleaks.

@mont29 looked into this: source/creator/symbols_unix.map is masking out most of the symbols.

Commenting out: ./build_files/cmake/platform/platform_unix.cmake

set(PLATFORM_SYMBOLS_MAP ${CMAKE_SOURCE_DIR}/source/creator/symbols_unix.map)
set(PLATFORM_LINKFLAGS
  "${PLATFORM_LINKFLAGS} -Wl,--version-script='${PLATFORM_SYMBOLS_MAP}'"
)

Although the output still isn't great.

Submitted a PR for a utility to run addr2line on these back-traces: #111416

@mont29 looked into this: `source/creator/symbols_unix.map` is masking out most of the symbols. Commenting out: `./build_files/cmake/platform/platform_unix.cmake` ``` set(PLATFORM_SYMBOLS_MAP ${CMAKE_SOURCE_DIR}/source/creator/symbols_unix.map) set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--version-script='${PLATFORM_SYMBOLS_MAP}'" ) ``` Although the output still isn't great. Submitted a PR for a utility to run `addr2line` on these back-traces: #111416

Aaaah makes sense, completely forgot that symbols hiding thingy ;(

Thanks for looking into this!

Aaaah makes sense, completely forgot that symbols hiding thingy ;( Thanks for looking into this!
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
3 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#111186
No description provided.