Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix possible stuck on error in HashedDictionaryParallelLoader #60926

Merged
merged 3 commits into from Mar 7, 2024

Conversation

vdimir
Copy link
Member

@vdimir vdimir commented Mar 6, 2024

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

  • Fix possible stuck on error while reloading dictionary with SHARDS

@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-bugfix Pull request with bugfix, not backported by default label Mar 6, 2024
@robot-clickhouse-ci-1
Copy link
Contributor

robot-clickhouse-ci-1 commented Mar 6, 2024

This is an automated comment for commit 7e90871 with description of existing statuses. It's updated for the latest CI running

❌ Click here to open a full report in a separate page

Successful checks
Check nameDescriptionStatus
A SyncThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
ClickBenchRuns [ClickBench](https://github.com/ClickHouse/ClickBench/) with instant-attach table✅ success
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✅ success
Compatibility checkChecks that clickhouse binary runs on distributions with old libc versions. If it fails, ask a maintainer for help✅ success
Docker keeper imageThe check to build and optionally push the mentioned image to docker hub✅ success
Docker server imageThe check to build and optionally push the mentioned image to docker hub✅ success
Docs checkBuilds and tests the documentation✅ 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✅ success
PR CheckThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
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
SQLTestThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
SQLancerFuzzing tests that detect logical bugs with SQLancer tool✅ 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
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
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❌ failure
Bugfix validationChecks that either a new test (functional or integration) or there some changed tests that fail with the binary built on master branch❌ failure
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
Stateless testsRuns stateless functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc❌ failure
Stress testRuns stateless functional tests concurrently from several clients to detect concurrency-related errors❌ failure

@nickitat nickitat self-assigned this Mar 6, 2024
if (!shards_queues[shard]->push(std::move(shards_blocks[shard])))
throw Exception(ErrorCodes::LOGICAL_ERROR, "Could not push to shards queue #{}", shard);
const auto & current_block = shards_blocks[shard];
while (!shards_queues[shard]->tryPush(current_block, /* milliseconds= */ 100))
Copy link
Member

Choose a reason for hiding this comment

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

previously we moved block, shouldn't we do it now too?

if (!shards_queues[shard]->push(std::move(shards_blocks[shard])))
throw Exception(ErrorCodes::LOGICAL_ERROR, "Could not push to shards queue #{}", shard);
const auto & current_block = shards_blocks[shard];
while (!shards_queues[shard]->tryPush(current_block, /* milliseconds= */ 100))
Copy link
Member

Choose a reason for hiding this comment

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

if I understood it correctly, we will fail the whole load operation if even a single block took more than 100ms to insert it. it seems to restrictive. and probably there are some sources that produce big blocks or a single block for the whole output.
maybe we could make it configurable or just set to a much bigger value. like 10s or a minute?

Copy link
Member Author

Choose a reason for hiding this comment

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

We retry tryPush until block is inserted.
I replaced push to tryPush and if to while, because I don't want thread to be blocked without checking if workers are alive. So, if we cannot push, we will check status of workers and loading_timeout each 100 ms. If everything is alright we will retry push, otherwise we will have a chance to stop.
It's also the reason why std::move is not used anymore, I hope it won't be significant.

Copy link
Member

Choose a reason for hiding this comment

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

It's also the reason why std::move is not used anymore, I hope it won't be significant

yep, makes sense.

my question was "what if it cannot be inserted in 100ms at all", so we would retry but it won't help because the t/o is too low. but since it is just insertion in queue (i.e. shouldn't depend on block size) maybe it is indeed ok.

@vdimir
Copy link
Member Author

vdimir commented Mar 7, 2024

AST fuzzer (asan) — ERROR: AddressSanitizer: heap-buffer-overflow on address 0x51200355ce78 at pc 0x558da67e2b09 bp 0x7f4d1b7a0e90 sp 0x7f4d1b7a0e88 Details

#59684

AST fuzzer (debug) — Found error: IAST::clone() is broken for some AST node. This is a bug. The original AST ('dump before fuzz') and its cloned copy ('dump o... Details

Fix #61013

Bugfix validation — New test(s) failed to reproduce a bug Details

It's tricky to reproduce in CI, it requires indserting specific faults into the code (wait until there're threads waiting on push and throwing exception from workter in that very moment)

Stateless tests (aarch64) — fail: 1, passed: 6156, skipped: 25 Details

#57443

Stress test (asan) — Possible deadlock on shutdown (see gdb.log) Details

It took >5min to stop the server:

2024.03.07 01:49:49.949917 [ 1123674 ] {} <Information> Application: Received termination signal (Terminated)
...
2024.03.07 01:49:49.949973 [ 1123673 ] {} <Debug> Application: Received termination signal.
2024.03.07 01:49:49.950919 [ 1123673 ] {} <Debug> Application: Waiting for current connections to close.
2024.03.07 01:49:51.511970 [ 1123673 ] {} <Information> Application: Closed all listening sockets.
2024.03.07 01:49:51.634258 [ 1123673 ] {} <Information> Application: Closed connections.
2024.03.07 01:49:51.635280 [ 1123673 ] {} <Information> Application: Stopping AsyncLoader.
2024.03.07 01:49:51.738402 [ 1123673 ] {} <Information> CgroupsMemoryUsageObserver: Stopped cgroup current memory usage observer thread.
...
2024.03.07 01:55:45.680801 [ 1123669 ] {} <Fatal> Application: Child process was terminated by signal 9 (KILL). If it is not done by 'forcestop' command or manually, the possible cause is OOM Killer (see 'dmesg' and look at the '/var/log/kern.log' for the details).

No stuck threads related to dictionary in gdb.log, most likely something else...

@vdimir vdimir merged commit 7983f88 into master Mar 7, 2024
251 of 261 checks passed
@vdimir vdimir deleted the vdimir/hashed_dictinary_load_fix branch March 7, 2024 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-backports-created-cloud pr-bugfix Pull request with bugfix, not backported by default pr-must-backport-cloud pr-synced-to-cloud The PR is synced to the cloud repo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants