fix: abort output listener task during VM cleanup to prevent hangs#264
Closed
claude-claude[bot] wants to merge 1 commit intofix-output-timeoutfrom
Closed
fix: abort output listener task during VM cleanup to prevent hangs#264claude-claude[bot] wants to merge 1 commit intofix-output-timeoutfrom
claude-claude[bot] wants to merge 1 commit intofix-output-timeoutfrom
Conversation
The removal of the 5-minute read timeout in run_output_listener allowed long-running image imports to complete, but introduced a hang in stress tests where 100 VMs are spawned/killed rapidly. When VMs are killed abruptly, the vsock connection may not cleanly close, causing read_line() to block indefinitely. This prevents the task from terminating naturally. Fix by: 1. Storing the output listener task handle (removing _ prefix) 2. Adding output_listener_handle parameter to cleanup_vm() 3. Explicitly aborting the task when cleanup_vm() is called This ensures the listener is forcefully terminated during cleanup while still allowing indefinite waits for legitimate long-running operations.
Owner
|
Cherry-picked into PR #263 (fix-output-timeout) |
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.
CI Fix
Fixes CI #21743522464
Problem
The test
test_snapshot_clone_stress_100_rootlesswas failing after the removal of the 5-minute read timeout in the output listener (commit 2b0f27c).While removing the timeout fixed large image imports (10+ minutes), it introduced a new issue: when VMs are killed abruptly during stress tests (spawning/killing 100 VMs rapidly), the vsock connection may not cleanly close, causing
read_line()to block indefinitely. The output listener task would hang forever, preventing proper cleanup and causing resource exhaustion.Solution
This PR ensures the output listener task is explicitly aborted during VM cleanup:
_output_handletooutput_handle(removed underscore prefix) so we can reference it lateroutput_listener_handleparameter tocleanup_vm()functionhandle.abort()when cleaning up VM resourcesThis maintains the benefit of supporting long-running operations (no artificial timeout) while ensuring tasks are properly terminated when VMs are killed, preventing hangs in stress test scenarios.
Testing
The fix allows:
Generated by Claude | Fix Run