Skip to content

Cherry pick #90243 to 25.3: Fix crash in StorageDistributed when parsing malformed shard directory names#90313

Merged
robot-clickhouse-ci-1 merged 3 commits intobackport/25.3/90243from
cherrypick/25.3/90243
Jan 2, 2026
Merged

Cherry pick #90243 to 25.3: Fix crash in StorageDistributed when parsing malformed shard directory names#90313
robot-clickhouse-ci-1 merged 3 commits intobackport/25.3/90243from
cherrypick/25.3/90243

Conversation

@robot-clickhouse-ci-1
Copy link
Copy Markdown
Contributor

Original pull-request #90243

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

AVMusorin and others added 2 commits November 17, 2025 19:07
…y names

When ClickHouse encounters a distributed table directory with a name that:
- starts with the pattern `shardN_all_replicas` (e.g., `shard3_all_replicas_bkp`)
- but doesn't end with exactly `_all_replicas`

It would crash with a segmentation fault due to out-of-bounds array access.

Trace example:
```
* thread #1, name = 'clickhouse-serv', stop reason = signal SIGSEGV
  * frame #0: 0x000000001194481b clickhouse-server`DB::Cluster::Address::Address(DB::Cluster::Address const&) + 27
    frame #1: 0x0000000011944550 clickhouse-server`void std::__1::vector<DB::Cluster::Address, std::__1::allocator<DB::Cluster::Address> >::__push_back_slow_path<DB::Cluster::Address const&>(DB::Cluster::Address const&&&) + 208
    frame #2: 0x00000000129a6c35 clickhouse-server`DB::StorageDistributed::parseAddresses(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const + 3349
    frame #3: 0x00000000129a589b clickhouse-server`DB::StorageDistributed::getDirectoryQueue(std::__1::shared_ptr<DB::IDisk> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 3675
    frame #4: 0x00000000129a3f22 clickhouse-server`DB::StorageDistributed::initializeDirectoryQueuesForDisk(std::__1::shared_ptr<DB::IDisk> const&) + 2082
    frame #5: 0x000000000f681c48 clickhouse-server`DB::ThreadPoolCallbackRunnerLocal<void, ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true> >, std::__1::function<void ()> >::operator()(std::__1::function<void ()>&&, Priority)::'lambda'()::operator()() + 136
    frame #6: 0x000000000f68286c clickhouse-server`std::__1::packaged_task<void ()>::operator()() + 44
    frame #7: 0x000000000d83335b clickhouse-server`ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true> >::ThreadFromThreadPool::worker() + 2395
    frame #8: 0x000000000d839e23 clickhouse-server`void std::__1::__function::__policy_invoker<void ()>::__call_impl<std::__1::__function::__default_alloc_func<ThreadFromGlobalPoolImpl<false, true>::ThreadFromGlobalPoolImpl<void (ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true> >::ThreadFromThreadPool::*)(), ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true> >::ThreadFromThre
adPool*>(void (ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true> >::ThreadFromThreadPool::*&&)(), ThreadPoolImpl<ThreadFromGlobalPoolImpl<false, true> >::ThreadFromThreadPool*&&)::'lambda'(), void ()> >(std::__1::__function::__policy_storage const*) + 99
    frame #9: 0x000000000d830602 clickhouse-server`ThreadPoolImpl<std::__1::thread>::ThreadFromThreadPool::worker() + 2242
    frame #10: 0x000000000d8379ba clickhouse-server`_ZNSt3__114__thread_proxyB6v15007INS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEMN14ThreadPoolImplINS_6threadEE20ThreadFromThreadPoolEFvvEPSA_EEEEEPvSF_ + 90
```
Fix crash in StorageDistributed when parsing malformed shard directory names
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request pr-critical-bugfix labels Nov 18, 2025
@robot-clickhouse-ci-1
Copy link
Copy Markdown
Contributor Author

Dear @serxa, the PR is not updated for 1d0h0m5s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-clickhouse-ci-1
Copy link
Copy Markdown
Contributor Author

Dear @serxa, the PR is not updated for 1d0h4m30s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll1
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h54m36s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-clickhouse
Copy link
Copy Markdown
Member

Dear @serxa, the PR is not updated for 1d0h59m44s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll1
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h0m36s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll2
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h0m4s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll2
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h0m41s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h59m5s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-clickhouse-ci-1
Copy link
Copy Markdown
Contributor Author

Dear @serxa, the PR is not updated for 1d1h45m5s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-clickhouse
Copy link
Copy Markdown
Member

Dear @serxa, the PR is not updated for 1d0h42m49s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll2
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h2m59s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h0m2s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-clickhouse-ci-1
Copy link
Copy Markdown
Contributor Author

Dear @serxa, the PR is not updated for 1d0h1m25s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll2
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d1h0m41s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-clickhouse-ci-2
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h52m27s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll1
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h40m51s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll3
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h54m1s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-clickhouse-ci-1
Copy link
Copy Markdown
Contributor Author

Dear @serxa, the PR is not updated for 1d1h2m15s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-clickhouse-ci-1
Copy link
Copy Markdown
Contributor Author

Dear @serxa, the PR is not updated for 1d0h2m23s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll4
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h0m1s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-clickhouse-ci-2
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h0m56s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h57m59s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-clickhouse-ci-1
Copy link
Copy Markdown
Contributor Author

Dear @serxa, the PR is not updated for 1d0h0m44s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-clickhouse-ci-1
Copy link
Copy Markdown
Contributor Author

Dear @serxa, the PR is not updated for 1d0h58m25s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll1
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h1m40s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll3
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h0m34s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-clickhouse-ci-2
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d1h0m1s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-clickhouse-ci-1
Copy link
Copy Markdown
Contributor Author

Dear @serxa, the PR is not updated for 1d0h56m29s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll2
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h0m4s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll1
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h59m39s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll3
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d1h3m43s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll2
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h0m13s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h1m23s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-clickhouse-ci-1
Copy link
Copy Markdown
Contributor Author

Dear @serxa, the PR is not updated for 1d1h7m44s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll4
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h46m32s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-clickhouse-ci-1
Copy link
Copy Markdown
Contributor Author

Dear @serxa, the PR is not updated for 1d1h1m12s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h59m16s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll1
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h57m38s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-clickhouse-ci-1
Copy link
Copy Markdown
Contributor Author

Dear @serxa, the PR is not updated for 1d0h2m1s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-clickhouse-ci-2
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h1m3s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll3
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d1h1m10s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-ch-test-poll3
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h0m37s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-clickhouse-ci-2
Copy link
Copy Markdown
Contributor

Dear @serxa, the PR is not updated for 1d0h56m31s. Please, either resolve the conflicts, or close it to finish the backport process of #90243

@robot-clickhouse-ci-1 robot-clickhouse-ci-1 merged commit 842f1db into backport/25.3/90243 Jan 2, 2026
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 deleted the cherrypick/25.3/90243 branch January 2, 2026 16:16
@clickhouse-gh clickhouse-gh bot added the ready-for-backport PR is eligible for backporting (merged 7+ days ago, not reverted) label Mar 27, 2026
@maxknv maxknv removed the ready-for-backport PR is eligible for backporting (merged 7+ days ago, not reverted) label Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! pr-critical-bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.