mxc icon indicating copy to clipboard operation
mxc copied to clipboard

Hyperlight: output not flushed before exit is silently lost

Open trevotai-amd opened this issue 3 weeks ago • 1 comments

Relevant area(s)

Windows

Brief description of your issue

In the Hyperlight backend (Python runtime), output that is still in the stdout buffer when the guest finishes is lost. The run reports exit code 0 and returns empty stdout, with no error. A tool that ends with print(result, end="") silently returns nothing to the caller.

Versions: MXC 1.0.0 and 1.0.1 (wxc-exec.exe from npm @microsoft/mxc-sdk), Windows 11 26300.9711, after wxc-exec --setup-hyperlight=python.

Steps to reproduce

  1. Create D.json:
    {"version": "1.1.0-alpha", "containment": "hyperlight", "hyperlight": {"runtime": "python"},
     "process": {"commandLine": "print('hello', end='')", "timeout": 60000}}
    
  2. Run wxc-exec --experimental D.json.
  3. Change the command to print('hello', end='', flush=True) and run again.

Expected behavior

hello is printed in both runs (stdout flushed when the guest exits, as with a normal Python process).

Actual behavior

Run 1: exit code 0, empty stdout. Run 2: hello.

trevotai-amd avatar Nov 05 '26 14:11 trevotai-amd

This is fixed upstream in hyperlight-unikraft since v0.19.0–the Python driver now flushes stdout/stderr at the end of every call, so no-newline output like print('hello', end='') isn't lost. MXC is pinned to v0.17.0, which predates it. I will put up a PR bumping the backend's crate pin + rootfs tag to pick it up 👍

danbugs avatar Nov 05 '26 16:11 danbugs