Uploaded image for project: 'OptaPlanner'
  1. OptaPlanner
  2. PLANNER-2504

Can't solve because solution cloning silently fails

    XMLWordPrintable

Details

    • 2021 Week 31-33 (from Aug 2)
    • Undefined
    • NEW
    • NEW

    Description

      This is a regression and a blocking issue for OptaWeb Employee Rostering. It is caused by a seemingly unrelated change in OptaPlanner.

      To reproduce, simply run employee rostering, go to the Scheduling tab and click Schedule. Solving immediately fails (silently) and the back end state returns to TERMINATED. The front end reflects that on the next poll, hides Terminate Early and shows Schedule button again.

      Why is the failure silent? Because the root cause is an Error but DefaultSolverJob only catches Exceptions. If it caught Throwable we would see this in the log:

      2021-08-04 21:59:44,997 ERROR [org.opt.cor.imp.sol.DefaultSolverManager] (pool-12-thread-1) Solving failed for problemId (1).: java.lang.IllegalAccessError: Update to non-static final field org.optaweb.employeerostering.domain.shift.Shift.lengthInMinutes attempted from a different method ($set$optaplanner$__field$__lengthInMinutes) than the initializer method <init> 
      	at org.optaweb.employeerostering.domain.shift.Shift.$set$optaplanner$__field$__lengthInMinutes(Shift.java)
      	at org.optaweb.employeerostering.domain.roster.Roster$OptaPlanner$SolutionCloner.$cloneorg_optaweb_employeerostering_domain_shift_Shift(Roster$OptaPlanner$SolutionCloner.zig:430)
      	at org.optaweb.employeerostering.domain.roster.Roster$OptaPlanner$SolutionCloner.cloneSolutionRun(Roster$OptaPlanner$SolutionCloner.zig:273)
      	at org.optaweb.employeerostering.domain.roster.Roster$OptaPlanner$SolutionCloner.cloneSolution(Roster$OptaPlanner$SolutionCloner.zig:40)
      	at org.optaplanner.core.impl.score.director.AbstractScoreDirector.cloneSolution(AbstractScoreDirector.java:257)
      	at org.optaplanner.core.impl.solver.scope.SolverScope.setWorkingSolutionFromBestSolution(SolverScope.java:215)
      	at org.optaplanner.core.impl.solver.AbstractSolver.solvingStarted(AbstractSolver.java:80)
      	at org.optaplanner.core.impl.solver.DefaultSolver.solvingStarted(DefaultSolver.java:200)
      	at org.optaplanner.core.impl.solver.DefaultSolver.solve(DefaultSolver.java:174)
      	at org.optaplanner.core.impl.solver.DefaultSolverJob.call(DefaultSolverJob.java:101)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
      	at java.base/java.lang.Thread.run(Thread.java:831)
      

      Note that this only happens with GIZMO domain access type. It fails to write a non-static final field. An obvious workaround is to make lengthInMinutes field non-final. But keep in mind it used to work even with the final field before something changed in OptaPlanner.

      Now the most interesting part of the issue. The culprit is KOGITO-5413 Upgrade minimum Java release to 11.

      Attachments

        Activity

          People

            cchianel Christopher Chianelli
            jlocker Jiří Locker
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: