Skip to content

Fix for part_names_mutex used after destruction#51099

Merged
alexey-milovidov merged 1 commit intomasterfrom
fix_use_local_vars_after_exception
Jun 16, 2023
Merged

Fix for part_names_mutex used after destruction#51099
alexey-milovidov merged 1 commit intomasterfrom
fix_use_local_vars_after_exception

Conversation

@davenger
Copy link
Copy Markdown
Member

@davenger davenger commented Jun 16, 2023

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Recently came across a crash:

2023.06.16 10:09:52.651596 [ 50947 ] {} <Fatal> BaseDaemon: ########################################
2023.06.16 10:09:52.651879 [ 50947 ] {} <Fatal> BaseDaemon: (version 23.6.1.37018, build id: D4B70A04BCABB50B8BAFF4B6F19987D365FFA9DB) (from thread 9279) (no query) Received signal Aborted (6)
2023.06.16 10:09:52.652171 [ 50947 ] {} <Fatal> BaseDaemon: 
2023.06.16 10:09:52.652447 [ 50947 ] {} <Fatal> BaseDaemon: Stack trace: 0x00007fbbd28e600b 0x00007fbbd28c5859 0x00007fbbd28c5729 0x00007fbbd28d6fd6 0x00007fbbd2aaa1d9 0x00007fbbd2a9fb09 0x0000555aab290049 0x0000555a95d9bd6a 0x0000555a8e43b808 0x0000555a8e43b18d 0x0000555a8d3d865d 0x0000555a8e43be2e 0x0000555a799fecd1 0x0000555a79a0a00b 0x0000555a79a09ebf 0x0000555a799f5dbf 0x0000555a79a0348b 0x00007fbbd2a9d609 0x00007fbbd29c2133
2023.06.16 10:09:52.652842 [ 50947 ] {} <Fatal> BaseDaemon: 4. raise @ 0x00007fbbd28e600b in ?
2023.06.16 10:09:52.653116 [ 50947 ] {} <Fatal> BaseDaemon: 5. abort @ 0x00007fbbd28c5859 in ?
2023.06.16 10:09:52.653148 [ 50947 ] {} <Fatal> BaseDaemon: 6. ? @ 0x00007fbbd28c5729 in ?
2023.06.16 10:09:52.653173 [ 50947 ] {} <Fatal> BaseDaemon: 7. ? @ 0x00007fbbd28d6fd6 in ?
2023.06.16 10:09:52.653198 [ 50947 ] {} <Fatal> BaseDaemon: 8. ? @ 0x00007fbbd2aaa1d9 in ?
2023.06.16 10:09:52.653222 [ 50947 ] {} <Fatal> BaseDaemon: 9. ? @ 0x00007fbbd2a9fb09 in ?
2023.06.16 10:09:52.781955 [ 50947 ] {} <Fatal> BaseDaemon: 10. ./build_docker/./contrib/llvm-project/libcxx/src/mutex.cpp:39: std::mutex::lock() @ 0x0000000059d23049 in /usr/bin/clickhouse
2023.06.16 10:10:00.496748 [ 50947 ] {} <Fatal> BaseDaemon: 11.1. inlined from ./build_docker/./contrib/llvm-project/libcxx/include/__mutex_base:0: lock_guard
2023.06.16 10:10:00.497071 [ 50947 ] {} <Fatal> BaseDaemon: 11.2. inlined from ./build_docker/./src/Storages/MergeTree/MergeTreeData.cpp:2412: operator()
2023.06.16 10:10:00.497720 [ 50947 ] {} <Fatal> BaseDaemon: 11.3. inlined from ./build_docker/./contrib/llvm-project/libcxx/include/__functional/invoke.h:394: decltype(std::declval<DB::MergeTreeData::clearPartsFromFilesystemImpl(std::vector<std::shared_ptr<DB::IMergeTreeDataPart const>, std::allocator<std::shared_ptr<DB::IMergeTreeDataPart const>>> const&, std::unordered_set<String, std::hash<String>, std::equal_to<String>, std::allocator<String>>*)::$_4&>()()) std::__invoke[abi:v15000]<DB::MergeTreeData::clearPartsFromFilesystemImpl(std::vector<std::shared_ptr<DB::IMergeTreeDataPart const>, std::allocator<std::shared_ptr<DB::IMergeTreeDataPart const>>> const&, std::unordered_set<String, std::hash<String>, std::equal_to<String>, std::allocator<String>>*)::$_4&>(DB::MergeTreeData::clearPartsFromFilesystemImpl(std::vector<std::shared_ptr<DB::IMergeTreeDataPart const>, std::allocator<std::shared_ptr<DB::IMergeTreeDataPart const>>> const&, std::unordered_set<String, std::hash<String>, std::equal_to<String>, std::allocator<String>>*)::$_4&)
2023.06.16 10:10:00.498672 [ 50947 ] {} <Fatal> BaseDaemon: 11.4. inlined from ./build_docker/./contrib/llvm-project/libcxx/include/__functional/invoke.h:479: void std::__invoke_void_return_wrapper<void, true>::__call<DB::MergeTreeData::clearPartsFromFilesystemImpl(std::vector<std::shared_ptr<DB::IMergeTreeDataPart const>, std::allocator<std::shared_ptr<DB::IMergeTreeDataPart const>>> const&, std::unordered_set<String, std::hash<String>, std::equal_to<String>, std::allocator<String>>*)::$_4&>(DB::MergeTreeData::clearPartsFromFilesystemImpl(std::vector<std::shared_ptr<DB::IMergeTreeDataPart const>, std::allocator<std::shared_ptr<DB::IMergeTreeDataPart const>>> const&, std::unordered_set<String, std::hash<String>, std::equal_to<String>, std::allocator<String>>*)::$_4&)
2023.06.16 10:10:00.498959 [ 50947 ] {} <Fatal> BaseDaemon: 11.5. inlined from ./build_docker/./contrib/llvm-project/libcxx/include/__functional/function.h:235: std::__function::__default_alloc_func<DB::MergeTreeData::clearPartsFromFilesystemImpl(std::vector<std::shared_ptr<DB::IMergeTreeDataPart const>, std::allocator<std::shared_ptr<DB::IMergeTreeDataPart const>>> const&, std::unordered_set<String, std::hash<String>, std::equal_to<String>, std::allocator<String>>*)::$_4, void ()>::operator()[abi:v15000]()
2023.06.16 10:10:00.499023 [ 50947 ] {} <Fatal> BaseDaemon: 11. ./build_docker/./contrib/llvm-project/libcxx/include/__functional/function.h:716: void std::__function::__policy_invoker<void ()>::__call_impl<std::__function::__default_alloc_func<DB::MergeTreeData::clearPartsFromFilesystemImpl(std::vector<std::shared_ptr<DB::IMergeTreeDataPart const>, std::allocator<std::shared_ptr<DB::IMergeTreeDataPart const>>> const&, std::unordered_set<String, std::hash<String>, std::equal_to<String>, std::allocator<String>>*)::$_4, void ()>>(std::__function::__policy_storage const*) @ 0x000000004482ed6a in /usr/bin/clickhouse
2023.06.16 10:10:01.235397 [ 50947 ] {} <Fatal> BaseDaemon: 12.1. inlined from ./build_docker/./contrib/llvm-project/libcxx/include/__functional/function.h:0: operator()
2023.06.16 10:10:01.235489 [ 50947 ] {} <Fatal> BaseDaemon: 12. ./build_docker/./contrib/llvm-project/libcxx/include/__functional/invoke.h:394: decltype(std::declval<void>()()) std::__invoke[abi:v15000]<std::function<std::future<void> (std::function<void ()>&&, Priority)> DB::threadPoolCallbackRunner<void, std::function<void ()>>(ThreadPoolImpl<ThreadFromGlobalPoolImpl<false>>&, String const&)::'lambda'(std::function<void ()>&&, Priority)::operator()(std::function<void ()>&&, Priority)::'lambda'()&>(void&&) @ 0x000000003cece808 in /usr/bin/clickhouse
2023.06.16 10:10:01.948679 [ 50947 ] {} <Fatal> BaseDaemon: 13. ./build_docker/./contrib/llvm-project/libcxx/include/future:1694: std::__packaged_task_func<std::function<std::future<void> (std::function<void ()>&&, Priority)> DB::threadPoolCallbackRunner<void, std::function<void ()>>(ThreadPoolImpl<ThreadFromGlobalPoolImpl<false>>&, String const&)::'lambda'(std::function<void ()>&&, Priority)::operator()(std::function<void ()>&&, Priority)::'lambda'(), std::allocator<std::function<std::future<void> (std::function<void ()>&&, Priority)> DB::threadPoolCallbackRunner<void, std::function<void ()>>(ThreadPoolImpl<ThreadFromGlobalPoolImpl<false>>&, String const&)::'lambda'(std::function<void ()>&&, Priority)::operator()(std::function<void ()>&&, Priority)::'lambda'()>, void ()>::operator()() @ 0x000000003cece18d in /usr/bin/clickhouse
2023.06.16 10:10:03.368232 [ 50947 ] {} <Fatal> BaseDaemon: 14. ./build_docker/./contrib/llvm-project/libcxx/include/future:2069: std::packaged_task<void ()>::operator()() @ 0x000000003be6b65d in /usr/bin/clickhouse
2023.06.16 10:10:04.096900 [ 50947 ] {} <Fatal> BaseDaemon: 15. ./build_docker/./contrib/llvm-project/libcxx/include/__functional/function.h:717: void std::__function::__policy_invoker<void ()>::__call_impl<std::__function::__default_alloc_func<std::function<std::future<void> (std::function<void ()>&&, Priority)> DB::threadPoolCallbackRunner<void, std::function<void ()>>(ThreadPoolImpl<ThreadFromGlobalPoolImpl<false>>&, String const&)::'lambda'(std::function<void ()>&&, Priority)::operator()(std::function<void ()>&&, Priority)::'lambda0'(), void ()>>(std::__function::__policy_storage const*) @ 0x000000003cecee2e in /usr/bin/clickhouse
2023.06.16 10:10:04.392830 [ 50947 ] {} <Fatal> BaseDaemon: 16.1. inlined from ./build_docker/./base/base/../base/wide_integer_impl.h:796: bool wide::integer<128ul, unsigned int>::_impl::operator_eq<wide::integer<128ul, unsigned int>>(wide::integer<128ul, unsigned int> const&, wide::integer<128ul, unsigned int> const&)
2023.06.16 10:10:04.392963 [ 50947 ] {} <Fatal> BaseDaemon: 16.2. inlined from ./build_docker/./base/base/../base/wide_integer_impl.h:1463: bool wide::operator==<128ul, unsigned int, 128ul, unsigned int>(wide::integer<128ul, unsigned int> const&, wide::integer<128ul, unsigned int> const&)
2023.06.16 10:10:04.393065 [ 50947 ] {} <Fatal> BaseDaemon: 16.3. inlined from ./build_docker/./base/base/../base/strong_typedef.h:42: StrongTypedef<wide::integer<128ul, unsigned int>, DB::UUIDTag>::operator==(StrongTypedef<wide::integer<128ul, unsigned int>, DB::UUIDTag> const&) const
2023.06.16 10:10:04.393119 [ 50947 ] {} <Fatal> BaseDaemon: 16.4. inlined from ./build_docker/./src/Common/OpenTelemetryTraceContext.h:65: DB::OpenTelemetry::Span::isTraceEnabled() const
2023.06.16 10:10:04.393149 [ 50947 ] {} <Fatal> BaseDaemon: 16. ./build_docker/./src/Common/ThreadPool.cpp:418: ThreadPoolImpl<ThreadFromGlobalPoolImpl<false>>::worker(std::__list_iterator<ThreadFromGlobalPoolImpl<false>, void*>) @ 0x0000000028491cd1 in /usr/bin/clickhouse
2023.06.16 10:10:04.604101 [ 50947 ] {} <Fatal> BaseDaemon: 17. ./build_docker/./src/Common/ThreadPool.cpp:0: ThreadFromGlobalPoolImpl<false>::ThreadFromGlobalPoolImpl<void ThreadPoolImpl<ThreadFromGlobalPoolImpl<false>>::scheduleImpl<void>(std::function<void ()>, Priority, std::optional<unsigned long>, bool)::'lambda0'()>(void&&)::'lambda'()::operator()() @ 0x000000002849d00b in /usr/bin/clickhouse
2023.06.16 10:10:04.915759 [ 50947 ] {} <Fatal> BaseDaemon: 18. ./build_docker/./contrib/llvm-project/libcxx/include/__functional/function.h:717: void std::__function::__policy_invoker<void ()>::__call_impl<std::__function::__default_alloc_func<ThreadFromGlobalPoolImpl<false>::ThreadFromGlobalPoolImpl<void ThreadPoolImpl<ThreadFromGlobalPoolImpl<false>>::scheduleImpl<void>(std::function<void ()>, Priority, std::optional<unsigned long>, bool)::'lambda0'()>(void&&)::'lambda'(), void ()>>(std::__function::__policy_storage const*) @ 0x000000002849cebf in /usr/bin/clickhouse
2023.06.16 10:10:05.158241 [ 50947 ] {} <Fatal> BaseDaemon: 19.1. inlined from ./build_docker/./base/base/../base/wide_integer_impl.h:796: bool wide::integer<128ul, unsigned int>::_impl::operator_eq<wide::integer<128ul, unsigned int>>(wide::integer<128ul, unsigned int> const&, wide::integer<128ul, unsigned int> const&)
2023.06.16 10:10:05.158323 [ 50947 ] {} <Fatal> BaseDaemon: 19.2. inlined from ./build_docker/./base/base/../base/wide_integer_impl.h:1463: bool wide::operator==<128ul, unsigned int, 128ul, unsigned int>(wide::integer<128ul, unsigned int> const&, wide::integer<128ul, unsigned int> const&)
2023.06.16 10:10:05.158382 [ 50947 ] {} <Fatal> BaseDaemon: 19.3. inlined from ./build_docker/./base/base/../base/strong_typedef.h:42: StrongTypedef<wide::integer<128ul, unsigned int>, DB::UUIDTag>::operator==(StrongTypedef<wide::integer<128ul, unsigned int>, DB::UUIDTag> const&) const
2023.06.16 10:10:05.158424 [ 50947 ] {} <Fatal> BaseDaemon: 19.4. inlined from ./build_docker/./src/Common/OpenTelemetryTraceContext.h:65: DB::OpenTelemetry::Span::isTraceEnabled() const
2023.06.16 10:10:05.158453 [ 50947 ] {} <Fatal> BaseDaemon: 19. ./build_docker/./src/Common/ThreadPool.cpp:418: ThreadPoolImpl<std::thread>::worker(std::__list_iterator<std::thread, void*>) @ 0x0000000028488dbf in /usr/bin/clickhouse
2023.06.16 10:10:05.484806 [ 50947 ] {} <Fatal> BaseDaemon: 20.1. inlined from ./build_docker/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:303: std::unique_ptr<std::tuple<std::unique_ptr<std::__thread_struct, std::default_delete<std::__thread_struct>>, void ThreadPoolImpl<std::thread>::scheduleImpl<void>(std::function<void ()>, Priority, std::optional<unsigned long>, bool)::'lambda0'()>, std::default_delete<std::tuple<std::unique_ptr<std::__thread_struct, std::default_delete<std::__thread_struct>>, void ThreadPoolImpl<std::thread>::scheduleImpl<void>(std::function<void ()>, Priority, std::optional<unsigned long>, bool)::'lambda0'()>>>::reset[abi:v15000](std::tuple<std::unique_ptr<std::__thread_struct, std::default_delete<std::__thread_struct>>, void ThreadPoolImpl<std::thread>::scheduleImpl<void>(std::function<void ()>, Priority, std::optional<unsigned long>, bool)::'lambda0'()>*)
2023.06.16 10:10:05.484888 [ 50947 ] {} <Fatal> BaseDaemon: 20.2. inlined from ./build_docker/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:259: ~unique_ptr
2023.06.16 10:10:05.484921 [ 50947 ] {} <Fatal> BaseDaemon: 20. ./build_docker/./contrib/llvm-project/libcxx/include/thread:297: void* std::__thread_proxy[abi:v15000]<std::tuple<std::unique_ptr<std::__thread_struct, std::default_delete<std::__thread_struct>>, void ThreadPoolImpl<std::thread>::scheduleImpl<void>(std::function<void ()>, Priority, std::optional<unsigned long>, bool)::'lambda0'()>>(void*) @ 0x000000002849648b in /usr/bin/clickhouse
2023.06.16 10:10:05.484969 [ 50947 ] {} <Fatal> BaseDaemon: 21. ? @ 0x00007fbbd2a9d609 in ?
2023.06.16 10:10:05.485004 [ 50947 ] {} <Fatal> BaseDaemon: 22. clone @ 0x00007fbbd29c2133 in ?
2023.06.16 10:10:05.485097 [ 50947 ] {} <Fatal> BaseDaemon: Integrity check of the executable skipped because the reference checksum could not be read.
2023.06.16 10:10:18.614378 [ 648 ] {} <Fatal> Application: Child process was terminated by signal 6.

It can be caused by one of the tasks throwing exception and the stack being unwound while there are still other tasks running that have a pointer to part_names_mutex.

Might be related to #49474

@robot-ch-test-poll1 robot-ch-test-poll1 added the pr-not-for-changelog This PR should not be mentioned in the changelog label Jun 16, 2023
@robot-ch-test-poll1
Copy link
Copy Markdown
Contributor

robot-ch-test-poll1 commented Jun 16, 2023

This is an automated comment for commit 8289d8f with description of existing statuses. It's updated for the latest CI running
The full report is available here
The overall status of the commit is 🔴 error

Check nameDescriptionStatus
AST fuzzerRuns randomly generated queries to catch program errors. The build type is optionally given in parenthesis. If it fails, ask a maintainer for help🟢 success
CI runningA meta-check that indicates the running CI. Normally, it's in success or pending state. The failed status indicates some problems with the PR🟡 pending
ClickHouse build checkBuilds ClickHouse in various configurations for use in further steps. You have to fix the builds that fail. Build logs often has enough information to fix the error, but you might have to reproduce the failure locally. The cmake options can be found in the build log, grepping for cmake. Use these options and follow the general build process🟡 pending
Compatibility checkChecks that clickhouse binary runs on distributions with old libc versions. If it fails, ask a maintainer for help🟢 success
Fast testNormally this is the first check that is ran for a PR. It builds ClickHouse and runs most of stateless functional tests, omitting some. If it fails, further checks are not started until it is fixed. Look at the report to see which tests fail, then reproduce the failure locally as described here🟢 success
Flaky testsChecks if new added or modified tests are flaky by running them repeatedly, in parallel, with more randomization. Functional tests are run 100 times with address sanitizer, and additional randomization of thread scheduling. Integrational tests are run up to 10 times. If at least once a new test has failed, or was too long, this check will be red. We don't allow flaky tests, read the doc🟢 success
Install packagesChecks that the built packages are installable in a clear environment🟢 success
Integration testsThe integration tests report. In parenthesis the package type is given, and in square brackets are the optional part/total tests🟢 success
Mergeable CheckChecks if all other necessary checks are successful🔴 failure
Performance ComparisonMeasure changes in query performance. The performance test report is described in detail here. In square brackets are the optional part/total tests🟢 success
Push to DockerhubThe check for building and pushing the CI related docker images to docker hub🟢 success
SqllogicRun clickhouse on the sqllogic test set against sqlite and checks that all statements are passed🟢 success
Stateful testsRuns stateful functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc🟢 success
Stateless testsRuns stateless functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc🔴 error
Stress testRuns stateless functional tests concurrently from several clients to detect concurrency-related errors🟢 success
Style CheckRuns a set of checks to keep the code style clean. If some of tests failed, see the related log from the report🟢 success
Unit testsRuns the unit tests for different release types🟢 success
Upgrade checkRuns stress tests on server version from last release and then tries to upgrade it to the version from the PR. It checks if the new server can successfully startup without any errors, crashes or sanitizer asserts🟢 success

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants