Skip to content

Conversation

@xinyiZzz
Copy link
Contributor

Proposed changes

Issue Number: close #xxx

==2606023==ERROR: AddressSanitizer: heap-use-after-free on address 0x60e000043670 at pc 0x55bb56449d60 bp 0x7f58725a9330 sp 0x7f58725a9328
READ of size 8 at 0x60e000043670 thread T34 (memory_tracker_)
    #0 0x55bb56449d5f in std::_shared_ptr<doris::RuntimeProfile::HighWaterMarkCounter, (_gnu_cxx::_Lock_policy)2>::operator bool() const /var/local/ldb_toolchain/bin/../lib/gcc/x86_64-
linux-gnu/11/../../../../include/c++/11/bits/shared_ptr_base.h:1295:16
    #1 0x55bb5644671e in doris::MemTracker::refresh_profile_counter() repo_center/doris_master/doris/be/src/runtime/memory/mem_tracker.h:123:13
    #2 0x55bb56433b27 in doris::MemTrackerLimiter::refresh_all_tracker_profile() repo_center/doris_master/doris/be/src/runtime/memory/mem_tracker_limiter.cpp:120:22
    #3 0x55bb5380299a in doris::Daemon::memory_tracker_profile_refresh_thread() repo_center/doris_master/doris/be/src/common/daemon.cpp:280:9
    #4 0x55bb5380bc5b in doris::Daemon::start()::$_4::operator()() const repo_center/doris_master/doris/be/src/common/daemon.cpp:458:30
    #5 0x55bb5380bc06 in void std::_invoke_impl<void, doris::Daemon::start()::$_4&>(std::_invoke_other, doris::Daemon::start()::$_4&) /var/local/ldb_toolchain/bin/../lib/gcc/x86_64-lin
ux-gnu/11/../../../../include/c++/11/bits/invoke.h:61:14
    #6 0x55bb5380bb88 in std::enable_if<is_invocable_r_v<void, doris::Daemon::start()::$4&>, void>::type std::_invoke_r<void, doris::Daemon::start()::$_4&>(doris::Daemon::start()::$_4&
) /var/local/ldb_toolchain/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:111:2
    #7 0x55bb5380b9be in std::_Function_handler<void (), doris::Daemon::start()::$_4>::_M_invoke(std::_Any_data const&) /var/local/ldb_toolchain/bin/../lib/gcc/x86_64-linux-gnu/11/../../
../../include/c++/11/bits/std_function.h:291:9
    #8 0x55bb538ca7c6 in std::function<void ()>::operator()() const /var/local/ldb_toolchain/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_function.h:560:9
    #9 0x55bb569661f4 in doris::Thread::supervise_thread(void*) repo_center/doris_master/doris/be/src/util/thread.cpp:453:5
    #10 0x7f5938aae608 in start_thread /build/glibc-sMfBJT/glibc-2.31/nptl/pthread_create.c:477:8
    #11 0x7f5938d3d162 in __clone /build/glibc-sMfBJT/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95

0x60e000043670 is located 48 bytes inside of 160-byte region [0x60e000043640,0x60e0000436e0)
freed by thread T0 here:
    #0 0x55bb5379064d in operator delete(void*) (/mnt/ssd01/doris-master/VEC_ASAN/be/lib/doris_be+0x149f464d) (BuildId: bb27ad362e41964d)
    #1 0x55bb5559f725 in std::default_delete<doris::MemTrackerLimiter>::operator()(doris::MemTrackerLimiter*) const /var/local/ldb_toolchain/bin/../lib/gcc/x86_64-linux-gnu/11/../../../.
./include/c++/11/bits/unique_ptr.h:85:2
    #2 0x55bb5559d2bf in std::unique_ptr<doris::MemTrackerLimiter, std::default_delete<doris::MemTrackerLimiter> >::~unique_ptr() /var/local/ldb_toolchain/bin/../lib/gcc/x86_64-linux-gnu
/11/../../../../include/c++/11/bits/unique_ptr.h:361:4
    #3 0x55bb555940c1 in doris::ShardedLRUCache::~ShardedLRUCache() repo_center/doris_master/doris/be/src/olap/lru_cache.cpp:577:1
    #4 0x55bb55594118 in doris::ShardedLRUCache::~ShardedLRUCache() repo_center/doris_master/doris/be/src/olap/lru_cache.cpp:568:37
    #5 0x55bb55786b94 in std::default_delete<doris::Cache>::operator()(doris::Cache*) const /var/local/ldb_toolchain/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/un
ique_ptr.h:85:2
    #6 0x55bb55785d1f in std::unique_ptr<doris::Cache, std::default_delete<doris::Cache> >::~unique_ptr() /var/local/ldb_toolchain/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/
c++/11/bits/unique_ptr.h:361:4
    #7 0x55bb559de529 in doris::StoragePageCache::~StoragePageCache() repo_center/doris_master/doris/be/src/olap/page_cache.h:36:7
    #8 0x7f5938c648d6 in __run_exit_handlers /build/glibc-sMfBJT/glibc-2.31/stdlib/exit.

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@xinyiZzz
Copy link
Contributor Author

run buildall

Copy link
Contributor

@yiguolei yiguolei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Jun 14, 2023
@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

@xinyiZzz xinyiZzz force-pushed the 20230612_fix_memory_grace_exit branch from 9378582 to 7b3abf6 Compare June 15, 2023 02:40
@xinyiZzz
Copy link
Contributor Author

run buildall

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

@yiguolei yiguolei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@luozenglin luozenglin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xinyiZzz xinyiZzz merged commit 1ec7f0e into apache:master Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants