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

JobPoller does not run and hence scheduled/async jobs are never run

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 16.11.01
    • Fix Version/s: Upcoming Release, 16.11.02
    • Component/s: base
    • Labels:
      None
    • Flags:
      Patch

      Description

      Symptom:

      • services that are invoked with "dispatcher.runAsync" seem to stay "pending" in the job-list and never get executed
      • scheduled jobs don't get executed

      Steps to Reproduce

      • Login to /webtools
      • Schedule a Job to run in 5 mins, (for example service "clearAllEntityCaches")
      • Wait 7mins

      Expected:

      • the scheduled service "clearAllEntityCaches" is not "pending" anymore but should have status "finished"

      Actual:

      • scheduled service "clearAllEntityCaches" is still "pending"

      Analysis:
      The problem can be reproduced with the OFBiz 16.11-trunk as well as with the OFBiz 16.11.01 zip file version.

      JobPoller does get started on OFBiz start but does get stuck on line:
      org.apache.ofbiz.service.job.JobPoller.java: 213-215

      The reason is that the "Start.ServerState" never reaches "RUNNING"

      Doing a full-text scan through the whole source code shows, that there is no code at all that sets the ServerState to "RUNNING"

      Comparing it to the 15.11-branch. There used to be a line:
      serverState.compareAndSet(ServerState.STARTING, ServerState.RUNNING)

      no such line exists in 16.11 anymore.

      I'm not a OFBiz core developer but only develop modules.
      I attached a patch, that makes it work, but not sure if that's the best way to solve the problem.

      ./framework/start/src/main/java/org/apache/ofbiz/base/start/StartupControlPanel.java

      line 254: add "serverState.compareAndSet(ServerState.STARTING, ServerState.RUNNING);"

        Activity

        Hide
        leonardlin Leonard Lin added a comment -

        patch that makes it work, but not sure if it's the best place to put it.

        Show
        leonardlin Leonard Lin added a comment - patch that makes it work, but not sure if it's the best place to put it.
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        Thanks Leonard,

        I confirm the behaviour in R16 branch as well as in trunk.

        For the trunk I created a "test" job instance with the clearAllEntityCaches service on the official demo and it's still waiting after the starting time passed.

        Your patch is a good solution and works for the R16 branch which is less changed than the trunk when compared to R15. The same applies to the trunk with the relative block of code which contains

        if (serverState.get() == ServerState.STOPPING) {
        

        The line you propose to add was obviously missed during the recent refactoring.

        I will commit soon

        Show
        jacques.le.roux Jacques Le Roux added a comment - Thanks Leonard, I confirm the behaviour in R16 branch as well as in trunk. For the trunk I created a "test" job instance with the clearAllEntityCaches service on the official demo and it's still waiting after the starting time passed. Your patch is a good solution and works for the R16 branch which is less changed than the trunk when compared to R15. The same applies to the trunk with the relative block of code which contains if (serverState.get() == ServerState.STOPPING) { The line you propose to add was obviously missed during the recent refactoring. I will commit soon
        Hide
        jacques.le.roux Jacques Le Roux added a comment - - edited

        Thanks Leonard,

        Your solution is implemented with revision 1779596 and fixes both the R16 branch and the trunk.

        People using R16.11.01 should update to R16.11.02 as soon as available. In the meantime Leonard's solution should be applied.

        Show
        jacques.le.roux Jacques Le Roux added a comment - - edited Thanks Leonard, Your solution is implemented with revision 1779596 and fixes both the R16 branch and the trunk. People using R16.11.01 should update to R16.11.02 as soon as available. In the meantime Leonard's solution should be applied.
        Hide
        leonardlin Leonard Lin added a comment -

        Jacques Le Roux awesome! thank you.

        Show
        leonardlin Leonard Lin added a comment - Jacques Le Roux awesome! thank you.
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        Leonard, it seems you are not subscribed to the dev ML. Hence you messages there are moderated, please subscribe: http://ofbiz.apache.org/mailing-lists.html

        Show
        jacques.le.roux Jacques Le Roux added a comment - Leonard, it seems you are not subscribed to the dev ML. Hence you messages there are moderated, please subscribe: http://ofbiz.apache.org/mailing-lists.html

          People

          • Assignee:
            jacques.le.roux Jacques Le Roux
            Reporter:
            leonardlin Leonard Lin
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development