nsivarajan opened a new issue, #62738:
URL: https://github.com/apache/doris/issues/62738

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
     Bug Description:
     When enable_memory_orphan_check=true is configured in be.conf, the Backend
     crashes with the following assertion failure in cache background daemon 
threads:
   
       Check failed: limiter_mem_tracker()->label() != "Orphan"
   
     The crash occurs in cache_adjust_capacity_thread and 
cache_prune_stale_thread
     created in daemon.cpp. These threads perform memory allocations without
     attaching a MemTrackerLimiter via SCOPED_ATTACH_TASK, causing them to 
inherit
     the "Orphan" tracker. When the orphan check is enabled, this assertion 
fires
     and crashes the BE.
   
   
     Actual Behavior:
     BE crashes with:
   
       Check failed: limiter_mem_tracker()->label() != "Orphan"
   
     Crash thread: cache_adjust_capacity_thread or cache_prune_stale_thread
   
     Environment:
     - Doris version: 4.1.0
     - Deployment: Decoupled (cloud) mode
     - OS: Linux
     - enable_memory_orphan_check: true
     - enable_file_cache: true
   
   ### What's Wrong?
   
     daemon.cpp creates cache background threads without calling 
SCOPED_ATTACH_TASK.
     Threads that allocate memory without an attached MemTrackerLimiter fall 
back
     to the Orphan tracker. The fix is to attach a dedicated MemTrackerLimiter 
to
     both cache daemon threads before their work loops.
   
   ### What You Expected?
   
     Cache background threads should run with a valid MemTrackerLimiter 
attached,
     not the Orphan tracker. BE should not crash.
   
   ### How to Reproduce?
   
     Steps to Reproduce:
     1. Set enable_memory_orphan_check=true in be.conf
     2. Enable file cache (enable_file_cache=true)
     3. Run queries that stress the file cache — either:
        a. Fill cache to capacity to trigger cache_adjust_capacity_thread, OR
        b. Generate stale cache blocks to trigger cache_prune_stale_thread
     4. BE crashes when one of these background threads wakes up and
        performs memory allocation
   
     Note: The crash does NOT happen on startup. It occurs only when cache
     pressure causes the background threads to activate. Timing is
     non-deterministic and depends on cache load. Consistently reproducible
     by running heavy analytical queries (e.g. TPC-DS) with a nearly-full
     file cache.
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to