Skip to content

Fixes hangs and leaks when cancelling jobs - #367

Merged
ArquintL merged 1 commit into
stoppable-verification-serverfrom
interrupt-jobs-2-lifecycle-fixes
Oct 30, 2026
Merged

ArquintL merged 1 commit into
stoppable-verification-serverfrom
interrupt-jobs-2-lifecycle-fixes

Conversation

@ArquintL

@ArquintL ArquintL commented Oct 8, 2026

Copy link
Copy Markdown
Member

Stacked on #357, which should be merged first.

Fixes three problems with cancelled jobs. The first two also affect the existing stop paths of the LSP frontend and the HTTP API.

  • Hang when cancelling a task that has not started yet: such a task never completes its message queue. Hence, the job's message stream never completes and the job's slot is never freed. The JobActor now completes the queue on the task's behalf. MessageStreamingTask.cancelledBeforeStart distinguishes such a task from one that is cancelled while running, which a FutureTask alone cannot.
  • Slot leak when cancelling an AST construction: the dependent verification job's handle fails with a CancellationException, which initializeProcess did not handle. That job's slot leaked.
  • Leaked actors of AST jobs: job actors were stopped on queue completion only for verification jobs. Now, every job's actor is stopped when the job's queue completes. As a result, the manual PoisonPills in the LSP frontend and the HTTP discard route are gone, and discardAstJobLookup is replaced by the now public discardAstJob.

TaskInterruptionTests covers the first fix.

🤖 Generated with Claude Code

Copilot AI balanced review requested due to automatic review settings October 8, 2026 09:31

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

- A task that is cancelled before it starts never completes its message
  queue. Hence, the job's message stream never completes and the job's slot
  is never freed. The JobActor now completes the queue on the task's behalf;
  `MessageStreamingTask.cancelledBeforeStart` reliably distinguishes such a
  task from one that is cancelled while it is running.
- Cancelling an AST construction fails the dependent verification job's
  handle with a `CancellationException`, which `initializeProcess` did not
  handle, leaking the verification job's slot.
- A job's actor is now stopped whenever the job's message queue completes,
  not only for verification jobs. This fixes leaking the actors of AST jobs
  and removes the need for frontends to stop job actors themselves: the
  manual `PoisonPill`s in the LSP frontend and the HTTP discard route are
  gone, and `discardAstJobLookup` is replaced by the now public
  `discardAstJob`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@rayman2000
rayman2000 force-pushed the interrupt-jobs-2-lifecycle-fixes branch from d400fdc to cd5ef66 Compare October 30, 2026 11:14
@ArquintL
ArquintL enabled stacked auto-merge October 30, 2026 11:19
@ArquintL
ArquintL added this pull request to the merge queue Oct 30, 2026
Merged via the queue into master with commit 2df0d23 Oct 30, 2026
13 checks passed
@ArquintL
ArquintL deleted the interrupt-jobs-2-lifecycle-fixes branch October 30, 2026 11:40
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