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

NurseRostering: barrage of addProblemFactChange causes IllegalStateException (regression)

XMLWordPrintable

    • 2023 Week 09-11 (from Feb 27)
    • 2
    • NEW
    • NEW

      To reproduce:

      • open optaplanner-examples, nurse rostering example
      • open dataset spring01.xml
      • click solve
      • while solving, click the red X icon repeatedly, quickly of the first nurse

      It's a regression because this fail-fast was introduced at some point (7.18 maybe) and it seems like there are cases where returning null is actually sensible.

      Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Solving failed.
      	at org.optaplanner.examples.common.swingui.SolverAndPersistenceFrame$SolveWorker.done(SolverAndPersistenceFrame.java:382)
      	at javax.swing.SwingWorker$5.run(SwingWorker.java:737)
      	at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:832)
      	at sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
      	at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(SwingWorker.java:842)
      	at javax.swing.Timer.fireActionPerformed(Timer.java:313)
      	at javax.swing.Timer$DoPostEvent.run(Timer.java:245)
      	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
      	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
      	at java.awt.EventQueue.access$500(EventQueue.java:97)
      	at java.awt.EventQueue$3.run(EventQueue.java:709)
      	at java.awt.EventQueue$3.run(EventQueue.java:703)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
      	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
      	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
      	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
      	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
      	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
      	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
      	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
      Caused by: java.lang.IllegalStateException: The externalObject (3) with planningId ((class org.optaplanner.examples.nurserostering.domain.Employee,3)) has no known workingObject (null).
      Maybe the workingObject was never added because the planning solution doesn't have a @ProblemFactCollectionProperty annotation on a member with instances of the externalObject's class (class org.optaplanner.examples.nurserostering.domain.Employee).
      	at org.optaplanner.core.impl.domain.lookup.PlanningIdLookUpStrategy.lookUpWorkingObject(PlanningIdLookUpStrategy.java:66)
      	at org.optaplanner.core.impl.domain.lookup.LookUpManager.lookUpWorkingObject(LookUpManager.java:75)
      	at org.optaplanner.core.impl.score.director.AbstractScoreDirector.lookUpWorkingObject(AbstractScoreDirector.java:509)
      	at org.optaplanner.examples.nurserostering.swingui.NurseRosteringPanel.lambda$deleteEmployee$1(NurseRosteringPanel.java:242)
      	at org.optaplanner.core.impl.solver.DefaultSolver.doProblemFactChange(DefaultSolver.java:265)
      	at org.optaplanner.core.impl.solver.DefaultSolver.checkProblemFactChanges(DefaultSolver.java:252)
      	at org.optaplanner.core.impl.solver.DefaultSolver.solve(DefaultSolver.java:193)
      	at org.optaplanner.examples.common.business.SolutionBusiness.solve(SolutionBusiness.java:334)
      	at org.optaplanner.examples.common.swingui.SolverAndPersistenceFrame$SolveWorker.doInBackground(SolverAndPersistenceFrame.java:370)
      	at javax.swing.SwingWorker$1.call(SwingWorker.java:295)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at javax.swing.SwingWorker.run(SwingWorker.java:334)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      

              lpetrovi@redhat.com Lukáš Petrovický (Inactive)
              gdesmet@redhat.com Geoffrey De Smet (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: