Skip to content

Avoid hangs of system.stack_trace by correctly prohibit parallel read from it - #57641

Merged
alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
azat:system.stack_trace-fix
Dec 9, 2023
Merged

alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
azat:system.stack_trace-fix

Conversation

@azat

@azat azat commented Dec 7, 2023 •

Copy link
Copy Markdown
Member

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):

Prohibit parallel read from system.stack_trace (otherwise this will lead to hang of system.stack_trace table up to storage_system_stack_trace_pipe_read_timeout_ms)

Before rewriting system.stack_trace to handle max_block_size (in #54946)
parallel reading from system.stack_trace was prohibited, because this
could lead to hang of system.stack_trace table.

But that rewrite broke this guarantee, so let's fix it to avoid possible
hung.

Fixes: #54946 (cc @alexey-milovidov )

@robot-ch-test-poll1 robot-ch-test-poll1 added the pr-bugfix Pull request with bugfix, not backported by default label Dec 7, 2023
@robot-ch-test-poll1

robot-ch-test-poll1 commented Dec 7, 2023 •

Copy link
Copy Markdown
Contributor

This is an automated comment for commit b1043b7 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
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✅ 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 image for serversThe check to build and optionally push the mentioned image to docker hub✅ 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
Mergeable CheckChecks if all other necessary checks are successful✅ 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
Push to DockerhubThe check for building and pushing the CI related docker images to docker hub✅ 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
Stateless testsRuns stateless functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc✅ success
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
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 validate checkChecks that either a new test (functional or integration) or there some changed tests that fail with the binary built on master branch❌ error
Integration testsThe integration tests report. In parenthesis the package type is given, and in square brackets are the optional part/total tests❌ failure
Stateful testsRuns stateful functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc❌ failure
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❌ failure

@azat
azat marked this pull request as draft December 7, 2023 21:59
@alexey-milovidov

Copy link
Copy Markdown
Member

Ok. Did you mean it was already prohibited, but then we made the generate function run multiple times, and this property was lost?

@alexey-milovidov alexey-milovidov self-assigned this Dec 7, 2023
Before rewriting system.stack_trace to handle max_block_size (in ClickHouse#54946)
parallel reading from system.stack_trace was prohibited, because this
could lead to hang of system.stack_trace table.

But that rewrite broke this guarantee, so let's fix it to avoid possible
hung.

Signed-off-by: Azat Khuzhin <[email protected]>
@azat
azat force-pushed the system.stack_trace-fix branch from 215cd90 to 16cbcf7 Compare December 8, 2023 10:26
@azat azat changed the title Prohibit parallel read from system.stack_trace Avoid hangs of system.stack_trace by correctly prohibit parallel read from it Dec 8, 2023
@azat

azat commented Dec 8, 2023 •

Copy link
Copy Markdown
Member Author

Did you mean it was already prohibited, but then we made the generate function run multiple times, and this property was lost?

Yes, it had been broken during adding support of max_block_size.

Actually the code looks complex, I think it could be simplified, I will submit another PR after this one (not to mix bug fixes with other changes).

UPD: due to signal limitations I guess it does not worth it, so let's leave as-is.

@azat
azat marked this pull request as ready for review December 8, 2023 10:32
@azat azat mentioned this pull request Dec 8, 2023
@azat

azat commented Dec 8, 2023 •

Copy link
Copy Markdown
Member Author

Integration tests (asan, analyzer) [1/6] — fail: 38, passed: 75

==================================== ERRORS ====================================
______________ ERROR at setup of test_allowed_databases[configs] _______________
[gw0] linux -- Python 3.10.12 /usr/bin/python3

request = <SubRequest 'test_cluster' for <Function test_allowed_databases[configs]>>

    @pytest.fixture(scope="module", params=["configs", "configs_secure"])
    def test_cluster(request):
        cluster = ClickHouseClusterWithDDLHelpers(__file__, request.param, request.param)
    
        try:
>           cluster.prepare()

test_distributed_ddl/test.py:19: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test_distributed_ddl/cluster.py:64: in prepare
    self.pm_random_drops._add_rule(
helpers/network.py:94: in _add_rule
    _NetworkManager.get().add_iptables_rule(**rule)
helpers/network.py:156: in add_iptables_rule
    self._exec_run(cmd, privileged=True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <helpers.network._NetworkManager object at 0x7fb62f674700>
cmd = ['iptables', '--wait', '-I', 'DOCKER-USER', '1', '-m', ...]
kwargs = {'privileged': True}, container = <Container: 27b1d483719d>
handle = {'Id': '3aaca46e2dbf426b7867b97e5d102fe8741ed2ae074a92f96d253e19766b1855'}
output = 'OCI runtime exec failed: exec failed: unable to start container process: exec: "iptables": executable file not found in $PATH: unknown\r\n'

This can help to debug 01051_system_stack_trace test failures.

Signed-off-by: Azat Khuzhin <[email protected]>
@azat
azat force-pushed the system.stack_trace-fix branch from 2a85004 to b1043b7 Compare December 8, 2023 15:19
@azat

azat commented Dec 9, 2023

Copy link
Copy Markdown
Member Author

Test failures are not related:

AST fuzzer (asan) — Logical error: 'Sorting column 1025_UInt16 wasn't found in the ActionsDAG's outputs. DAG:

ClickHouse Integration Tests (release) [2/4] for PR #57641

  • test_storage_kafka/test.py::test_system_kafka_consumers_rebalance
  • test_dictionaries_update_and_reload/test.py::test_reload_while_loading

ClickHouse Stateful Tests (ubsan, ParallelReplicas) for PR #57641

  • 00180_no_seek_avoiding_when_reading_from_cache
2023.12.09 03:43:30.561814 [ 2852 ] {5b525c49-52da-4a1e-a37b-7b462324b7e9} <Fatal> : Logical error: 'file_offset_of_buffer_end <= read_until_position'.

@alexey-milovidov
alexey-milovidov merged commit 56cd919 into ClickHouse:master Dec 9, 2023
@azat
azat deleted the system.stack_trace-fix branch December 9, 2023 16:21
alexey-milovidov added a commit that referenced this pull request Dec 18, 2023
This reverts commit 56cd919, reversing
changes made to 41f126e.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-bugfix Pull request with bugfix, not backported by default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants