Skip to content

fix(cloudxr): start runtime with spawn context - #263

Open
WilliamK112 wants to merge 1 commit into
NVIDIA:mainfrom
WilliamK112:codex/avoid-runtime-fork
Open

fix(cloudxr): start runtime with spawn context#263
WilliamK112 wants to merge 1 commit into
NVIDIA:mainfrom
WilliamK112:codex/avoid-runtime-fork

Conversation

@WilliamK112

@WilliamK112 WilliamK112 commented Jun 23, 2026

Copy link
Copy Markdown

Summary

  • start the native CloudXR runtime process from an explicit spawn multiprocessing context instead of the platform-default fork context
  • preserve the existing multiprocessing.Process handle contract used by readiness polling and terminate_or_kill_runtime
  • add a focused unit test that stubs native CloudXR imports and verifies the spawn context
  • document the process-model decision in the architecture changelog

Rationale

Issue #40 calls out that the current multiprocessing.Process(target=runtime_run) path can fork from inside an already-running asyncio event loop. Using spawn starts the runtime in a fresh interpreter, avoiding inherited asyncio lock and signal-handler state while keeping the current readiness and cleanup APIs intact.

Fixes #40

Validation

Refreshed onto current NVIDIA/xr-ai@6de6ca73cec931c5833fe7c418fb30e1df5b4172; GitHub reports behind_by: 0, ahead_by: 1.

  • pytest -q tests/test_cloudxr_runtime_process.py tests/test_cloudxr_service_layout.py — 4 passed
  • Ruff 0.15.16 on both changed Python files — passed
  • repository SPDX checker on source, test, and changelog — passed
  • signed-off commit / DCO — present
  • git diff --check upstream/main...HEAD — passed

The unit test imports the runtime from its current services/cloudxr-runtime location and replaces the platform-specific Isaac Teleop modules with fakes, so this process-launch contract is verified without requiring CloudXR hardware.

@WilliamK112
WilliamK112 force-pushed the codex/avoid-runtime-fork branch from 919a3a6 to 0004716 Compare July 2, 2026 02:46
@WilliamK112
WilliamK112 marked this pull request as ready for review July 2, 2026 02:48
@WilliamK112
WilliamK112 force-pushed the codex/avoid-runtime-fork branch from 0004716 to c53795e Compare August 12, 2026 05:36
@WilliamK112

Copy link
Copy Markdown
Author

Refreshed this PR onto current main (6de6ca73) after CloudXR moved under services/. The regression test now imports the current service path and stubs the newly required launcher API, and the fork-to-spawn rationale is recorded in docs/changelog.md. The PR remains one signed commit; GitHub reports behind_by: 0, ahead_by: 1, and mergeable. Validation on c53795e1: 4 related tests passed, Ruff/SPDX/DCO/diff checks clean.

Signed-off-by: WilliamK112 <164879897+WilliamK112@users.noreply.github.com>
@WilliamK112
WilliamK112 force-pushed the codex/avoid-runtime-fork branch from c53795e to ad812f6 Compare August 13, 2026 15:30
@WilliamK112

Copy link
Copy Markdown
Author

Refreshed onto current main (b641bf59) and resolved the changelog-only conflict while preserving all newer upstream decisions. Validation on ad812f6: 4 focused tests passed; Ruff, SPDX, DCO, and git diff --check all pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

use asyncio.create_subprocess_exec is better to avoid forking

1 participant