SolverWorker can overwrite SOLVING_COMPLETED with SOLVING_ACTIVE when a best-solution save races the completion
Maintainers usually reply within 1 day
@rsynek is already working on this.
Since Oct 6, 2026.
Assessment
This issue has not been assessed yet.
Description
Describe the bug
SolverWorker can lose the final status of a run. A throttled best-solution save (notifyOnSave) that passes its
checks just before the run completes still writes SOLVING_ACTIVE after notifyOnComplete stored
SOLVING_COMPLETED. The run then stays SOLVING_ACTIVE forever, although solving finished.
This happened in CI on #2729: in the Pickup and Delivery Routing downstream build,
DriverRoutePlanResourcePinningTest.replanningWithPinnedShiftAndFreezeTime timed out after 5 minutes waiting for the run
to finish. The log shows the solve ended after 1 s ("Completed solving schedule" at 09:23:06.415), but the status stayed
SOLVING_ACTIVE until the test gave up ("Timed out waiting for run ...: status 'SOLVING_ACTIVE'"). The solve took
1,002 ms and the best-solution throttle is 1 s, so the last throttled save and the completion ran at the same time.
Expected behavior
Once notifyOnComplete stored SOLVING_COMPLETED, no later best-solution save changes the status of the run.
Actual behavior
notifyOnSave checks solverJobs.get(id) != null and that the stored status is SOLVING_ACTIVE, then converts the model
output, sets SOLVING_ACTIVE on the metadata and stores it. notifyOnComplete removes the job from solverJobs and stores
SOLVING_COMPLETED. Nothing makes the check and the write of the save atomic with respect to the completion, so when the
save is between its check and its write while the completion runs, the save overwrites the completed status.
To Reproduce
Reproducer test (one file, fails on main 9de70fcf every time):
https://github.com/larsbeck/timefold-solver/blob/repro-solver-worker-status-race/service/worker/src/test/java/ai/timefold/solver/service/worker/impl/SolverWorkerSaveCompleteRaceTest.java
(branch repro-solver-worker-status-race, commit
https://github.com/larsbeck/timefold-solver/commit/af686fdf)
cd service/worker
mvn test -Dtest=SolverWorkerSaveCompleteRaceTest
The test stores an active run, registers its solver job, and starts notifyOnSave on another thread. It holds that save
in its model output conversion (like a slow conversion of a large plan), runs notifyOnComplete, checks that the status
is SOLVING_COMPLETED, then releases the save. Result:
expected: SOLVING_COMPLETED
but was: SOLVING_ACTIVE
Environment
Timefold Solver Version or Git ref: main, 9de70fcf
Output of java -version: openjdk version "25.0.2" 2026-01-20 LTS
Output of uname -a or ver: Darwin 25.6.0 arm64 (macOS); CI failure on ubuntu-latest
Additional information
A possible fix: make the save path skip its write when the run completed in the meantime, for example by serializing
notifyOnSave and notifyOnComplete per run id, or by re-checking solverJobs and the stored status under a per-run
lock right before the write.
- Dominant language
- Java
- Stars
- 1.8k
- Forks
- 238
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 55
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from TimefoldAI/timefold-solver
-
component/docs
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
TimefoldAI/timefold-solver#2671 ·
Maintainers usually reply within 1 day
-
process/needs triage
Difficulty 5/5 Over a week Newbie friendliness 12/100
TimefoldAI/timefold-solver#2763 · 2 comments ·
Maintainers usually reply within 1 day
-
Docs: Add keywords for search.Possibly taken @TomCools claimed this 3 days ago. Opencomponent/docs
TimefoldAI/timefold-solver#2762 · 1 assignee ·
Maintainers usually reply within 1 day
-
Swap move selector applies entity value range filtering to entity classes without entity-level rangesPossibly taken @zepfred claimed this 4 days ago. Openprocess/needs triage
TimefoldAI/timefold-solver#2761 · 1 assignee ·
Maintainers usually reply within 1 day
-
SDK: Waypoints class has not OpenAPI Spec annotations.Possibly taken @TomCools claimed this 4 days ago. Opencomponent/service
TimefoldAI/timefold-solver#2759 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in TimefoldAI/timefold-solver
Similar issues
-
[Bug] dubbo.protocol.triple.max-message-size is only read from OS environment variablesPossibly taken @CCCLL claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
hierynomus/sshj#1070 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
intellij-elixir/intellij-elixir#4492 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
quarkiverse/quarkus-openapi-generator#1796 · 1 comment ·