-
Notifications
You must be signed in to change notification settings - Fork 196
[WIP] tck multithread failures #673
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
base: main
Are you sure you want to change the base?
Conversation
@olamy Can you link the reproducer? |
sure have a look here https://github.com/jetty-project/servlet-tck-run/ use branch
with the current content content of this PR I managed to reduced by a lot failure number because of this change https://github.com/arquillian/arquillian-core/pull/673/files#diff-5c09558098ba87d126edb03750d0b116404b1680a7821a0d206789d58f768d32R12 I still have some errors such
note I have added the check here https://github.com/arquillian/arquillian-core/pull/673/files#diff-94ece6fcd6683e6db69d1647fcf29bf2091d8f73deb8dd991848755b646e94d7R147 to track this. ETA is some random state failures with each builds. Update on reproducer: get branch eventually update the property
|
05837e2
to
b22f1d1
Compare
Signed-off-by: Olivier Lamy <[email protected]>
Signed-off-by: Olivier Lamy <[email protected]>
Signed-off-by: Olivier Lamy <[email protected]>
Signed-off-by: Olivier Lamy <[email protected]>
b22f1d1
to
f323e49
Compare
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.
Overall I think this is a good idea to make Arquillian more thread-safe. However, I do think it will be quite a task to do so.
this.interceptors = interceptors == null ? new ArrayList<ObserverMethod>() : interceptors; | ||
this.observers = observers == null ? new ArrayList<ObserverMethod>() : observers; | ||
if(interceptors!=null) { | ||
this.interceptors.addAll(interceptors); | ||
} | ||
if(observers!=null) { | ||
this.observers.addAll(observers); | ||
} |
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.
This should use the constructor instead of addAll()
to avoid lock.
@@ -59,7 +60,7 @@ public class TestContextHandler { | |||
|
|||
// Since there can be multiple AfterTestLifecycleEvents (After/AfterRules) | |||
// and we don't know which is the last one, perform the clean up in AfterClass. | |||
private Map<Class<?>, Set<Object>> activatedTestContexts = new HashMap<Class<?>, Set<Object>>(); | |||
private Map<Class<?>, Set<Object>> activatedTestContexts = new ConcurrentHashMap<>(); |
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.
This seems to already be guarded by itself. I don't think we need to change the type.
private void lookup(Method method, ResultCallback callback) { | ||
DeploymentTargetDescription deploymentTarget = locateDeployment(method); | ||
|
||
ContainerRegistry containerRegistry = this.containerRegistry.get(); | ||
DeploymentScenario deploymentScenario = this.deploymentScenario.get(); | ||
DeploymentScenario deploymentScenario = Objects.requireNonNull(this.deploymentScenario.get(), "deploymentScenario cannot be null"); |
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'm not sure what we gain here.
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.
not much I was using this as a marker as the main issue I have with parallel tests is the NPE here
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.
Ah okay. I would think then that there is likely an issue activating the context in a multi-threaded environment. That's typically when null
would be returned there. IIRC the context is a ThreadLocal
map of some sort.
@@ -32,7 +34,7 @@ public class DeploymentScenario { | |||
private final List<Deployment> deployments; | |||
|
|||
public DeploymentScenario() { | |||
this.deployments = new ArrayList<Deployment>(); | |||
this.deployments = new CopyOnWriteArrayList<>(); |
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.
More is likely needed here to really be thread-safe. Especially in the findDefaultDeployment
method.
Yup I agree :) |
Short description of what this resolves:
Changes proposed in this pull request:
Fixes #