Repository navigation
[core][sandbox] Remove the readonly option - #68088
Conversation
Every sandbox now writes to a private overlay over its cached image, which is discarded with the sandbox. readonly=True, the default, is gone. A read-only root saved nothing at boot and cost a set of special cases: a host-backed scratch workdir, a tmpfs on /tmp, a kernel overlay for mount points the image lacks, a writable-root fallback where that overlay can't mount, mount points seeded into every cached image, a workdir branch in disk caps and in checkpoint/restore, and a restore rule for workdir. With a writable root, runsc creates mount points in the sandbox's overlay and the workdir is a plain directory, so all of those go. - create(), Sandbox and SandboxRuntime.create() ignore a `readonly` argument with a RayDeprecationWarning, and the HTTP API ignores the field, so callers that pass readonly=False keep working. - disk caps every sandbox's overlay, with or without a workdir. - Only sandboxes with OCI hooks that run on the host boot from a kernel overlay. - Restore refuses a checkpoint of a readonly=True sandbox, whose saved state depends on the read-only root. Signed-off-by: xyuzh <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request simplifies the Ray Sandboxes subsystem by removing the readonly option, making every sandbox writable by default with a private copy-on-write overlay. This change eliminates the need for seeding mount points into EROFS images, managing host-backed scratch directories for workdir, and handling complex read-only fallback scenarios. The review feedback correctly identifies a critical issue in the checkpoint and restore flow: for overlayfs sandboxes, writes are stored in the runsc-overlay2 directory rather than rootfs. Since the current implementation only snapshots rootfs, these writes would be lost on restore. Implementing the suggested changes to snapshot and restore the runsc-overlay2 directory is highly recommended to prevent data loss.
I am having trouble creating individual review comments. Click here to see my feedback.
python/ray/experimental/sandbox/backend/checkpoint_utils.py (391-401)
For overlayfs sandboxes (such as GPU sandboxes or those with prestart hooks), the container's own writes are stored in gVisor's --overlay2 directory (runsc-overlay2 under root_dir) rather than the kernel overlay mount point (rootfs). Currently, copy_bundle_filesystems only snapshots root_dir/rootfs, meaning any writes made by processes inside the sandbox are omitted from the checkpoint and lost upon restore.
We should also snapshot the runsc-overlay2 directory if it exists.
saved_overlay2 = os.path.join(root_dir, "runsc-overlay2")
if os.path.isdir(saved_overlay2):
dest_overlay2 = os.path.join(self.fs_dir, "runsc-overlay2")
try:
copy_fs_tree(saved_overlay2, dest_overlay2)
except Exception as e:
raise SandboxError(
f"Failed to copy runsc-overlay2 for sandbox '{sandbox_id}': {e}"
) from epython/ray/experimental/sandbox/backend/gvisor.py (2127-2137)
To accompany the snapshotting of runsc-overlay2 during checkpointing, we should also restore the runsc-overlay2 directory if it exists in the checkpoint. This ensures that the container's filesystem writes are correctly restored for overlayfs sandboxes.
overlay2_src = os.path.join(checkpoint_path, "fs", "runsc-overlay2")
if os.path.isdir(overlay2_src):
copy_fs_tree(
overlay2_src,
os.path.join(root_dir, "runsc-overlay2"),
)
|
On the gemini-code-assist review above: not changing this. I checked it on real gVisor (runsc release-20261026.0). Writes in a sandbox with a |
|
Thank you for the clarification and for verifying this on a real gVisor environment. Your findings regarding how |
| cidr_allowlist: Optional[List[str]] = None | ||
| capabilities: Optional[List[str]] = None | ||
| shell: str = "/bin/bash" | ||
| readonly: bool = True | ||
| gpu_ids: Optional[List[Union[int, str]]] = None | ||
| _oci_spec_transform_fn: Optional[Callable[[Dict], Optional[Dict]]] = field( | ||
| default=None, repr=False, compare=False |
There was a problem hiding this comment.
Removing readonly from SandboxConfig raises TypeError on SandboxConfig(..., readonly=False), Sandbox(restore_from=..., readonly=...) drops readonly without warning, and removing workdir_path from exported BaseImageManager.prepare_oci_bundle shifts its positional arguments.
There was a problem hiding this comment.
Partly fixed in 1accd53 and 8f06337: Sandbox(restore_from=..., readonly=...) and GVisorSandboxBackend.restore_sandbox now go through the same check as create, so readonly=False warns and readonly=True raises (test_sandbox_actor_forwards_config_on_restore, test_backend_restore_handles_the_removed_readonly_option). Not changing the other two: both are part of the alpha API under ray.experimental, and both fail at the call instead of silently. SandboxConfig(readonly=...) raises a TypeError that names the argument, and the backend calls prepare_oci_bundle with keywords, so a subclass written for the old signature gets a TypeError for the missing workdir_path instead of a shifted argument.
| image, tmp_rootfs_dir, tmp_extract_dir, timeout_seconds, images_dir | ||
| ) | ||
| _seed_tmp(tmp_rootfs_dir) | ||
| _seed_mountpoints(tmp_rootfs_dir) | ||
| build_erofs_image( | ||
| tmp_rootfs_dir, | ||
| ownership, |
There was a problem hiding this comment.
Removing _seed_mountpoints without bumping _EXTRACT_FORMAT changes erofs_superblock_fingerprint for any image with missing /dev, /proc, or /sys dirs, so writable checkpoints taken against a pre-upgrade format-3 cache entry fail restore once that image is rebuilt.
There was a problem hiding this comment.
Not changing this: a rebuild already changes the fingerprint, whatever the image holds. mkfs.erofs runs without -T or -U, so every build gets a new UUID and build time. I built the same tar twice with erofs-utils 1.9.4 and the two superblocks differed. A checkpoint never survives a rebuild of its image, before or after this PR, and restore says so. Bumping _EXTRACT_FORMAT would make it worse: every cached image would rebuild on upgrade, and every existing checkpoint would stop restoring at once. Images cached with the seeded mount points keep working.
| disk: Size cap of the sandbox's root filesystem overlay (e.g. | ||
| "10Gi"), in the units ``memory`` takes. Every sandbox writes to | ||
| a private copy-on-write overlay over its image: image content | ||
| stays visible, sandboxes don't interfere with each other, the | ||
| cached image is never modified, and the overlay is discarded | ||
| with the sandbox. Writes past the cap fail with ENOSPC inside | ||
| the sandbox, and the sandbox keeps running. Zero (default) means | ||
| no cap. Requires ``readonly=False`` or a ``workdir``: a readonly | ||
| rootfs stays read-only, so the cap applies to its explicit | ||
| workdir, whose writes then go to a file in the sandbox's | ||
| directory on the node instead of the workdir's host directory. | ||
| In-memory mounts such as /dev/shm count toward the sandbox's | ||
| memory instead. | ||
| no cap. In-memory mounts such as /dev/shm count toward the | ||
| sandbox's memory instead. |
There was a problem hiding this comment.
Now that every sandbox defaults to a writable host-backed rootfs overlay, have you considered a configurable node default overlay cap (e.g. RAY_SANDBOX_DEFAULT_DISK) instead of uncapped disk=0?
There was a problem hiding this comment.
Yes, as a follow-up PR. I have it in progress as RAY_SANDBOX_DEFAULT_DISK, and I kept it out of this PR so the removal stays reviewable on its own. The description lists the uncapped default as a behavior change.
| # Every sandbox writes to a private overlay over the image, which is | ||
| # discarded with it. runsc layers no overlay over a read-only root. | ||
| spec["root"]["readonly"] = False |
There was a problem hiding this comment.
Dropping the /tmp tmpfs mount also drops nosuid,nodev on /tmp in default sandboxes.
There was a problem hiding this comment.
Not changing this. Master mounted that tmpfs only for a read-only root. A readonly=False sandbox already had /tmp on the root overlay without those flags, as a Docker container does, and that is now the only mode. The flags would also cover only /tmp, while the rest of the root filesystem is writable without them.
pcmoritz
left a comment
There was a problem hiding this comment.
Let's make readonly=True raise an error, everything else looks great!
A caller that passes readonly=True asked for a root filesystem the sandbox can't write. Ignoring the option with a warning gave that caller a writable sandbox, which is more access than it asked for. create(), restore(), Sandbox and SandboxRuntime now raise a ValueError for readonly=True, and the HTTP API answers 422 to readonly: true. readonly=False is still ignored with a RayDeprecationWarning, and the HTTP API still ignores readonly: false. create() and restore() check the option in the caller, so the error isn't raised in the actor's constructor. Signed-off-by: xyuzh <[email protected]>
runsc restores a checkpoint only with the cwd it was taken with. Its spec validation fails with '"Cwd" does not match across checkpoint restore'. A restore that passed a different workdir got that far and failed there. workdir is back in the fields a restore can't change, so the restore fails first, with the error that names the field. Signed-off-by: xyuzh <[email protected]>
andrewsykim
left a comment
There was a problem hiding this comment.
How strongly do we feel about fully removing readonly option as opposed to just defaulting readonly to False? Do we really feel like there is no use-case that would warrant readonly=True?
Conflict: the import block in runtime.py, where ray-project#67972 added an import next to this branch's pop_removed_readonly import. ray-project#67972 (commit a sandbox to a registry image) also read SandboxConfig.readonly, which this branch removes. commit() no longer refuses a read-only sandbox, since every sandbox has a writable root filesystem, and its docs, docstrings and test drop readonly=False. Signed-off-by: xyuzh <[email protected]>
|
@andrewsykim There is clear benefit of removing it because a lot of other features are interacting with it, and given the sandboxes are strongly isolated, there is actually not much benefit in making the rootfs read only. The only real one I can think of is to limit the amount of data the sandbox can write, but that can be achieved by just setting a low limit on the root disk size. I think the use case of a readonly rootfs in linux are very narrow (e.g. if linux runs from ROM). As an additional datapoint, it looks like modal doesn't support it -- they do support read only volumes though which makes a lot of sense and interacts with other features a lot less. |
andrewsykim
left a comment
There was a problem hiding this comment.
okay, I'm good to remove this for now
andrewsykim
left a comment
There was a problem hiding this comment.
Some findings from AI-led testing
| "disk caps the writable rootfs; it requires readonly=False or " | ||
| "a workdir" | ||
| ) | ||
| self._validate_gpu_ids() |
There was a problem hiding this comment.
Now that _safe_join_under was removed, neither SandboxConfig.__post_init__ nor CreateSandboxRequest validates workdir upfront (unlike mounts, which checks os.path.isabs).
Reproduced:
SandboxConfig(image="busybox:latest", workdir="sub")and"./sub"are accepted, failing only later atrunscstartup withSandboxCreationError: invalid process spec: cwd "sub" must be an absolute path.CreateSandboxRequest(image="busybox:latest", workdir="sub")is also accepted instead of failing fast with 422.workdir="/../../../../etc/cron.d"is passed unnormalized torunsc, creating/etc/cron.dand settingpwd='/etc/cron.d'.
There was a problem hiding this comment.
Fixed in 8f06337: a relative workdir now raises a ValueError in SandboxConfig and gets a 422 from the HTTP API. Tests: test_workdir_must_be_absolute and test_relative_workdir_is_422. I left /../../../../etc/cron.d unnormalized: runsc resolves it inside the sandbox's own root, so it is the sandbox's /etc/cron.d, the same as passing that path, and nothing on the host is touched.
| self, | ||
| root_dir: str, | ||
| workdir_path: str, | ||
| container_cwd: str, |
There was a problem hiding this comment.
Removing workdir_path and readonly from prepare_oci_bundle (as well as readonly from create_oci_spec and SandboxConfig) breaks backwards compatibility for callers using positional args or readonly=False.
Reproduced:
ImageManager().prepare_oci_bundle("busybox:latest", "/tmp/unused_b", "/workspace", ["sleep"], {}, False)shiftscontainer_cwd/imageand raisesSandboxCreationError: Local image archive '/workspace' not found..ImageManager().create_oci_spec("busybox:latest", readonly=False)andSandboxConfig(image="busybox:latest", readonly=False)raiseTypeError: ... got an unexpected keyword argument 'readonly'.
There was a problem hiding this comment.
I think we don't care about backwards compatibility right now while sandboxing is experimental right?
There was a problem hiding this comment.
Right, I'm not keeping compatibility for these while the API is experimental. They fail at the call instead of silently: readonly= raises a TypeError that names the argument, and the backend calls prepare_oci_bundle with keywords. create(), restore(), Sandbox and SandboxRuntime still accept readonly=False with a warning, so their callers don't break.
| ) | ||
| existing_dests.add("/tmp") | ||
|
|
||
| spec["mounts"] = mounts |
There was a problem hiding this comment.
Verified that removing the /tmp tmpfs mount leaves /tmp on none / overlay rw without nosuid,nodev: /proc/mounts has no /tmp entry, and setting setuid/setgid on an executable under /tmp retains mode 6755 when capabilities allow it (unlike the prior readonly=True default where /tmp was mounted nosuid,nodev).
There was a problem hiding this comment.
Not changing this. Master mounted that tmpfs only for a read-only root. A readonly=False sandbox already had /tmp on the root overlay without those flags, as a Docker container does, and that is now the only mode. The flags would also cover only /tmp, while the rest of the root filesystem is writable without them.
| Returns: | ||
| A Sandbox actor handle. | ||
| """ | ||
| pop_removed_readonly(kwargs) |
There was a problem hiding this comment.
sandbox.restore(ckpt, readonly=True) fails eagerly in the caller with ValueError, whereas sandbox.restore(ckpt, workdir="/elsewhere") returns an ActorHandle eagerly and only surfaces ActorDiedError (wrapping SandboxError: Cannot restore with workdir='/elsewhere'...) on the first ray.get(...) call.
There was a problem hiding this comment.
Not changing this. Errors that depend on the checkpoint come from the actor, as they do on master for image, network and disk overrides: with a CheckpointPath, the caller never reads the manifest, which lives on the node that took the checkpoint. readonly=True can fail in the caller because it needs no checkpoint to check.
GVisorSandboxBackend.restore_sandbox checks the removed readonly option itself. It skipped the option as an unknown override, so readonly=True restored a writable sandbox. readonly=None is dropped without a warning. A wrapper that forwards its own unset option passes None. A restore override may spell a saved value differently, such as disk=67108864 for "64Mi" or workdir="/workspace/" for "/workspace". It is accepted, and the restored config keeps the recorded spelling, which is what runsc compares. A relative workdir fails in SandboxConfig, and with 422 in the HTTP API, instead of at container start, after the image pull. Signed-off-by: xyuzh <[email protected]>
xyuzh
left a comment
There was a problem hiding this comment.
Thanks for the testing pass. 8f06337 fixes four of the findings, and the other three are answered inline.
@pcmoritz, the changes since your approval: readonly=True raises (1accd53), restore keeps workdir fixed (1b2dc7b), a merge of master for #67972, whose read-only check in commit() is gone (812b09f), and 8f06337 for this round.
| "disk caps the writable rootfs; it requires readonly=False or " | ||
| "a workdir" | ||
| ) | ||
| self._validate_gpu_ids() |
There was a problem hiding this comment.
Fixed in 8f06337: a relative workdir now raises a ValueError in SandboxConfig and gets a 422 from the HTTP API. Tests: test_workdir_must_be_absolute and test_relative_workdir_is_422. I left /../../../../etc/cron.d unnormalized: runsc resolves it inside the sandbox's own root, so it is the sandbox's /etc/cron.d, the same as passing that path, and nothing on the host is touched.
| self, | ||
| root_dir: str, | ||
| workdir_path: str, | ||
| container_cwd: str, |
There was a problem hiding this comment.
Right, I'm not keeping compatibility for these while the API is experimental. They fail at the call instead of silently: readonly= raises a TypeError that names the argument, and the backend calls prepare_oci_bundle with keywords. create(), restore(), Sandbox and SandboxRuntime still accept readonly=False with a warning, so their callers don't break.
| ) | ||
| existing_dests.add("/tmp") | ||
|
|
||
| spec["mounts"] = mounts |
There was a problem hiding this comment.
Not changing this. Master mounted that tmpfs only for a read-only root. A readonly=False sandbox already had /tmp on the root overlay without those flags, as a Docker container does, and that is now the only mode. The flags would also cover only /tmp, while the rest of the root filesystem is writable without them.
| Returns: | ||
| A Sandbox actor handle. | ||
| """ | ||
| pop_removed_readonly(kwargs) |
There was a problem hiding this comment.
Not changing this. Errors that depend on the checkpoint come from the actor, as they do on master for image, network and disk overrides: with a CheckpointPath, the caller never reads the manifest, which lives on the node that took the checkpoint. readonly=True can fail in the caller because it needs no checkpoint to check.
|
@xyuzh Thanks for the PR. Agreed that readonly=True doesn't offer much value. On the implementation: this PR removes the mount-point seeding from EROFS images, and as the |
runsc creates each mount point that the image lacks as an empty file or directory in the sandbox's upper layer. With mount points no longer seeded into the cached image, a commit's new layer picked them up: an empty /etc/hosts for python:3.10-slim, and /etc/resolv.conf, /proc and /sys as well for busybox. A mount hides its mount point for the sandbox's whole life, so nothing the sandbox wrote can be there. build_layers now takes the destinations of the sandbox's mounts and skips an empty file or a directory at one of them. Signed-off-by: xyuzh <[email protected]>
|
@elnikety Yes, it should, thanks for catching that. I checked what a commit picks up on runsc release-20261026.0 with a freshly built image cache: an empty Fixed in a10bdeb. Commit now skips an empty file or a directory that sits at one of the sandbox's mount destinations. A mount hides its mount point for the sandbox's whole life, so nothing the sandbox wrote can be there, and skipping it loses nothing. This covers the mount points of a sandbox's own One thing it doesn't remove: a parent directory that runsc had to create above a mount point, such as Tests: @pawelbeza this touches |
Resolve conflicts with #68088, which removed the readonly option and _seed_mountpoints. erofs-pull no longer seeds the mount points either, so its images still match the ones extraction builds with mkfs.erofs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-pull's registry test #68088 removed the mount-point seeds, so a pulled busybox has no /etc/resolv.conf anymore. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…floop-input * upstream/master: [Data][3/n] update progress bar on lineage reconstruction (ray-project#67366) [Data] Enable the Top-N rewrite by default and expose it on DataContext (ray-project#68329) [Data] Adaptively skip map-side partial aggregation for high-cardinality keys (ray-project#68118) [Core] Spawn specific servers without preexec_fn to fix intermittent startup crashes (ray-project#67947) [Serve] Stop the __wrapped__ walk at non-callables (ray-project#67117) [Data] Deflake test_read_parquet_v2 by cutting redundant Ray Data executions (ray-project#68318) [Data] Retry FooterReader actor deaths with Ray Core and yield footers in listing order (ray-project#67988) [Data] Fix order-dependent schema unification when a list<null> arm is present (ray-project#68259) [Serve] Make @serve.batch work when wrapped in another decorator (ray-project#68177) [serve] Deflake test_metrics_3 - record the batch queue length once a batch is taken (ray-project#68302) [serve] Drop completed requests from the multiplexed model ID index (ray-project#68085) [Data] Fix flaky test_hudi: read each table once instead of sorting in Ray Data, keep size small (ray-project#68162) [Data] Fix flaky test_context: start 2 Ray clusters instead of 5 and keep size small (ray-project#68161) [Data] Fix flaky test_kafka: use recent timestamps in test_read_kafka_datetime_partial_range (ray-project#68248) [Data] Iceberg DSv2 [2/5]: The listing-to-reading manifest for Iceberg (ray-project#67951) [Train] Report training errors when the post-mortem debugger raises a BaseException (ray-project#68317) [RLlib] Skip the PPOConfig docstring example that crashes the rllib doctest target (ray-project#68306) [Train] Support post-mortem debugging for training function errors (ray-project#68296) [train][1/n] Give each health probe its own timeout (ray-project#68191) [Data] Fix unifying a fixed-shape tensor array with a lower-ndim variable-shaped one (ray-project#67266) [Train] Add a guide to debugging failures and hangs (ray-project#68299) [Data] Persist BlockMetadata.num_rows and batch ray.get in _calculate_blocks_rows (ray-project#67662) [Data] Vectorize LeRobot delta segment preparation and validate index contiguity (ray-project#67845) [Data] Avoid full-DataFrame apply in _AbstractKBinsDiscretizer._transform_pandas (ray-project#67862) [doc] Refresh intersphinx inventory snapshots (ray-project#68303) [Data] Fix SimpleImputer on categorical columns in append mode and with existing category values (ray-project#67467) [Data] Replace O(N) list.pop(0) with deque.popleft() in PushBasedShuffleTaskScheduler (ray-project#67243) [Train] Reject an elastic ScalingConfig with max_workers=0 (ray-project#68218) [core][move semantics][3/n]Populate task args with is_move for movable refs (ray-project#66803) [core][sandbox] Remove the readonly option (ray-project#68088) [Data](1/n) Implement the line-chunk reader for CSV and JSONL on DataSource V2 (ray-project#67907) [Data] Set MIMALLOC_PURGE_DELAY=0 on random_shuffle to fix the pyarrow 25 OOM regression (ray-project#68151) [core] Quote each `uv run` argument in the uv runtime env hook (ray-project#68156) [core] Don't let gRPC cancel calls that wait over 30s in the server queue (ray-project#68210) [Data] Fix shuffle and join on native tensor columns with pyarrow 25+ (ray-project#68072) [serve][llm] Remove decode load progress (ray-project#68258) [ci] Bump sglang to 0.5.23 in release tests (ray-project#68250) [Core] Build the test auth token file locally so Windows tests can read it (ray-project#68262) [image] Bump EFA installer to 1.51.0 in CPU base-extra images (ray-project#67730) [serve] Observe the result of rank reassignment reconfigures (ray-project#67923) [Serve][Docs] Explain imperative vs declarative deploys and in-place updates from Python (ray-project#68243) [Data] (Fault tolerance) Ray Data lineage reconstruction docs (ray-project#68061) [RLlib] Add a multi-node footsies APPO memory release test (ray-project#67595) [Train] Remove local mode (ray-project#68239) [Data] Fix filtered Lance row-count metadata (ray-project#67228) [Serve][2/2] Propagate TracingConfig to proxies at startup (ray-project#65437) [Data] Fix synthesized path filtering in DataSourceV2 (ray-project#67079) [RLlib] Run the BCConfig Tune example one trial at a time to unblock the rllib doctest target (ray-project#68242) [Data][Delta DSv2][2/7] List Delta Lake table files from the log (ray-project#67888) [Data] Parallelize Parquet and ORC full-schema reads (ray-project#67542) [Data] Random Shuffle on Shuffle V2 Map/Reduce Operators (ray-project#68004) [Data] Propagate metadata prefetch thread failures to executor (ray-project#68171) [core] Send generator consumed-progress updates from io_service_ (ray-project#67160) [Data] Add @ray-data-connectors as codeowner for datasource/sinks files (ray-project#68154) [data][llm] Keep the prompt in vLLM error rows (ray-project#67665) [data][actor-only][3/n] Actor-only backend: operator fusion (ray-project#67699) [Data] Read text files on DataSource v2 (ray-project#68063) [Autoscaler][KubeRay] Never patch worker group replicas below minReplicas (ray-project#67332) [Serve] Show progress of updating (ray-project#67107) [core][test] Trigger usage-stats OOM test without exhausting host memory (ray-project#68009) [Serve] Remove unused RAY_SERVE_HAPROXY_INGRESS_RETRY_ON and RAY_SERV… (ray-project#68175) [Data] Implement lineage tracker garbage collection upon marking operator durable (ray-project#67788) [Core] Fix recovery suppression race in ObjectRecoveryManager (ray-project#64974) [serve] Pass grpc.so_reuseport to gRPC as an integer (ray-project#66816) [Autoscaler][v2] Preserve retry accounting when trimming status history (ray-project#67360) [doc] Refresh intersphinx inventory snapshots (ray-project#68069) [Doc] Add item to AGENTS.md to update documentation when modifying API-facing code. (ray-project#68204) [Train] Preserve `num_boost_round=0` and avoid mutating `callbacks` in legacy LightGBM/XGBoost trainers (ray-project#68145) [Train] Raise in prepare_data_loader instead of dropping a custom batch_sampler (ray-project#68201) [air] Return None in skip_exceptions when exc or StartTraceback cause is None (ray-project#68172) [Train] Fix `checkpoint_manager` to support metrics only reported in a validation function (ray-project#67909) [Train] Count elastic workers in resource units for fractional resources (ray-project#68139) [Data] Refactor Disk shuffle map to use map Operator (ray-project#67130) [core][move semantics][2/n] Change state to moved on consumption and add enforcements (ray-project#66767) [Data] Propagate labels to object-store SHUFFLE_V2 map/reduce tasks (ray-project#67135) feat(core): add Cambricon MLU resource support (ray-project#66368) [Data] Make `zero_copy_batch=False` copy default batches (ray-project#67154) [data] Fix Parquet filename suffix detection (ray-project#67156) [data] Fix docstring/behavior mismatches in read_json and Dataset.sort (ray-project#66927) [Data] Run video_object_detection.ray on T4s with more memory (ray-project#68149) [core][sandbox] Let a node override network="public" sandboxes' default resolvers (ray-project#67691) [Data] read_mcap: resolve each sample's steps and lay out its row (ray-project#67925) [Data] read_mcap: sample read inputs: TopicSpec, steps, match and samples checks (ray-project#67924) [Data] Keep a map task's buffered rows when max_errored_blocks skips its error; read past corrupt MCAP chunks (ray-project#67167) [core][move semantics][1/n] Adding consume_once flag in actor methods (ray-project#66620) [Data] Size the schema pin and the columns Ray adds in the Parquet decoded-size estimate [3/6] (ray-project#67838) [Serve][LLM][1/3] Token based autoscaling: track autoscaling workload in KV router (ray-project#67937) [Data] Add native direct reads for nonpartitioned Hive tables (ray-project#67114) [Train] Count elastic workers in resource units for fractional resources (ray-project#68139) [Data] Add `condition` to `Dataset.join` and extract equi-join keys from it (ray-project#67590) [data] Add Top-N execution (ray-project#66931) [build] Bazel 8.8.1: bump protobuf to v29.6, rules_java to 8.12.0 and gRPC to 1.69.0 (ray-project#66483) [build] Use Arena::Create and pin Java 8 bytecode ahead of protobuf 29 / rules_java 8 (ray-project#67720) [core][sandbox] Don't join a sandbox's cgroup on every exec (ray-project#67690) [Data] Run `training_ingest_regression_test` on Instances that can be Provisioned (ray-project#68110) [Data] Run Sort on Disk-based Shuffle under SHUFFLE_V2 (ray-project#67850) [core] Deflake tests that race on timing (ray-project#67717) [ci] Bump pypa manylinux2014 base image to 2026.10.22-0 for CPython 3.15 (ray-project#67285) [Data] Make Mcap Data Column Test Insensitive to Struct Field Order (ray-project#68109) [Data] read_mcap V2: cut large files where their log-time order holds (ray-project#67166) [core][sandbox] Commit sandbox as new registry image (ray-project#67972) [Data] read_mcap V2: read neighbouring chunks in one ranged request (ray-project#67930) [train][4/n] Wire WorkerProbes through the HealthManager (ray-project#67915) [train][3/n] Add WorkerProbe results and health reports to the HealthState (ray-project#67879) [Data] (Data fault tolerance ray-project#6/6) Add a manual release test for lineage reconstruction (ray-project#67519) [train][6/n] Act on health decisions in the Ray Train controller (ray-project#67856) [Train] Do not start an elastic worker group with zero workers (ray-project#68101) [Train] Keep the last checkpoint after a metrics-only report in local mode (ray-project#68070) [Data][2/n] Migrate GPU Shuffle to Unified Phase Metrics (ray-project#67359) [Data][Chkpt] Fix `ArrowInvalid` when loading large generated-ID checkpoints (ray-project#68065) [core][test] Create auth token in test_redis_wrong_password (ray-project#68014) [data][actor-only][2/n] Actor-only backend: promote task pools to actor pools (ray-project#67698) [Data] Fix typing mismatches in Dataset public API (ray-project#62077) [Data] read_mcap V2: carry read tasks' summary records in the manifest (ray-project#67929) [Data] Distinguish generated ID collisions with synthesized columns (ray-project#67164) [Data] Fix incorrect scale-up in rate-based autoscaler for custom resources (ray-project#66647) [Data][Delta DSv2][1/7] Shared Parquet and partitioning fixes for the Delta reader (ray-project#67887) [Data] Eliminate redundant aggregation shuffle (ray-project#67198) [Data] Raise minimum supported pyarrow to 23.0.0 and test up to 26.0.1 (ray-project#68005) [Train] Use the default validation timeout when a report's ValidationTaskConfig has none (ray-project#68045) [doc][train] Use the global batch size in the TensorFlow Train examples (ray-project#68006) [TPU] Default multi-slice MASTER_ADDR to slice 0 host 0 in SlicePlacementGroup (ray-project#67878) [Data] Estimate a Parquet row group's decoded Arrow bytes from its footer [2/6] (ray-project#67837) [Data] Predicate pushdown through joins: split conjuncts, derive one-sided OR weakenings (ray-project#67122) [Data] Add partition_filters to read_delta and take file sizes from the log (ray-project#67900) [Data] Stop writing Unity Catalog vended credentials to the environment (ray-project#67899) [Data] Raise an error for Delta tables with column mapping in write_delta (ray-project#67898) [Core] Add initial foundational configurations and flags for fork server (ray-project#67356) [core][sandbox] Image layers caching (ray-project#67874) [Doc][Train] Add device stream batch prefetching section to accelerator guide (ray-project#67779) [Train] Use user-defined train function name in training thread name and error stack traces (ray-project#64292) [serve][docs] Remove beta label from custom autoscaling policies (ray-project#68046) [core] Don't treat a gRPC client with calls in flight as idle (ray-project#67718) [train] Fix checkpoint sorting to support nested metrics (ray-project#59130) [train][5/n] Run ControllerProbes on the controller's node monitor (ray-project#67671) [Train] Rank a checkpoint without the score attribute as worst in min order (ray-project#67901) [Core][RuntimeEnv] Stream runtime environment package downloads (ray-project#67184) [core] Deflake `_run_hanging_command` tests (ray-project#67461) [Data] Add Gravitino Iceberg REST catalog provider (ray-project#67007) [Data] Fix mixed-root partition filtering in Parquet and ORC V2 (ray-project#67067) [core] Keep absl logging at ERROR unless GRPC_VERBOSITY is set (ray-project#67719) [Data][1/n]Add Shuffle Metrics Unification Instrumentation (ray-project#66968) [ci][release] Stop publishing Python 3.10 wheels and images (ray-project#67722) [serve] Copy the ASGI lifespan state into each request scope (ray-project#67844) [Serve][LLM][4/5] Support scale-to-zero application routing (ray-project#67087) [core][sandbox] Let GPU sandboxes request NVIDIA profiling capabilities (ray-project#67974) [Serve][LLM] Exclude LLMRouter from dashboard QPS (ray-project#67873) [Data] Read the Parquet SizeStatistics PyArrow doesn't expose [1/6] (ray-project#67836) Add perf metrics for 2.60.0 (ray-project#67727) [Observability / Train] Add Grafana Annotation support with Ray Train usage (ray-project#66958) Signed-off-by: Eugene Paniot <[email protected]> # Conflicts: # python/ray/data/_internal/planner/plan_udf_map_op.py
Description
readonly=Trueis the default today, and it buys little. A read-only sandbox boots no faster than a writable one (27 ms both), and it's slower once it does anything: with an explicitworkdirit needs a kernel overlay and takes 87 ms to create, and Python's stdlib imports take 203 ms instead of 45 ms because nothing can cache.pycfiles. On a worker that can't mount a kernel overlay, a read-only sandbox with aworkdiralready ran writable, with a warning. The mode also needs special cases across the package, which keep complicating other sandbox PRs.This PR removes the option. Every sandbox writes to a private overlay over its cached image, which is discarded with the sandbox. That deletes:
workdirand the/tmptmpfs,needs_rootfs_overlayis hooks only now),_seed_mountpointsin the image build, since runsc creates mount points in the sandbox's overlay,workdirbranches indiskcapping (--overlay2 all:), checkpoint, and restore.About 600 lines net. Read
image_manager.pyandbackend/gvisor.pyfirst. Most of the rest is tests and docs.Behavior changes:
workdiris a plain directory in the overlay, and/tmpis on the root filesystem.readonly=Falsepassed tocreate(),restore(),Sandbox, orSandboxRuntimeis ignored with aRayDeprecationWarning, and the HTTP API ignoresreadonly: false, so callers that pass it keep working.readonly=Trueraises aValueError, and the HTTP API answers422, because ignoring it would hand the caller a writable sandbox.diskworks without aworkdir, and counts theworkdirtoo.workdirraises aValueError, or gets a422over HTTP, instead of failing when the container starts.readonly=Truesandbox, whose saved state depends on the read-only root. Checkpoints of writable sandboxes restore as before. Restore also refuses a differentworkdir, which runsc rejects anyway.disk, any sandbox can now fill the node's disk. A node-wide default cap is a follow-up.commit()from [core][sandbox] Commit sandbox as new registry image #67972 works on every sandbox, so its read-only check is gone. Its new layer leaves out the mount points runsc creates when the base image lacks them, such as an empty/etc/hosts.Related issues
None filed. This comes from review feedback that the read-only mode complicates other sandbox PRs.
Additional information
_seed_erofs_imagepass can go), [core][sandbox] Skip repeated work on each sandbox create #67076 (the fallback's warning), and [core][sandbox] Keep sandboxes booted with SandboxRuntime warm pools #67077 and [core][sandbox] Publish warm pools to a store so callers on any actor find ready sandboxes #67728 (readonlyin the warm-pool key). [core][sandbox] Commit sandbox as new registry image #67972 merged since, and the merge with master drops its read-only check. [core][sandbox] Modal Compatible Sandbox API Prototype #66782 and [core][sandbox] Modal Compatible Image API #67010 passreadonly=False, which still works.python:3.10-slim, medians of 10 rounds.diskwith and without aworkdir, the ignoredreadonly=Falseand the refusedreadonly=Truein Python and over HTTP, the refused read-only checkpoint, and an image with only/binand/lib, which boots with host mounts,/etc/hosts, and/etc/resolv.conf. I also booted that image from a kernel overlay with a hook, and as a non-root user.pytest python/ray/experimental/sandbox/tests: 651 passed, 39 skipped (no GPU,erofsfuse, or delegated cgroup there), 3 failed. The 3 are GPU and CDI tests that fail the same way on master in that container, whose Ray core predatesget_cdi_kind.pytest python/ray/experimental/sandbox/http/tests: 185 passed, 10 skipped. The skipped ones are the Modal SDK tests, which passed on the first commit with the SDK installed. pre-commit and the API param coverage lint pass.