[wildfly-dev] ConcurrentAccessTimeoutException using producer in stateful bean

arjan tijms arjan.tijms at gmail.com
Tue Aug 16 07:47:56 EDT 2016


Hi,

Sure, I've created one using the request scope now (to rule out any issues
with JSF's view scope).

package test;

import javax.ejb.Stateful;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Produces;

@Stateful
@RequestScoped
public class Bean1 {
@Produces
public String produceString() {
return "a string";
}

public void foo() {
}
}



package test;

import javax.ejb.Stateful;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;

@Stateful
@RequestScoped
public class Bean2 {

@Inject
private String string;
public void foo() {
}
}





package test;

import javax.ejb.Stateful;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;

@Stateful
@RequestScoped
public class Bean3 {
@Inject
private Bean1 bean1;
@Inject
private Bean2 bean2;
public void test() {
bean1.foo();
bean2.foo();
}

}



package test;

import java.io.IOException;

import javax.inject.Inject;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet(urlPatterns = "/test")
public class TestServlet extends HttpServlet {

private static final long serialVersionUID = 1L;

@Inject
private Bean3 bean3;

@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

response.getWriter().write("testing");

bean3.test();

}

}

Relevant part of the stack trace:

Caused by: javax.ejb.ConcurrentAccessTimeoutException: WFLYEJB0228: EJB 3.1
FR 4.3.14.1 concurrent access timeout on Bean1 - could not obtain lock
within 5000 MILLISECONDS
at
org.jboss.as.ejb3.component.stateful.StatefulSessionSynchronizationInterceptor.processInvocation(StatefulSessionSynchronizationInterceptor.java:86)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at
org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)
at
org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:64)
at
org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:83)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at
org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at
org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at
org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
at
org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:52)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at
org.jboss.as.ejb3.component.stateful.StatefulComponentInstanceInterceptor.processInvocation(StatefulComponentInstanceInterceptor.java:65)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at
org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:275)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:327)
at
org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at
org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at
org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at
org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at
org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at
org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:66)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at
org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at
org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at
org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
at
org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:636)
at
org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
at
org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at
org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:195)
at
org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:185)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at
org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
at
org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73)
at test.Bean1$$$view1.produceString(Unknown Source)


If needed I can later today put this in a Maven project as well, but the
above should be enough to get you started I hope.

Kind regards,
Arjan Tijms







On Tue, Aug 16, 2016 at 1:26 PM, Tomas Remes <tremes at redhat.com> wrote:

>
> Hi Arjan,
>
> Can you please share some reproducer app? It would be helpful.
>
> Thanks
> Tom
>
> ----- Original Message -----
> From: "arjan tijms" <arjan.tijms at gmail.com>
> To: "WildFly Dev" <wildfly-dev at lists.jboss.org>
> Sent: Tuesday, August 16, 2016 1:12:22 PM
> Subject: [wildfly-dev] ConcurrentAccessTimeoutException using producer
> in       stateful bean
>
> Hi,
>
> I came across a situation where a ConcurrentAccessTimeoutException is
> thrown on WildFly 10.0.0 and 10.1cr1 when an @Stateful @ViewScoped bean
> contains a CDI producer.
>
> In short, there are 3 beans all @Stateful @ViewScoped. Beans 1 and 2 are
> injected in bean 3.
>
> Bean 1 contains a CDI producer.
> Bean 2 is injected with a type from said producer.
>
> The following causes a ConcurrentAccessTimeoutException to be thrown:
>
> bean3.somemethod:
> tx start
> access stateful bean 1
> access stateful bean 2
> (from statefull bean 2): access injected type that causes producer from
> bean 1 to be called
> tx end
>
> If the call to stateful bean 1 is omitted, the producer is called normally
> when bean 2 accesses the injected type.
>
> If bean 2 is injected directly with bean 1, then bean 1 can be accessed
> without any ConcurrentAccessTimeoutException being thrown.
>
> The code runs fine on WildFly 8.2.
>
> I'll do some further digging, but wonder if this problem rings any bells.
> Could it be that CDI obtains a reference to the stateful bean in such a way
> that the implicit EJB interceptor doesn't see it's still within the same
> TX? But since there's no call to bean 1 in progress at that point, should
> this even matter?
>
> Kind regards,
> Arjan Tijms
>
> _______________________________________________
> wildfly-dev mailing list
> wildfly-dev at lists.jboss.org
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/wildfly-dev/attachments/20160816/8c32b950/attachment-0001.html 


More information about the wildfly-dev mailing list