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

Wait for metrics handling to finish even when there is an error #2798

Merged
merged 1 commit into from
Dec 5, 2022

Conversation

na--
Copy link
Member

@na-- na-- commented Dec 5, 2022

Before these changes, setup() and teardown() exceptions or test.abort() calls would have made k6 exit prematurely, without waiting for the metrics processing to finish. This bug was probably a cause for some of the "timed out" k6 run --out cloud tests we have seen, e.g. if they had some sort an error in setup() or teardown(). It also caused a data race in the recent integration tests, this is how I caught it. So, as a nice bonus, this fix allowed me to remove one of the FIXMEs for unnecessary locking in there earlier than expected 🎉

This is another thing that should be fixed by the new Engine-less architecture (#1889). However, once again, the fix was easy enough to do even now, and the bug severe enough that it's probably worth it to include it in the upcoming k6 v0.42.0.

I also added and expanded a bunch of integration tests, particularly when it comes to validating aborted tests and --linger, and this PR is built on top of #2795, so hopefully its last minute merging won't cause any regressions 🤞 🙏 📿 .

It seemed like the bug might have been introduced in k6 v0.36.0, via #2093 (the PR that added test.abort()), but it was actually probably introduced way back in k6 v0.27.0, with #1390, or even older... 😞 Still, the added tests for test.abort() and setup/teardown exceptions should provide some assurance now and in the future.

@na-- na-- added the bug label Dec 5, 2022
@na-- na-- added this to the v0.42.0 milestone Dec 5, 2022
oleiade
oleiade previously approved these changes Dec 5, 2022
Copy link
Member

@oleiade oleiade left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍🏻

codebien
codebien previously approved these changes Dec 5, 2022
olegbespalov
olegbespalov previously approved these changes Dec 5, 2022
cmd/run.go Outdated Show resolved Hide resolved
imiric
imiric previously approved these changes Dec 5, 2022
Copy link
Contributor

@imiric imiric left a comment

Choose a reason for hiding this comment

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

LGTM, nice job with the tests 👍

CI didn't run for some reason after your latest push 😕

Previous to this, setup() and teardown() exceptions or test.abort() calls would have made k6 exit prematurely, without waiting for the metrics processing to finish. This also caused a data race in integration tests and undefined behavior in general. The handleSummary() function was also called only when test.abort() was used, but not when there was an error in `setup()` and `teardown()`.

The commit also adds and improves a bunch of integration tests, particularly when it comes to validating aborted tests and --linger.
@na--
Copy link
Member Author

na-- commented Dec 5, 2022

Weird 😕 force-pushed again, with no changes besides the commit message, and CI seems to have started fine this time 🤞

@na-- na-- requested a review from imiric December 5, 2022 15:42
@na-- na-- merged commit 47ab3de into master Dec 5, 2022
@na-- na-- deleted the fix-run-error-wait branch December 5, 2022 16:26
@na-- na-- added the tests label Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants