Repository navigation
feat(sip-app): queue WorkModel jobs per dataset and lane - #534
Merged
Merged
Conversation
Jobs for one dataset now run one at a time per lane. EDIT holds every job that mutates or reads the live mapping and models, including the SILENT selection jobs, which are keyed on the open dataset. BATCH holds PROCESS, LOAD_REPORT and the link and stats jobs, which snapshot their inputs at start, so a selection never waits for a running validation. Contexts live in a ConcurrentHashMap keyed by (dataset, lane) with atomic merge-or-create; the old dataSetPrefix merge never matched, so prefix-scoped jobs always ran concurrently. The background loop is the sole driver and the Swing timer only snapshots. Revert Mapping is one job that rewrites the file and reloads in order. createMapping asks for a constant value on the EDT before queueing the job that adds the mapping; cancelling the question now cancels creation. See docs/decisions/0001-edt-ownership-and-per-dataset-job-serialization.md and docs/plans/2026-09-08-sip-app-threading-hardening.md, Step 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 1 of the sip-app threading hardening plan. Decision:
docs/decisions/0001-edt-ownership-and-per-dataset-job-serialization.md(Proposed, flip to Accepted on merge). Plan:docs/plans/2026-09-08-sip-app-threading-hardening.md.Why
WorkModel.dataSetPrefixnever merged jobs (it comparedcontextPrefix.equals(null)), soPROCESS,SAVE_MAPPING,COMPILE_*,RELOAD_MAPPING,REVERT_MAPPINGandLOAD_REPORTalways ran concurrently, even for the same dataset.SILENTjobs bypassed queueing entirely, and two drivers (background loop and Swing timer) both popped the same queues. This is the root of the race conditions behind several recent Sentry crashes.What
Work.Lane:EDIT,BATCH,NETWORK,NONE, derived fromJob. Eight long-running jobs (PROCESS,LOAD_REPORT, link and stats jobs,DELETE_CACHES) areBATCH; they snapshot their inputs at start. Everything else that touches the open dataset isEDIT, including the 24 dataset-touchingSILENTjobs, keyed on the open dataset via aSupplier<DataSet>.WorkModel: contexts keyed by (dataset, lane) in aConcurrentHashMap, atomic merge-or-create, background loop as sole driver, timer only snapshots,volatileprogress and context fields, busy guard forLongTermWorkmoved ahead of the map lock (it alerts via a modal dialog).RevertMappingMenu: one job that rewrites the mapping file and reloads in order, instead ofsetRecMappingfollowed by a secondSET_DATASETchain.CreateModel.createMapping: asks for a constant value on the EDT before queueing the job that adds the mapping. Behaviour change: cancelling the free-text question now cancels creation (before: mapping created with null code).Tests
WorkModelTest(6, latch-based): lane per job, EDIT/EDIT sequential, EDIT/BATCH concurrent, secondPROCESSrefused, SILENT queued behind EDIT, SILENT without open dataset runs immediately.mvn test -pl sip-app: 45 green.mvn test -pl sip-core: 157 green.Verify by hand
SET_DATASETqueued in the work panel.