Skip to content

Fix leftover processes/hangs in tests#58200

Merged
alexey-milovidov merged 1 commit intoClickHouse:masterfrom
azat:tests/processes-cleanup
Dec 24, 2023
Merged

Fix leftover processes/hangs in tests#58200
alexey-milovidov merged 1 commit intoClickHouse:masterfrom
azat:tests/processes-cleanup

Conversation

@azat
Copy link
Copy Markdown
Member

@azat azat commented Dec 23, 2023

One of such cases is 02479_race_condition_between_insert_and_droppin_mv 1, yes it can be fixed (by using fixed number of iterations, or with some bash trickery), but it is better to fix them completelly, eventually such tests will be submitted and pass review anyway.

By allocating process group for each test we can kill all the processes in this process group, and this what this patch does.

This will also fix some test hangs (like in 1) as well as some possible issues in stress tests.

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

One of such cases is 02479_race_condition_between_insert_and_droppin_mv
[1], yes it can be fixed (by using fixed number of iterations, or with
some bash trickery), but it is better to fix them completelly,
eventually such tests will be submitted and pass review anyway.

By allocating process group for each test we can kill all the processes
in this process group, and this what this patch does.

This will also fix some test hangs (like in [1]) as well as some
possible issues in stress tests.

  [1]: https://s3.amazonaws.com/clickhouse-test-reports/0/e2c1230b00386c4d0096a245396ab3be7ce60950/stateless_tests__release__analyzer_/run.log

Signed-off-by: Azat Khuzhin <[email protected]>
@robot-ch-test-poll robot-ch-test-poll added the pr-not-for-changelog This PR should not be mentioned in the changelog label Dec 23, 2023
@robot-ch-test-poll
Copy link
Copy Markdown
Contributor

robot-ch-test-poll commented Dec 23, 2023

This is an automated comment for commit 72fa58e 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
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
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 server and keeper imagesThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Docs checkThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ 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
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
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
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
Integration testsThe integration tests report. In parenthesis the package type is given, and in square brackets are the optional part/total tests❌ failure
Stateless testsRuns stateless 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

@alexey-milovidov alexey-milovidov self-assigned this Dec 24, 2023
@alexey-milovidov alexey-milovidov merged commit 069f8bb into ClickHouse:master Dec 24, 2023
@alexey-milovidov
Copy link
Copy Markdown
Member

Thank you! This is a tremendous improvement!
I was also burned by a test process that was running indefinitely in the background.

@alexey-milovidov
Copy link
Copy Markdown
Member

alexey-milovidov commented Dec 24, 2023

Sorry, reverted due to

Green Master
APP 5:56 AM
There are 2 new BROKEN tests:

Please resubmit.

@azat
Copy link
Copy Markdown
Member Author

azat commented Dec 24, 2023

It's just unhide the problems, this two could be fixed, but likely there are more, and if patch will be reverted each time it could take lot's of time to fix everything.

@alexey-milovidov
Copy link
Copy Markdown
Member

There is a new BROKEN test:

  • 02015_async_inserts_stress_long - Report - CI DB
    There is a new flaky test:
  • 01443_merge_truncate_long - Report - CI DB

@alexey-milovidov
Copy link
Copy Markdown
Member

@azat let's fix these and re-apply.

@azat
Copy link
Copy Markdown
Member Author

azat commented Dec 24, 2023

Actually I'm not sure that this PR is relevant, there should not be any killpg for these cases, since there was no timeout. And setsid call should not change anything, at least on CI, since there is no terminal attached anyway.

@azat
Copy link
Copy Markdown
Member Author

azat commented Dec 24, 2023

But I guess timeout --foreground is related, while it is required to make everything works

@azat
Copy link
Copy Markdown
Member Author

azat commented Dec 24, 2023

There are 200+ tests with timeout and all of them now may fail with such errors

I've already made an attempt to address it - https://github.com/ClickHouse/ClickHouse/pull/34924/files
But due to bug in bash it had been reverted

Maybe I will get back once I will have inspiration for this...

P.S. I was thinking about fixing it in a different way - by killing all processes starting from the children in clickhouse-test, but the problem cannot be solved on that level, the timeout invocations should be fixed, since they produce this errors. Plus killing from child can be racy (you are killing childs, but the parent creates one more). This problem can be solved by using cgroups, but it requries some permissions. So to sum up: lots of complexity.

@azat
Copy link
Copy Markdown
Member Author

azat commented Dec 24, 2023

OK, let's try this one - #58213

@azat azat deleted the tests/processes-cleanup branch December 24, 2023 12:26
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.

3 participants