Uploaded image for project: 'Arquillian'
  1. Arquillian
  2. ARQ-2166

IllegalArgumentException when accessing @Inject-ed instances from a different thread

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 1.1.15.Final
    • Base Implementation
    • None

      The use case for using multiple threads is to for instance start containers or deployments concurrently, which could be employed to speed up a testsuites using multiple containers where the tests control their lifecycle using container controller.

      The root cause of the issue is that ARQ is using ThreadLocal for storing the context. An example call stack would be the following:

      org.jboss.arquillian.core.spi.context.AbstractContext#activeStore
      org.jboss.arquillian.core.impl.ManagerImpl#resolveActiveContexts
      org.jboss.arquillian.core.impl.ManagerImpl#resolve
      org.jboss.arquillian.core.impl.InstanceImpl#get
      org.jboss.arquillian.container.test.impl.client.container.ClientContainerController#start(java.lang.String)
      

      and example stack trace, trying to use container controller from a different thread would be:

      java.lang.IllegalArgumentException: No container registry in context
              at org.jboss.arquillian.container.test.impl.client.container.ClientContainerController.isStarted(ClientContainerController.java:216)
              at org.jboss.as.test.clustering.NodeUtil.start(NodeUtil.java:104)
              at org.jboss.as.test.clustering.NodeUtil.lambda$start$1(NodeUtil.java:85)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
              at java.util.concurrent.FutureTask.run(FutureTask.java:266)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
              at java.lang.Thread.run(Thread.java:748)
      

              Unassigned Unassigned
              rhn-engineering-rhusar Radoslav Husar
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: