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

Attach gdb in stateless tests #50487

Merged
merged 6 commits into from Jun 13, 2023

Conversation

Avogar
Copy link
Member

@Avogar Avogar commented Jun 2, 2023

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Bug with fibers and tsan stopped reproducing in stress tests, but started in stateless tests where we don't have gdb log with segfault stacktrace. Let's try to attach gdb in stateless tests in this PR and rerun CI until bug reproduces (not sure we want attached gdb in stateless tests in CI, maybe I will add it only for tsan for some time if I won't reproduce it in this PR).

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

robot-ch-test-poll3 commented Jun 2, 2023

This is an automated comment for commit 42393b5 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 🔴 failure

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🟢 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
Integration testsThe integration tests report. In parenthesis the package type is given, and in square brackets are the optional part/total tests🔴 failure
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
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
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
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

@qoega
Copy link
Member

qoega commented Jun 2, 2023

Why we don't want it in CI? We do not restart server in stateless tests, so we just need to attach once. It is not too slow compared to integration tests with different server runs

@Avogar
Copy link
Member Author

Avogar commented Jun 5, 2023

@tavplubix what do you think? Will it be ok to add it in CI?

@tavplubix
Copy link
Member

I think it's okay, it works fine in Stress tests

Comment on lines 119 to 121
# FIXME Hung check may work incorrectly because of attached gdb
# 1. False positives are possible
# 2. We cannot attach another gdb to get stacktraces if some queries hung
Copy link
Member

Choose a reason for hiding this comment

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

p. 1 is outdated

Copy link
Member Author

@Avogar Avogar Jun 5, 2023

Choose a reason for hiding this comment

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

Ok, I will update comment. And I will move it to some library to avoid code duplication

@Avogar Avogar changed the title [Not for merge] Test attach gdb in stateless tests Attach gdb in stateless tests Jun 5, 2023
@Avogar Avogar marked this pull request as ready for review June 5, 2023 17:52
@tavplubix tavplubix self-assigned this Jun 5, 2023

# FIXME Hung check may work incorrectly because of attached gdb
# We cannot attach another gdb to get stacktraces if some queries hung
gdb -batch -command script.gdb -p "$(cat /var/run/clickhouse-server/clickhouse-server.pid)" | ts '%Y-%m-%d %H:%M:%S' >> /test_output/gdb.log &
Copy link
Member

Choose a reason for hiding this comment

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

We need to kill this gdb before calling get_stacktraces_from_gdb in clickhouse-test if some queries hung (of course it would be much better to avoid starting another instance of gdb and just send some signal from clickhouse-test to make this instance stop waiting on continue and print the stacktraces, but I failed to do it). See also:

kill -TERM "$(pidof gdb)" ||:

# We attach gdb to clickhouse-server before running tests
# to print stacktraces of all crashes even if clickhouse cannot print it for some reason.
# However, it obstruct checking for hung queries.
logging.info("Will terminate gdb (if any)")
call_with_retry("kill -TERM $(pidof gdb)")

Copy link
Member Author

Choose a reason for hiding this comment

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

Will it be ok to just kill gdb in clickhouse-test inside get_stacktraces_from_gdb function before starting another gdb?

Copy link
Member

Choose a reason for hiding this comment

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

Yep

@tavplubix
Copy link
Member

Integration tests (asan) [6/6] - #49400
Stateless tests (debug) [3/5] - #50294
Stress test (tsan) - #50929

@tavplubix tavplubix merged commit 5368fa7 into ClickHouse:master Jun 13, 2023
254 of 257 checks passed
@Felixoid
Copy link
Member

Is it a way to reimplement it in a way to not break other older PRs? #50441

image

The image should assume there is no such file in the repo.

@Avogar
Copy link
Member Author

Avogar commented Jun 13, 2023

Is it a way to reimplement it in a way to not break other older PRs?

I guess we can just copypaste the same code in 2 places, but I don't like it. Or maybe copy this file to the image.

But I don't see a problem to just update old PRs with fresh master

@Felixoid
Copy link
Member

Felixoid commented Jun 13, 2023

Any commit untested before the image is updated won't be green.

I've faced the same problems with style check a couple of times too.

What about changing:

source /usr/share/clickhouse-test/ci/attach_gdb.lib || true  # fix for older commits
....
attach_gdb_to_clickhouse || true  # fix for older commits

?

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.

None yet

5 participants