-
Notifications
You must be signed in to change notification settings - Fork 68
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
Fix flakiness by synchronising the State #188
Conversation
} else { | ||
System.err.println("Planning to unblock " + k + " as failure"); | ||
s.errors.put(k, error); | ||
synchronized (s) { |
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.
I did not notice some tests that failed because of the race condition here, but since we are synchronizing the success method, then we need to synchronize here too.
Waiting for a review from maintainers |
@jglick could you please review |
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.
IIUC to match
workflow-support-plugin/src/test/java/org/jenkinsci/plugins/workflow/test/steps/SemaphoreStep.java
Lines 141 to 148 in a1c7106
synchronized (s) { | |
while (!s.started.contains(k)) { | |
if (b != null && !b.isBuilding()) { | |
throw new AssertionError(JenkinsRule.getLog(b)); | |
} | |
s.wait(1000); | |
} | |
} |
Description:
Cloudbees CI reported a flake in
org.jenkinsci.plugins.workflow.support.steps.StageStepTest.serializability
Error Log:
stderr.txt
How to reproduce:
I wasn't managed to reproduce it locally without code changes, but if we add
TimeUnit.MILLISECONDS.sleep(200);
before this line the StageStepTest.serializability started to flake regularly.Assumption:
My assumption that there is a deadlock possibility.
Solution:
As a solution I want to suggest to synchronize the State local variable (the same synchronisation mechanism is used here)