This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 9975b1cab37 [fix](filecache) fix crash on reset_range when clearing 
cache concurrently (pick#60271) (#61204)
9975b1cab37 is described below

commit 9975b1cab374e84ac2b48911af675001c09c36cb
Author: zhengyu <[email protected]>
AuthorDate: Thu Mar 12 09:44:44 2026 +0800

    [fix](filecache) fix crash on reset_range when clearing cache concurrently 
(pick#60271) (#61204)
    
    …ently (#60271)
    
    reset_range could dereference a null cell when a block was
    evicted/removed while a downloader thread was finalizing a partial
    block. FileBlock stayed alive via refcount, but its FileBlockCell had
    already been erased from _files (when doing clear_cache operation),
    leading to SIGSEGV.
    
    ### What problem does this PR solve?
    
    Issue Number: close #xxx
    
    Related PR: #xxx
    
    Problem Summary:
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test <!-- At least one of them must be included. -->
        - [ ] Regression test
        - [ ] Unit Test
        - [ ] Manual test (add detailed scripts or steps below)
        - [ ] No need to test or manual test. Explain why:
    - [ ] This is a refactor/code format and no logic has been changed.
            - [ ] Previous test can cover this change.
            - [ ] No code files have been changed.
            - [ ] Other reason <!-- Add your reason?  -->
    
    - Behavior changed:
        - [ ] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [ ] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
---
 be/src/io/cache/block_file_cache.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/be/src/io/cache/block_file_cache.cpp 
b/be/src/io/cache/block_file_cache.cpp
index fb8de34b153..cd5f2d57479 100644
--- a/be/src/io/cache/block_file_cache.cpp
+++ b/be/src/io/cache/block_file_cache.cpp
@@ -1400,6 +1400,12 @@ void BlockFileCache::reset_range(const UInt128Wrapper& 
hash, size_t offset, size
            _files.find(hash)->second.find(offset) != 
_files.find(hash)->second.end());
     FileBlockCell* cell = get_cell(hash, offset, cache_lock);
     DCHECK(cell != nullptr);
+    if (cell == nullptr) {
+        LOG(WARNING) << "reset_range skipped because cache cell is missing. 
hash="
+                     << hash.to_string() << " offset=" << offset << " 
old_size=" << old_size
+                     << " new_size=" << new_size;
+        return;
+    }
     if (cell->queue_iterator) {
         auto& queue = get_queue(cell->file_block->cache_type());
         DCHECK(queue.contains(hash, offset, cache_lock));


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

Reply via email to