Fix bug in scheduler with Job dependency leakage#369
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a scheduler bug where dependency discovery for multiple pending jobs could “leak” dependencies from earlier jobs into later jobs, incorrectly blocking and/or failing unrelated jobs when a dependency update fails.
Changes:
- Scope
dependent_jobslinking to per-task dependencies (job_deps) instead of a running cumulative list. - Add a functional regression test to ensure dependency generation remains isolated per job when multiple jobs are pending.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
awx/main/tests/functional/task_management/test_scheduler.py |
Adds a regression test asserting each pending job only links to its own inventory update dependency (no cross-job leakage). |
awx/main/scheduler/task_manager.py |
Fixes DependencyManager.generate_dependencies() to attach only the current task’s dependencies instead of a cumulative list. |
TheWitness
approved these changes
Jun 4, 2026
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.
Job Dependency cascading leakage
This is the infamous job dependency failure bug, where if you launch multiple jobs at once, and one job depends on a project or inventory sync and is the first one processed, 1st, all the current pending jobs stay in pending even if they are not waiting on anything, and 2nd, if the sync fails all the jobs fail with the error about that dependency failing
So generate_dependencies is creating a list of all pending jobs and their dependencies. The problem is that as it loops over each job, it is adding the current running full list of dependencies to each job, instead of just that jobs dependencies.
Ex:
Simple fix, also added some tests to double check this to ensure that dependency leakage doesn't happen. Verified that with reverting the change, the tests do indeed fail and detect the leakage.