fix(core): prevent batch executor error on prematurely completed tasks#35015
Merged
FrozenPandaz merged 1 commit intoMar 25, 2026
Conversation
✅ Deploy Preview for nx-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
❌ Deploy Preview for nx-docs failed. Why did it fail? →
|
Contributor
|
View your CI Pipeline Execution ↗ for commit ce6b363
☁️ Nx Cloud last updated this comment at |
8374438 to
e5cfb7c
Compare
When a task is completed before its dependents are scheduled, processTaskForBatches would crash trying to read dependencies for a task already removed from notScheduledTaskGraph. Clean up reverseTaskDeps in complete() so batch traversal never reaches completed tasks.
e5cfb7c to
ce6b363
Compare
FrozenPandaz
approved these changes
Mar 25, 2026
FrozenPandaz
pushed a commit
that referenced
this pull request
Mar 26, 2026
#35015) ## Current Behavior When a task is prematurely completed (e.g., due to a failure that causes early termination) before its dependents have been scheduled, calling `scheduleNextTasks` crashes the batch executor. The crash occurs in `processTaskForBatches`, which traverses reverse dependencies and attempts to read `notScheduledTaskGraph.dependencies[task.id]` for a task that was already removed from `notScheduledTaskGraph` via `complete()`. This yields `undefined` for the dependencies array, causing downstream code to throw. ## Expected Behavior When a task has been prematurely completed before batch scheduling runs, `processTaskForBatches` should skip that task gracefully rather than crashing. Tasks that were removed from `notScheduledTaskGraph` early should be detected and skipped during batch traversal. ## Related Issue(s) Fixes NXC-4144 (cherry picked from commit f003f56)
Contributor
|
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Current Behavior
When a task is prematurely completed (e.g., due to a failure that causes early termination) before its dependents have been scheduled, calling
scheduleNextTaskscrashes the batch executor. The crash occurs inprocessTaskForBatches, which traverses reverse dependencies and attempts to readnotScheduledTaskGraph.dependencies[task.id]for a task that was already removed fromnotScheduledTaskGraphviacomplete(). This yieldsundefinedfor the dependencies array, causing downstream code to throw.Expected Behavior
When a task has been prematurely completed before batch scheduling runs,
processTaskForBatchesshould skip that task gracefully rather than crashing. Tasks that were removed fromnotScheduledTaskGraphearly should be detected and skipped during batch traversal.Related Issue(s)
Fixes NXC-4144