glassfish
  1. glassfish
  2. GLASSFISH-18475

Automatic timer defined in DD on ejbTimeout is not processed correctly and leads to NPE in timer expiry delivery

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.1_b12
    • Fix Version/s: 4.0_b33
    • Component/s: ejb_container
    • Labels:
      None
    • Environment:

      Microsoft Windows XP 32bit SP3, Oracle JDK 1.6.0_23

      Description

      Suppose we have an EJB component implementing javax.ejb.TimedObject, for which we define an automatically created timer in deployment descriptor. When application is deployed and running, we create another timer for the same EJB programmatically. The first expiry of the new timer leads to the following NPE:

      [#|2012-03-06T15:26:00.961+0300|WARNING|glassfish3.1.1|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=17;_ThreadName=Thread-2;|A system exception occurred during an invocation on EJB TesterEJB method null
      java.lang.NullPointerException
      at com.sun.ejb.containers.BaseContainer.prepareEjbTimeoutParams(BaseContainer.java:4090)
      at com.sun.ejb.containers.BaseContainer.callEJBTimeout(BaseContainer.java:4022)
      at com.sun.ejb.containers.EJBTimerService.deliverTimeout(EJBTimerService.java:1832)
      at com.sun.ejb.containers.EJBTimerService.access$100(EJBTimerService.java:108)
      at com.sun.ejb.containers.EJBTimerService$TaskExpiredWork.run(EJBTimerService.java:2727)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)

      From the source it is clear that ejbTimerMethod field of BaseContainer is not initialized. This is due to invalid deployment algorithm. EjbDescriptor instance returns true, if isTimedObject() method is called, but it has timedObjectMethod field not initialized. The bug is likely to be in com.sun.enterprise.deployment.util.EjbBundleValidator, method accept(EjbDescriptor ejb), line 232. In this line EjbDescriptor.isTimedObject() returns true because of schedule collection and it's ejbTimerMethod remains null.

      If we remove automatically created timer, than everything works fine.

        Activity

        Hide
        Hong Zhang added a comment -

        assign to ejb team for initial evaluation

        Show
        Hong Zhang added a comment - assign to ejb team for initial evaluation
        Hide
        marina vatkina added a comment -

        Can you try 3.1.2? It seems to be working correctly on this release. If it still fails, please attach a test case.

        Show
        marina vatkina added a comment - Can you try 3.1.2? It seems to be working correctly on this release. If it still fails, please attach a test case.
        Hide
        alexeiakimov added a comment -

        Yes, it fails with 3.1.2 release. The test case is attached.

        Show
        alexeiakimov added a comment - Yes, it fails with 3.1.2 release. The test case is attached.
        Hide
        alexeiakimov added a comment -

        Test application to reproduce the bug with 3.1.2 release.

        Show
        alexeiakimov added a comment - Test application to reproduce the bug with 3.1.2 release.
        Hide
        marina vatkina added a comment -

        Fixed on trunk with rev 53559.

        Show
        marina vatkina added a comment - Fixed on trunk with rev 53559.

          People

          • Assignee:
            marina vatkina
            Reporter:
            alexeiakimov
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: