arquillian-core icon indicating copy to clipboard operation
arquillian-core copied to clipboard

[WIP] tck multithread failures

Open olamy opened this issue 10 months ago • 5 comments

  • investigate junit5 multi thread build failure Servlet TCK with Jetty
  • more thread safe collections
  • not sure about those but some thread safe fields

Short description of what this resolves:

Changes proposed in this pull request:

Fixes #

olamy avatar Feb 04 '25 11:02 olamy

@olamy Can you link the reproducer?

rhusar avatar Feb 07 '25 17:02 rhusar

@olamy Can you link the reproducer?

sure have a look here https://github.com/jetty-project/servlet-tck-run/ use branch jetty-12-ee11-parallel-test

mvn clean verify you may have a lot of download of snapshots, you will have to change the arquillian-core version in the pom. (it's using the version of this PR for testing purpose)

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

java.lang.NullPointerException: deploymentScenario cannot be null
	at java.base/java.util.Objects.requireNonNull(Objects.java:235)
	at org.jboss.arquillian.container.test.impl.client.ContainerEventController.lookup(ContainerEventController.java:147)
	at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:133)
	at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createBeforeContext(ContainerEventController.java:117)

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 jetty-12-1-ee11 from https://github.com/jetty-project/servlet-tck-run.git You will need to build locally branch jetty-12.1-fix-deployer from https://github.com/arquillian/arquillian-container-jetty

eventually update the property <arquillian.core.version>1.9.5.Final-SNAPSHOT</arquillian.core.version><arquillian.core.version>1.9.5.Final-SNAPSHOT</arquillian.core.version> from the sevlet-tck-run project

mvn clean verify -Djunit.jupiter.execution.parallel.enabled=true

olamy avatar Feb 08 '25 09:02 olamy

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.

Yup I agree :) I don't have a deep knowledge of the internal of core so I have just started small steps at least there is an easy way to reproduce the problem.

olamy avatar Apr 17 '25 08:04 olamy

The core layer with its single thread event dispatch is inherently not threadsafe. The same for the container layer. We will have to target this in the 2.0 release when we look at how the runners introduce parallel tests in the lifecycle and move away from the event dispatch approach.

starksm64 avatar Jun 05 '25 06:06 starksm64

oh yup sure. Sorry I didn't reallly look deeply into it but definitely sounds like more big changes to ArrayList to CopyOnWriteArrayList

olamy avatar Jun 06 '25 05:06 olamy