You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes the two correctness items left open when #1564 was approved.
CLI: stdin is closed only after the command is known to be stopped. If reading wxc-exec's stdin fails while a WSLc command runs, the executor stops the container and now waits for the command to exit before closing the command's stdin. Previously the result of the stop was ignored, so a command that was still running could read the cut-short input as complete, for example cat > staged && mv staged live publishing a truncated file.
If the stop can't be confirmed, the command's stdin stays open until the container is torn down. The run fails with a message saying the command could not be confirmed stopped.
A run with no timeout no longer hangs in that case.
When a run times out, stdin is no longer closed before the command is known to be gone, so a command that ignores SIGTERM can't read early end-of-file either.
.NET: waits stay responsive while a finished process is cleaned up. On WSLc, a command that exits leaving a lot of stdin unread is reported about a minute late, and MxcProcess spends that time in cleanup. During it:
cancelling WaitAsync now returns at once, and a later wait returns the result;
Kill returns at once without doing anything;
Dispose returns at once, and the process is released when cleanup finishes, before the wait returns;
Warnings returns the warnings from before cleanup started, and OutputMetadata is null until cleanup finishes.
Before, all of these waited for the cleanup; #1564 fixed only Kill. The native API is unchanged.
🔗 References
Follow-up to #1564 (review findings 2 and 4). Finding 6 only concerned the #1564 description, which is corrected there.
🔍 Validation
Windows with WSL 3.0.4 and WSLc SDK 3.0.3 (vendored; the MxcDependencies feed returned 401).
Node wslc-e2e.test.js with MXC_ENABLE_WSLC_TESTS=1
Passed: 8/8
New tests:
Live .NET: cancelling WaitAsync, and calling Warnings and Dispose, while a wait is in the late-exit cleanup. Both tests fail without the MxcProcess change and pass with it. They are in the class the scheduled WSLc validation already runs.
Rust unit: a forwarding failure whose stop can't be confirmed keeps the command's stdin open until teardown, and the run's wait ends on either the process exiting or the forwarding failure.
Not covered live: a failed or unconfirmed container stop, which can't be triggered on a real host; the unit tests cover it. The Node SDK unit tests were not run, since nothing in the Node SDK changed.
[P2] The timeout stdin-close ordering fix lacks a regression through the CLI/backend flow; the existing cat timeout case in tests/scripts/run_wslc_all_tests.ps1:628-637 checks only the timeout result and would still pass with premature EOF. Extend that scheduled suite with a command that ignores SIGTERM and writes a persistent marker only after EOF, keeping host stdin open through the timeout. Assert that the run times out without writing the marker, so restoring the unconditional close_stdin() fails the test.
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
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.
📖 Description
Fixes the two correctness items left open when #1564 was approved.
CLI: stdin is closed only after the command is known to be stopped. If reading
wxc-exec's stdin fails while a WSLc command runs, the executor stops the container and now waits for the command to exit before closing the command's stdin. Previously the result of the stop was ignored, so a command that was still running could read the cut-short input as complete, for examplecat > staged && mv staged livepublishing a truncated file.SIGTERMcan't read early end-of-file either..NET: waits stay responsive while a finished process is cleaned up. On WSLc, a command that exits leaving a lot of stdin unread is reported about a minute late, and
MxcProcessspends that time in cleanup. During it:WaitAsyncnow returns at once, and a later wait returns the result;Killreturns at once without doing anything;Disposereturns at once, and the process is released when cleanup finishes, before the wait returns;Warningsreturns the warnings from before cleanup started, andOutputMetadatais null until cleanup finishes.Before, all of these waited for the cleanup; #1564 fixed only
Kill. The native API is unchanged.🔗 References
Follow-up to #1564 (review findings 2 and 4). Finding 6 only concerned the #1564 description, which is corrected there.
🔍 Validation
Windows with WSL 3.0.4 and WSLc SDK 3.0.3 (vendored; the MxcDependencies feed returned 401).
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningscargo clippy -p mxc-sdk -p mxc_ffi --features wslc --all-targets -- -D warningscargo test -p mxc-sdk --features wslc --libMicrosoft.Mxc.Sdk.Tests, built with-p:MxcWithWslc=true)MXC_ENABLE_WSLC_TESTS=1, classMxcContainerWslcE2ETeststests\scripts\run_wslc_all_tests.ps1 -Debug -SkipSetupwslc-e2e.test.jswithMXC_ENABLE_WSLC_TESTS=1New tests:
WaitAsync, and callingWarningsandDispose, while a wait is in the late-exit cleanup. Both tests fail without theMxcProcesschange and pass with it. They are in the class the scheduled WSLc validation already runs.Not covered live: a failed or unconfirmed container stop, which can't be triggered on a real host; the unit tests cover it. The Node SDK unit tests were not run, since nothing in the Node SDK changed.
✅ Checklist
Cargo.lock, thedependency-feed-checkcheck passes (see pull request builds)📋 Issue Type
Microsoft Reviewers: Open in CodeFlow