[arquillian-issues] [JBoss JIRA] (ARQ-2166) IllegalArgumentException when accessing @Inject-ed instances from a different thread

Radoslav Husar (JIRA) issues at jboss.org
Tue Dec 12 11:29:00 EST 2017


     [ https://issues.jboss.org/browse/ARQ-2166?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Radoslav Husar updated ARQ-2166:
--------------------------------
    Description: 
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:

{noformat}
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)
{noformat}

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

{noformat}
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)
{noformat}

  was:
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.

This is because ARQ is using ThreadLocal for storing the context. An example call stack would be the following:

{noformat}
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)
{noformat}

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

{noformat}
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)
{noformat}



> IllegalArgumentException when accessing @Inject-ed instances from a different thread
> ------------------------------------------------------------------------------------
>
>                 Key: ARQ-2166
>                 URL: https://issues.jboss.org/browse/ARQ-2166
>             Project: Arquillian
>          Issue Type: Task
>          Components: Base Implementation
>    Affects Versions: 1.1.15.Final
>            Reporter: Radoslav Husar
>
> 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:
> {noformat}
> 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)
> {noformat}
> and example stack trace, trying to use container controller from a different thread would be:
> {noformat}
> 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)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the arquillian-issues mailing list