Uploaded image for project: 'JBoss Enterprise Application Platform 6'
  1. JBoss Enterprise Application Platform 6
  2. JBPAPP6-1656

Invoking EJB2 stateful bean which is being destroyed leads to NullPointerException

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Migrated to another ITS
    • Affects Version/s: EAP 6.0.1 ER 3
    • Fix Version/s: TBD EAP 6
    • Component/s: EJB
    • Labels:
      None
    • Docs QE Status:
      NEW

      Description

      When a client invokes a EJB2 stateful session bean, which is being destroyed right at the same time, a race condition sometimes leads to a NullPointerException.

      The scenario when this error occurs:
      1. the bean is in a passivated state
      2. client invokes a method on it
      3. activation routine is run for the instance
      4. however, it seems that even during activation procedure, container sometimes still decides to expire and remove it
      5. this leads to a NullPointerException

      I set the bean's stateful timeout to 1 millisecond to increase the chance for this to happen.

      (client invoking a setter on the bean) 15:25:30,224 INFO  [org.jboss.as.test.clustering.extended.ejb2.stateful.passivation.StatefulBeanBase] (EJB default - 4) Setting number: 15
      (the bean gets passivated) 15:25:30,225 INFO  [org.jboss.as.test.clustering.extended.ejb2.stateful.passivation.StatefulBeanBase] (EJB default - 4) Passivating with number: 15 and was passivated by unknown, prePassivate method called 1 times
      (invoking a getter on the bean) 15:25:30,228 INFO  [org.jboss.as.test.clustering.extended.ejb2.stateful.passivation.StatefulPassivationExpirationTestCase] (main) Retrieving number for id=15
      (activation procedure running) 15:25:30,231 INFO  [org.jboss.as.test.clustering.extended.ejb2.stateful.passivation.StatefulBeanBase] (EJB default - 5) Activating with number: 15 and was passivated by unknown, postActivate method called 1 times
      (ejbRemove procedure running at the same time) 15:25:30,232 INFO  [org.jboss.as.test.clustering.extended.ejb2.stateful.passivation.StatefulBeanBase] (pool-10-thread-1) ejbRemove on instance id=15
      15:25:30,236 INFO  [org.jboss.as.ejb3] (EJB default - 5) JBAS014101: Failed to find SFSB instance with session ID {[-17, 39, 72, -2, 73, -99, 70, 67, -99, 78, 110, -45, -65, -53, -76, -94]} in cache
      15:25:30,236 ERROR [org.jboss.as.ejb3.invocation] (EJB default - 5) JBAS014134: EJB Invocation failed on component StatefulBean for method public abstract int org.jboss.as.test.clustering.extended.ejb2.stateful.passivation.StatefulRemote.getNumber() throws java.rmi.RemoteException: javax.ejb.EJBException: java.lang.NullPointerException
      

      Had the bean expired properly BEFORE the invocation, it would have thrown a NoSuchObjectException, which is ok according to spec.

      A reproducer is available at: https://github.com/jmartisk/jboss-as/tree/jbqa-6319-stateful-expiration , test=org.jboss.as.test.clustering.extended.ejb2.stateful.passivation.StatefulPassivationExpirationTestCase . The test is part of clustering testsuite, but I suppose this is not a clustering-specific error.

      (this is forked from upstream 7.2 branch, but you can run it against EAP 6.0.1, just edit testsuite/integration/clust/src/test/config/arq/arquillian.xml and change the port offset argument from jboss.port.offset to jboss.socket.binding.port-offset so the two EAPs will not clash).

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                jaikiran Jaikiran Pai
                Reporter:
                jmartisk Jan Martiska
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: