fix(task): prevent hang when tasks with multiple dependencies fail#6481
Merged
fix(task): prevent hang when tasks with multiple dependencies fail#6481
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a reproduction test case for a reported issue where mise hangs when tasks fail with dependencies. The test validates that the task runner properly exits with failure instead of hanging indefinitely when dependent tasks fail.
- Adds an end-to-end test script to reproduce the hanging behavior described in the linked GitHub discussion
- Creates a test scenario with multiple interdependent tasks where failures should propagate without causing hangs
- Uses timeout mechanism to detect and fail the test if hanging occurs
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Extends the fix from jdx#6430 to handle the main scheduler loop. When a task failure occurs and continue_on_error is false, the scheduler now properly cleans up the main dependency graph before exiting. ## Problem The previous fix in jdx#6430 addressed hangs in nested task sequences (inject_and_wait), but didn't handle the main scheduler loop. When multiple tasks depended on a common failing dependency, the scheduler would stop accepting new work but wouldn't clean up the dependency graph, causing it to wait indefinitely for a completion signal that would never arrive. ## Root Cause In the main scheduler loop (lines 413-492): 1. When a dependency fails, is_stopping() becomes true 2. The scheduler breaks out of the inner drain loop 3. However, remaining tasks stay in main_deps 4. The spawned async task waits for deps to be empty before signaling 5. This creates a deadlock - scheduler stopped but deps not cleared ## Solution Added cleanup logic similar to inject_and_wait: when is_stopping() is detected, explicitly remove all remaining tasks from main_deps. This triggers the completion signal and allows proper shutdown. Fixes the hang demonstrated in test_task_failure_hang_depends 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Owner
|
thanks for the help @stempler—hopefully we've got these issues sorted now |
jdx
added a commit
that referenced
this pull request
Sep 30, 2025
### 🐛 Bug Fixes - **(auto-install)** support installing non-active backend versions by @jdx in [#6484](#6484) - **(task)** prevent hang when tasks with multiple dependencies fail by @stempler in [#6481](#6481) ### 🧪 Testing - **(e2e)** use local HTTP server instead of httpbin.org for tool-stub tests by @jdx in [#6488](#6488) ### New Contributors - @stempler made their first contribution in [#6481](#6481) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Bumps to 2025.9.25 with changelog updates (bug fixes, testing), adds `mdsf` to the aqua registry, and updates completions and packaging metadata. > > - **Release v2025.9.25** > - Update versions in `Cargo.toml`, `Cargo.lock`, `default.nix`, `packaging/rpm/mise.spec`, and `README.md`. > - Refresh shell completion cache spec filenames in `completions/_mise`, `completions/mise.bash`, and `completions/mise.fish`. > - Expand `CHANGELOG.md` with 2025.9.25 entry (bug fixes and testing notes). > - **Registry** > - Add `hougesen/mdsf` package: `crates/aqua-registry/aqua-registry/pkgs/hougesen/mdsf/registry.yaml`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 6debaab. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: mise-en-dev <release@mise.jdx.dev>
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.
Summary
Fixes task execution hanging when a task depends on multiple tasks that share a common failing dependency. Extends the fix from #6430 to handle the main scheduler loop.
Problem
When multiple tasks depend on a common dependency that fails (e.g.,
lint,test, andbuild:dockerall depend oninstall, which fails), and another task depends on all of them (e.g.,checkdepends on all three), the scheduler would hang indefinitely instead of properly exiting with an error.This scenario wasn't covered by the previous fix in #6430, which only handled nested task sequences within
inject_and_wait.Root Cause
In the main scheduler loop:
is_stopping()becomes truemain_depsdependency graphmain_depsto become empty before sending themain_donesignalSolution
Added cleanup logic similar to
inject_and_wait: whenis_stopping()is detected in the main scheduler loop, explicitly remove all remaining tasks frommain_deps. This triggers the completion signal and allows proper shutdown.Test plan
test_task_failure_hang_dependsthat reproduces the complex dependency scenariotest_task_failure_hangcontinues to passFixes: #6391
🤖 Generated with Claude Code
Co-authored-by: Claude noreply@anthropic.com