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.

@HSYZhang
HSYZhang requested a review from dodatboii November 13, 2026 02:36
Signed-off-by: HSYZhang <2908064130@qq.com>
Signed-off-by: HSYZhang <2908064130@qq.com>
@0oshowero0

Copy link
Copy Markdown
Collaborator

I'm considering directly remove the blocking logic in controller and use client to choose whether to blocking and wait for the data. I will do the refactor first, please rebase then and only focus on the client side.

@0oshowero0

Copy link
Copy Markdown
Collaborator

#217 For your info~ @HSYZhang

@HSYZhang

Copy link
Copy Markdown
Author

#217 For your info~ @HSYZhang

Got it, I'll base my work on your PR and follow the client-side updates

0oshowero0 added a commit that referenced this pull request Nov 13, 2026
…217)

## Motivation

`GET_META` and `NOTIFY_DATA_UPDATE` share the controller’s ZMQ request
loop. When a fetch waits for samples, it delays the producer
notifications that would mark those samples as ready.

## Changes

- Check sample readiness once per fetch and reuse cached sampling
results when available.
- Remove `polling_mode` from default configs, tutorials, recipes,
benchmarks, and E2E fixtures.

## Breaking change

With the previous default `polling_mode=False`, `get_meta()` and
`async_get_meta()` waited for a batch and raised an error on timeout.
They now return an empty `BatchMeta` immediately when no batch is
available.

Callers that relied on waiting should check `metadata.size == 0` and
retry before calling `get_data()`. `StreamingDataset` already handles
empty batches and retries. Client-side waiting and automatic retries
will be implemented in a follow-up.
#212

Remove `controller.polling_mode` from configs and `polling_mode` from
controller constructor calls. Both are accepted and ignored in this
release, emit a `FutureWarning` when supplied, and will be removed in
the next release.

## Validation

Compilation, Ruff, and 313 targeted tests passed. The full suite stopped
during Ray startup due to local permission restrictions.

---------

Signed-off-by: 0oshowero0 <o0showero0@outlook.com>
Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
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.

3 participants