Skip to content

[fix] Fail fast when SimpleStorage lacks Ray CPU capacity - #165

Open
0xAstraZhang wants to merge 2 commits into
Ascend:mainfrom
0xAstraZhang:simple-storage-startup-timeout
Open

[fix] Fail fast when SimpleStorage lacks Ray CPU capacity#165
0xAstraZhang wants to merge 2 commits into
Ascend:mainfrom
0xAstraZhang:simple-storage-startup-timeout

Conversation

@0xAstraZhang

@0xAstraZhang 0xAstraZhang commented Sep 3, 2026

Copy link
Copy Markdown

Closes #164

What does this PR do?

This PR prevents SimpleStorage startup deadlocks by timing out on insufficient Ray CPU resources, reporting an actionable error, and cleaning up partial initialization so users can retry safely.

Motivation

Related to verl-project/verl#7656.

According to the report, due to the absence of an exception for exceeding the timeout limit, when the number of CPU cores required by the TransferQueue at a certain node is greater than the actual number of available CPU cores, the process will be indefinitely suspended.

The older TransferQueue version in the report hangs on placement_group.ready(). Current TransferQueue main uses hard node affinity instead, but retains the same user-visible failure: an unscheduled SimpleStorageUnit waits indefinitely, while process_zmq_server_info() blocks in ray.get() without a timeout.

TransferQueue must still handle an explicitly configured but unschedulable storage-unit count without hanging.

Modification

  • Add a 60-second timeout while waiting for SimpleStorage units to return their ZMQ server information.
  • On timeout, terminate every created or pending SimpleStorageUnit.
  • Raise an actionable error containing:
    • backend.SimpleStorage.num_data_storage_units
    • required Ray CPU capacity
    • available Ray CPU capacity observed before startup
    • the exact parameter users can reduce
  • Roll back the controller and process-local TransferQueue state when storage initialization fails.

Compatibility

  • No configuration defaults are changed.
  • No public storage or client behavior is changed.
  • No automatic scaling is introduced.
  • Successful initialization follows the existing path unchanged.

Test

  • python -m compileall -q transfer_queue tutorial tests
  • pytest -q tests/test_simple_storage_scheduling.py
    • 8 passed
  • Ruff check and format check passed.
  • Live Ray regression with 2 CPUs:
    • 2 storage units fail with the actionable timeout error.
    • Retrying in the same Ray session with 1 storage unit succeeds.
  • Full local suite:
    • 584 passed, 10 skipped.
    • 8 Yuanrong tests could not be set up because openyuanrong-datasystem is unavailable in the local macOS environment; upstream CI installs the yuanrong extra on Ubuntu.

Signed-off-by: Astra Zhang <zhangyv7412@gmail.com>
Copilot AI lite review requested due to automatic review settings September 3, 2026 15:51
@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@0xAstraZhang , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
[a2a5f1c [fix] Fail fast when SimpleStor...](a2a5f1c) the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-03T15:54:21.956775Z a2a5f1c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A few issues could undermine the “fail fast” goal and error reporting reliability (per-handler timeout scaling, timeout cleanup masking errors, and potentially confusing CPU-capacity messaging).

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR adds a bounded startup path for the SimpleStorage backend so TransferQueue doesn’t hang indefinitely when requested SimpleStorageUnit actors cannot be scheduled due to insufficient Ray CPU capacity. It introduces a timeout while retrieving ZMQ server info, cleans up partially created actors on failure, and rolls back controller/process state so users can retry safely.

Changes:

  • Add an optional timeout to process_zmq_server_info() and propagate it to ray.get(...).
  • In SimpleStorage bootstrap, record available CPU capacity, enforce a 60s startup timeout, kill created units on timeout, and raise an actionable error.
  • In transfer_queue.interface.init(), roll back controller/storage state via close() if storage initialization fails; add tests for timeout cleanup and rollback.
File summaries
File Description
transfer_queue/utils/zmq_utils.py Adds a timeout parameter to ZMQ server-info retrieval.
transfer_queue/storage/bootstrap/simple_storage_bootstrap.py Enforces a startup timeout for SimpleStorage and reports actionable CPU-capacity errors with cleanup.
transfer_queue/interface.py Ensures init() rolls back controller state when storage initialization fails.
tests/test_simple_storage_scheduling.py Adds coverage for timeout cleanup/error messaging and init() rollback behavior.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +67 to +68
for storage_node in simple_storage_handles.values():
ray.kill(storage_node)
Comment on lines 456 to +460
else:
server_info = {}
for name, handler in handlers.items():
server_info[name] = ray.get(handler.get_zmq_server_info.remote()) # type: ignore[union-attr, attr-defined]
server_info[name] = ray.get( # type: ignore[union-attr, attr-defined]
handler.get_zmq_server_info.remote(), timeout=timeout
Comment on lines +73 to +75
f"Ray CPU capacity of {num_data_storage_units}, but Ray reported "
f"available CPU capacity of {available_cpus:g} "
"before startup. "
Args:
handlers: Dictionary of handler objects (controllers, storage managers or storage units),
or a single handler object
timeout: Maximum seconds to wait for each handler to return its server information.
Suggested by Copilot

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@0xAstraZhang , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
9ac58292 Add exception handling for ray.k... the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@0xAstraZhang
0xAstraZhang requested a balanced review from Copilot September 3, 2026 16:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] SimpleStorage startup hangs when Ray CPU capacity is insufficient

3 participants