Skip to content

Fix bugs in progress reporting - #243

Merged
JonatanWaern merged 7 commits into
mainfrom
progress-fixes
Oct 26, 2026
Merged

JonatanWaern merged 7 commits into
mainfrom
progress-fixes

Conversation

@JonatanWaern

Copy link
Copy Markdown
Contributor

Originally discovered and worked on in the scip-branch over at #239, see that PR for discussion

  • Track in-flight analysis jobs per dispatch, not per hash
  • Report device analysis before notifying it is done
  • Wake the server loop when an analysis job exits
  • Test that a job stays in flight when an older one exits
  • Refactor job.process to return the value to notify
  • Fixup tests a bit

@TSonono TSonono left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works in my testing, good job

fenghaitao and others added 7 commits October 26, 2026 10:14
The in-flight trackers were keyed by job hash, which is the same for
every job on the same file. When a newer job for a file was dispatched
while an older, cancelled one was still running, both shared one entry,
and whichever finished first removed it. has_work() then reported no
work while the newer job still ran, so the server ended its analysis
progress early.

dml-builtins.dml is hit by this on every device: each analysed import
re-requests it, cancelling the running job. dfa exported on the early
progress end and failed with "No device analyses found", because
builtins, its imports, and so the device analysis had not been done.

Key the trackers by an id assigned when the job is dispatched, and
look up in-flight device jobs by hash among the values.

Signed-off-by: Jonatan Waern<jonatan.waern@intel.com>
DeviceAnalysisJob sent DeviceAnalysisDone before sending the analysis
itself. The server's handler for it updates the stored analyses, which
could then run before the analysis was in the channel, leaving it
unstored until some later update. An export right after the analysis
progress ended could then find no device analysis.

Send the analysis first, as isolated analysis jobs already do.

Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
The server ends its analysis progress at the top of its loop, once no
message is pending and the queue has no work. Analysis jobs sent their
done message before leaving the in-flight tracker, and cancelled jobs
sent nothing at all. If the loop handled the last done message before
the job left the tracker, or the last job to exit was a cancelled one,
the loop blocked waiting for a message with the progress still open,
and dfa waited for its end forever.

Send a message once a job has left the tracker, so that the loop
re-checks for remaining work, and re-check state waits on it.

Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Two isolated analysis jobs on the same file are in flight at once. Each
reports on its own rendezvous channel, so it blocks until the test
receives from it, and the test decides the order in which they exit.
Once the older job has exited, the queue must still report the newer
one as in-flight work, and each exit must be signalled with
AnalysisJobExited.

With the trackers keyed by job hash, the older job's exit removes the
newer job's entry and has_isolated_work() turns false. Without the exit
message the test gets none from the older job.

Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
The jobs use it for nothing else, and this ensures we always notify _something_
regardless of how a job exits

Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
@JonatanWaern
JonatanWaern merged commit 2df5f31 into main Oct 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants