Fix leftover processes/hangs in tests (resubmit)#58213
Merged
alexey-milovidov merged 2 commits intoClickHouse:masterfrom Dec 25, 2023
Merged
Fix leftover processes/hangs in tests (resubmit)#58213alexey-milovidov merged 2 commits intoClickHouse:masterfrom
alexey-milovidov merged 2 commits intoClickHouse:masterfrom
Conversation
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]> (cherry picked from commit 72fa58e)
The problem with --foreground option is that it send the signal only to the process that had been spawned by timeout(1), while it can create lots of children, and when you killing parent you are closing pipes and childrens will get EPIPE, like in [1]. [1]: https://s3.amazonaws.com/clickhouse-test-reports/0/069f8bbb2f48541cc736903e1da5459fa2c27da0/stateless_tests__debug__%5B2_5%5D.html Another problem is that now child process will finish correctly, which may also print some errors like QUERY_WAS_CANCELLED (see [2]). [2]: https://s3.amazonaws.com/clickhouse-test-reports/0/ef66714bf20042ba9cb5d59b7839befe26110b93/stateless_tests__release__analyzer_.html In general this is not required actually, since all timeout invocations uses timeout value less then the default test limit (10min). But it may leave some processes in case of overriding this limit, i.e. `clickhouse-test --timeout 1` So to workaround this at least somehow, let's send SIGTERM and only after some timeout (here I use 0.1), SIGKILL. This will give at least some ability to terminate all childrens that had been spawned by timeout(1). Signed-off-by: Azat Khuzhin <[email protected]>
Contributor
|
This is an automated comment for commit c5dbde8 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
|
alexey-milovidov
approved these changes
Dec 25, 2023
2 tasks
18 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original PR
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.
Resubmit PR
The problem with
timeout --foregroundoption is that it send the signal only tothe process that had been spawned by timeout(1), while it can create
lots of children, and when you killing parent you are closing pipes and
childrens will get EPIPE, like in 1.
Another problem is that now child process will finish correctly, which
may also print some errors like QUERY_WAS_CANCELLED (see 2).
In general this is not required actually, since all timeout invocations
uses timeout value less then the default test limit (10min). But it may
leave some processes in case of overriding this limit, i.e.
clickhouse-test --timeout 1So timeout --foreground cannot be used. And to workaround this at least
somehow, let's send SIGTERM and only after some timeout (here I use
0.1), SIGKILL. This will give at least some ability to terminate all
childrens that had been spawned by timeout(1).
Changelog category (leave one):
Resubmit of: #58200