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

Race condition: solution.getScore() is still uninitialized in very short run

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • 7.33.0.Final
    • None
    • None
    • None
    • NEW
    • NEW

      16:56:18.256  INFO [main           ] Started TimeTableControllerTest in 4.92 seconds (JVM running for 5.696)
      16:56:18.669  INFO [pool-1-thread-1] Solving started: time spent (75), best score (-38init/0hard/0soft), environment mode (REPRODUCIBLE), random (JDK with seed 0).
      16:56:18.888  INFO [pool-1-thread-1] Construction Heuristic phase (0) ended: time spent (294), best score (0hard/-2soft), score calculation speed (2631/sec), step total (19).
      16:56:18.890  INFO [pool-1-thread-1] Solving ended: time spent (296), best score (0hard/-2soft), score calculation speed (1932/sec), phase total (2), environment mode (REPRODUCIBLE).
      >>>>>>>>>>> timeTable.getScore() is -38init/0hard/0soft
      [ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 5.911 s <<< FAILURE! - in com.example.solver.TimeTableControllerTest
      [ERROR] solveDemoDataUntilFeasible  Time elapsed: 0.388 s  <<< FAILURE!
      org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
              at com.example.solver.TimeTableControllerTest.solveDemoDataUntilFeasible(TimeTableControllerTest.java:33)
      
      

      Solving ended: time spent (296), best score (0hard/-2soft), ...
      >>>>>>>>>>> timeTable.getScore() is -38init/0hard/0soft

      It doesn't happen every time, run this on the spring boot "complete" example:

      good=0; bad=0; for i in {1..10}; do mvn test; if [ $? -eq 0 ]; then ((good++)); else ((bad++)); fi; done; echo "====="; echo "Results: $good good, $bad bad"
      

      Caused by SpringBoot's calling getSolverStatus() after loading the data from the dataset. In a race condition the solver terminates right in the middle of that.

              gdesmet@redhat.com Geoffrey De Smet (Inactive)
              gdesmet@redhat.com Geoffrey De Smet (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: