2 Replies Latest reply on Jan 9, 2019 7:45 AM by munzi82

    WildFly 14 - Problems with RequestScope in MDB

    munzi82

      Hi all,

       

      We have an application where some MDBs are running.

       

      From time to time we run into the following problem when executing tests (the application is not yet in production so I cannot say if these problems also occur in the "real" application):

       

      2019-01-07 15:40:43,949 ERROR [org.jboss.as.ejb3.invocation] (Thread-8 (ActiveMQ-client-global-threads)) WFLYEJB0034: EJB Invocation failed on component PlanningContextDeletedSubscriber for method public void 
      com.fntsoftware.lib.platform.boundary.MSIBaseSubscriber.onMessage(javax.jms.Message): java.util.ConcurrentModificationException
      at java.base/java.util.HashMap$HashIterator.nextNode(HashMap.java:1498)
      at java.base/java.util.HashMap$KeyIterator.next(HashMap.java:1521)
      at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.contexts.AbstractContext.destroy(AbstractContext.java:152)
      at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.contexts.AbstractManagedContext.deactivate(AbstractManagedContext.java:59)
      at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.contexts.AbstractBoundContext.deactivate(AbstractBoundContext.java:73)
      at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.module.ejb.context.EjbRequestContextImpl.deactivate(EjbRequestContextImpl.java:50)
      at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.module.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:85)
      at org.jboss.as.weld.common@14.0.1.Final//org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:89)
      ...

       

      I created a listener for the RequestScoped events and this is the output for the request above:

       

      2019-01-07 15:40:43,875 SEVERE [com.fntsoftware.cmdnxg.orders.order.Listener] (Thread-8 (ActiveMQ-client-global-threads)) Request context initialized for EJB invocation
      2019-01-07 15:40:43,904 SEVERE [com.fntsoftware.cmdnxg.orders.order.Listener] (Thread-8 (ActiveMQ-client-global-threads)) Request context is about to be destroyed after EJB invocation
      2019-01-07 15:40:43,947 SEVERE [com.fntsoftware.cmdnxg.orders.order.Listener] (Thread-8 (ActiveMQ-client-global-threads)) Request context destroyed after EJB invocation

       

      But after the exception above the code in AbstractEJBRequestScopeActivationInterceptor always handles the case that the context is active although it is a new request (re-delivery of JMS message). And then it crashes with a NullPointerException in the RequestScoped beans.

       

      The strange part is that it depends on the version number of our application e.g. with version 1.16.0 there is no problem. With 1.17.0 all tests fail with these problems.

       

      Unfortunately I can't provide a running application to reproduce this problem.

       

      Any ideas what can cause these problems!? Or maybe some things I can do to narrow the real problem?

       

      Thanks in advance,

       

      Daniel

        • 1. Re: WildFly 14 - Problems with RequestScope in MDB
          jaikiran
          1. java.util.ConcurrentModificationException 
          2. at java.base/java.util.HashMap$HashIterator.nextNode(HashMap.java:1498) 
          3. at java.base/java.util.HashMap$KeyIterator.next(HashMap.java:1521) 
          4. at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.contexts.AbstractContext.destroy(AbstractContext.java:152) 
          5. at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.contexts.AbstractManagedContext.deactivate(AbstractManagedContext.java:59) 
          6. at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.contexts.AbstractBoundContext.deactivate(AbstractBoundContext.java:73) 
          7. at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.module.ejb.context.EjbRequestContextImpl.deactivate(EjbRequestContextImpl.java:50) 
          8. at org.jboss.weld.core@3.0.5.Final//org.jboss.weld.module.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:85) 
          9. at org.jboss.as.weld.common@14.0.1.Final//org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:89)

           

          That's likely a bug in Weld. Could you open a JIRA here - JBoss Issue Tracker  and provide necessary details and point to this thread? Someone more knowledgable about Weld might be able to help.

          • 2. Re: WildFly 14 - Problems with RequestScope in MDB
            munzi82

            Thanks.

             

            I was finally able to reproduce it and created a simple project for reproducing it.

             

            Created bug

            [WELD-2555] ConcurrentModificationException while destroying context - JBoss Issue Tracker