Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-5710

Running OFBIZ with jsvc (Commons Daemon) Breaks JobPoller

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Release Branch 13.07, Trunk
    • Fix Version/s: 14.12.01, 13.07.01
    • Component/s: framework
    • Labels:

      Description

      Symptoms

      All jobs in JobSandbox are stuck in SERVICE_PENDING even though they should be run.

      Root Cause

      org.ofbiz.base.start.Start implements a Singleton pattern but Commons Daemon breaks the singleton contract by instantiating it through reflection. This means that there are 2 instances of Start in a running application using jsvc

      When running a heap dump of an OFBiz server running with jsvc; I noticed two instances of Start are present: #1 (which was created by DaemonLoader) and #2 (created during static init)

      From the attached screenshots, you can see that the static instance variable points to #2 instead of #1.

      Daemon Start

      Static Start

      This is a problem because #1 actually contains the correct application state, but anyone using Start.getInstance() will get #2 which has not been initialized.

      At least one service suffering from this is the JobPoller which has a few lines in the polling code:

      while (Start.getInstance().getCurrentState() != Start.ServerState.RUNNING) {
        Thread.sleep(1000);
      }
      

      Which will never be able to exit - thus all scheduled jobs will never be run.

      I noticed this in 13.07 but it could affect other versions - I have not checked them.

        Attachments

        1. R13_Start.java.patch
          3 kB
          Adrian Crum
        2. daemon-start.png
          134 kB
          Justen Walker
        3. static-start.png
          123 kB
          Justen Walker

          Activity

            People

            • Assignee:
              adrianc@hlmksw.com Adrian Crum
              Reporter:
              justen_walker Justen Walker
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: