-
Notifications
You must be signed in to change notification settings - Fork 25k
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
[ML] fixes testWatchdog test verifying matcher is interrupted on timeout #62391
[ML] fixes testWatchdog test verifying matcher is interrupted on timeout #62391
Conversation
Pinging @elastic/ml-core (:ml) |
@elasticmachine update branch |
I think the problem you've identified could affect the production code as well as the test code. But you've fixed the test by introducing a new code path that works well for the test. So the production code is left with a flaw while the test starts working. It seems like a solution that should work both for testing and production is to say that if a matcher is registered after a timeout then it's instantly interrupted, i.e. change:
to something like:
Then the test can stay more-or-less as it was, but the timeout should be a random value between 10 and 500 to increase the chance of testing both code paths. What do you think? |
Definitely! I will make the change |
run elasticsearch-ci/packaging-sample-windows |
...k/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/filestructurefinder/TimeoutChecker.java
Show resolved
Hide resolved
...gin/ml/src/test/java/org/elasticsearch/xpack/ml/filestructurefinder/TimeoutCheckerTests.java
Outdated
Show resolved
Hide resolved
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.
LGTM
…out (elastic#62391) Constructing the timout checker FIRST and THEN registering the watcher allows the test to have a race condition. The timeout value could be reached BEFORE the matcher is added. To prevent the matcher never being interrupted, a new timedOut value is added to the watcher thread entry. Then when a new matcher is registered, if the thread was previously timedout, we interrupt the matcher immediately. closes elastic#48861
…out (#62391) (#62447) Constructing the timout checker FIRST and THEN registering the watcher allows the test to have a race condition. The timeout value could be reached BEFORE the matcher is added. To prevent the matcher never being interrupted, a new timedOut value is added to the watcher thread entry. Then when a new matcher is registered, if the thread was previously timedout, we interrupt the matcher immediately. closes #48861
Constructing the timout checker FIRST and THEN registering the watcher allows the test to have a race condition.
The timeout value could be reached BEFORE the matcher is added. To prevent the matcher never being interrupted, a new
timedOut
value is added to the watcher thread entry. Then when a new matcher is registered, if the thread was previously timedout, we interrupt the matcher immediately.closes #48861