HDDS-6658. BackgroundPipelineCreator does not always stop quickly#3357
Merged
Conversation
Contributor
Author
szetszwo
reviewed
Apr 28, 2022
Comment on lines
151
to
152
Contributor
There was a problem hiding this comment.
We should remove "synchronized" since interrupt() does not require it.
Contributor
There was a problem hiding this comment.
I suggest to keep the private monitor field. It can avoid code outside this class calling wait/notify/notifyAll.
Contributor
Author
|
@szetszwo Thanks for the review. I have rolled back the earlier changes and implemented again in a new commit. Please have another look when you get a chance. |
szetszwo
approved these changes
Apr 28, 2022
szetszwo
left a comment
Contributor
There was a problem hiding this comment.
+1 the change looks good.
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.
What changes were proposed in this pull request?
On my laptop, TestSCMSafeModeManager.testSafeModePipelineExitRule() always takes just over 200 seconds. Checking a few PR runs, it does not seem to be slow on PRs, just locally.
Debugging the code, it seems to hang in the BackgroundPipelineCreator.stop() method, where it is waiting for the tread to join:
It is clearly hanging as the background thread did not exit, and I believe it is because
notify()is being used to try to exit the thread, when it should really be interrupted. There is a chance that notify is called while the thread is not waiting, and if so, it will just fall back into the wait state and not exit until it wakes up again.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-6658
How was this patch tested?
Validated slow test is now fast locally.