-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
testing: prevent test scheduling after reactor exit #2644
Conversation
src/testing/test_runner.cc
Outdated
@@ -130,6 +131,11 @@ test_runner::run_sync(std::function<future<>()> task) { | |||
// it. | |||
return; | |||
} | |||
if (_done) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can it happen that _done is false, but _exit_code is non-zero?
In other words -- is the above if (_exit_code != 0)
still required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh, you're right. with my change, if _done
is true, it implies app.run()
has returned -- it's an early return, and the return code is either 0
or a non-zero status code. let me update the change to further simplify this implementation.
c689479
to
7d20a3d
Compare
This comment was marked as resolved.
This comment was marked as resolved.
Previously, when handling "--help" (introduced in b8a13be), we returned status code 0 but continued scheduling test tasks to the Seastar reactor. This caused test applications to hang since the tasks expected the exchanger 'e' to be available after reactor exit. Fix this by using the "_done" flag to track reactor state: - Set "_done" when Seastar application exits - Skip task scheduling and exchanger wait if "_done" is set - Change test_runner::start_thread() to return bool indicating successful engine startup instead of exit code (exit code now stored in _exit_code member) This fixes the regression where "--help" would cause test applications to hang indefinitely. Fixes scylladb#2635 Signed-off-by: Kefu Chai <[email protected]>
7d20a3d
to
5539fd0
Compare
v2:
|
5539fd0
to
c0370fb
Compare
tested with kefu@mega:~/dev/seastar$ build/debug/tests/unit/queue_test -- --help
Running 3 test cases...
WARNING: debug mode. Not for benchmarking or production
App options:
-h [ --help ] show help message
--help-seastar show help message about seastar options
--help-loggers print a list of logger names and exit
--random-seed arg Random number generator seed
--fail-on-abandoned-failed-futures arg (=1)
Fail the test if there are any
abandoned failed futures
*** No errors detected
kefu@mega:~/dev/seastar$ |
Previously, when handling "--help" (introduced in b8a13be), we returned status code 0 but continued scheduling test tasks to the Seastar reactor. This caused test applications to hang since the tasks expected the exchanger 'e' to be available after reactor exit.
Fix this by using the "_done" flag to track reactor state:
This fixes the regression where "--help" would cause test applications to hang indefinitely.
Fixes #2635
Signed-off-by: Kefu Chai [email protected]