Skip to content

[fix] metadata fetch blocking controller data-update notifications - #212

Open
HSYZhang wants to merge 2 commits into
Ascend:mainfrom
HSYZhang:main
Open

HSYZhang wants to merge 2 commits into
Ascend:mainfrom
HSYZhang:main

Conversation

@HSYZhang

Copy link
Copy Markdown

Problem

With polling_mode=False, a GET_META request for insufficient data waited inside the controller’s ZMQ request thread. That same thread handles NOTIFY_DATA_UPDATE, so a producer could write data but its notification could not be processed until the fetch stopped waiting. The default 5-second check interval could also exceed the 1-second metadata timeout.

Changes

  • Make ZMQ GET_META return an empty batch with a retry signal when data is insufficient, keeping the controller request thread available for data-update notifications.
  • Move the wait and retry loop to async_get_meta(). Each attempt releases its controller socket before sleeping, and retries stop at a monotonic deadline.
  • Preserve immediate empty responses in polling mode and the existing waiting behavior for direct Ray calls to get_metadata().
  • Document the fetch behavior and add regression tests for a waiting reader alongside a producer, timeout handling, and polling mode.

Validation

  • bash scripts/test_controller_fetch_progress.sh — targeted regression tests passed.
  • Additional client, controller, sampler, storage, and SimpleStorage lifecycle tests passed during development.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T07:35:31.078585Z 841bacc 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.

@HSYZhang HSYZhang changed the title Fix metadata fetch blocking controller data-update notifications [fix] metadata fetch blocking controller data-update notifications Nov 10, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 841bacce21

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread transfer_queue/client.py Outdated
f"Timeout while waiting for sufficient data for task {task_name}. "
f"Required: {batch_size}, partition: {partition_id}, fields: {data_fields}"
)
await asyncio.sleep(min(retry_interval, remaining))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Check the deadline before the next metadata request

When no data arrives, this sleep can consume all of remaining, but the loop then sends another controller request before checking the deadline again. If the controller is slow or becomes unreachable during that extra poll, get_meta can block for the controller RPC timeout (TQ_CONTROLLER_SEND_RECV_TIMEOUT, 200 seconds by default) even though the metadata timeout has already expired; check the deadline at the top of the loop or raise after a sleep that reaches it.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done — I’ve made the changes.

Comment thread transfer_queue/client.py Outdated
"sampling_config": sampling_config,
}
deadline = time.monotonic() + TQ_CONTROLLER_GET_METADATA_TIMEOUT
retry_interval = min(TQ_CONTROLLER_GET_METADATA_CHECK_INTERVAL, TQ_CONTROLLER_GET_METADATA_TIMEOUT / 4)

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.

What is "/ 4" for?

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.

I suggest we use TQ_CONTROLLER_GET_METADATA_CHECK_INTERVAL directly as the retry interval to make it clearer. Users can set up the check interval and timeout to enable retrying, as the default may disable it..

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Understood, I’ve updated the implementation to follow this design.

Comment thread README.md Outdated
#### Low-Level Native API

The native interfaces of TransferQueue are implemented in `TransferQueueClient`. It offers maximum flexibility through native, atomic operations.
For `get_meta(mode="fetch")`, the client retries until `TQ_CONTROLLER_GET_METADATA_TIMEOUT`

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.

Maybe we don't need to add these doc lines

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

OK, I’ll revise it.

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.

2 participants