Repository navigation
Conversation
|
Companion PR for the Ray Data half of the same incident (one engine-boot failure killing an entire Dataset job): #64846. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 5412c2b. Configure here.
There was a problem hiding this comment.
Code Review
This pull request introduces inline dispatching for trivial, thread-safe gRPC service handlers (such as GetClusterId) to run directly on the gRPC polling threads, bypassing the main single-threaded io_context queue to prevent delays during high-load events. It also updates GcsClient::FetchClusterId to split the connection timeout budget into bounded per-attempt deadlines. The review feedback highlights two important issues: first, potential RPC storms or silent failures in FetchClusterId if the timeout is misconfigured or set to zero; second, a potential use-after-free or crash during server shutdown because inline dispatch bypasses the io_service_ stop check.
| if (timeout_ms < 0) { | ||
| // Defensive: Connect() already normalizes a negative timeout. | ||
| timeout_ms = RayConfig::instance().gcs_rpc_server_connect_timeout_s() * 1000; | ||
| } | ||
| // Split the overall budget into bounded per-attempt deadlines and retry on | ||
| // TimedOut. DEADLINE_EXCEEDED is deliberately not retried by | ||
| // RetryableGrpcClient (it feeds an unbounded retry queue), so without this | ||
| // loop a single deadline spent queueing on a busy GCS is fatal to the whole | ||
| // connect. Attempt counting keeps the total at ~timeout_ms without reading | ||
| // any clock. | ||
| const int64_t per_attempt_ms = std::max<int64_t>( | ||
| 1, | ||
| std::min<int64_t>(RayConfig::instance().gcs_rpc_server_connect_timeout_s() * 1000, | ||
| timeout_ms)); | ||
| const int64_t num_attempts = (timeout_ms + per_attempt_ms - 1) / per_attempt_ms; |
There was a problem hiding this comment.
There are two potential issues with the current attempt/timeout calculation:
- RPC Storm / High CPU on Misconfiguration: If
gcs_rpc_server_connect_timeout_sis configured to0(or a very small value),per_attempt_mswill be evaluated as1. Iftimeout_msis large (e.g.,30000),num_attemptswill be30000. This results in a tight loop of 30,000 attempts, flooding the GCS server with RPCs and consuming 100% CPU. - Silent Failure on Zero Timeout: If
timeout_msis0,num_attemptswill be0. The loop will be skipped entirely, and the function will returnStatus::OK()without actually fetching the cluster ID, leaving itNil.
To prevent these issues, we should defensively normalize timeout_ms and enforce a reasonable minimum for per_attempt_ms (e.g., 1000ms) to avoid tight-loop RPC storms, while ensuring num_attempts is at least 1.
int64_t config_timeout_ms = RayConfig::instance().gcs_rpc_server_connect_timeout_s() * 1000;
if (config_timeout_ms <= 0) {
config_timeout_ms = 5000;
}
if (timeout_ms <= 0) {
timeout_ms = config_timeout_ms;
}
// Split the overall budget into bounded per-attempt deadlines and retry on
// TimedOut. DEADLINE_EXCEEDED is deliberately not retried by
// RetryableGrpcClient (it feeds an unbounded retry queue), so without this
// loop a single deadline spent queueing on a busy GCS is fatal to the whole
// connect. Attempt counting keeps the total at ~timeout_ms without reading
// any clock.
const int64_t per_attempt_ms = std::max<int64_t>(
1000,
std::min<int64_t>(config_timeout_ms, timeout_ms));
const int64_t num_attempts = std::max<int64_t>(1, (timeout_ms + per_attempt_ms - 1) / per_attempt_ms);| if constexpr (DispatchPolicy == ServerCallDispatchPolicy::kInline) { | ||
| static_assert(!std::is_base_of_v<DelayedServiceHandler, ServiceHandler>, | ||
| "Inline dispatch would block a gRPC polling thread until the " | ||
| "service handler finishes initializing; use kPosted instead."); | ||
| // Run the handler inline on the gRPC polling thread, skipping the | ||
| // io_context so this call cannot queue behind unrelated work. The | ||
| // handler must be non-blocking, O(1), and thread-safe (it may run | ||
| // concurrently on every polling thread). RAY_testing_asio_delay_us does | ||
| // not apply to inline methods: there is no post to delay. | ||
| HandleRequestImpl(auth_success, token_auth_failed, cluster_id_auth_failed); | ||
| } else if (!io_service_.stopped()) { |
There was a problem hiding this comment.
During server shutdown, io_service_ is stopped, which prevents new posted handlers from executing. However, because inline dispatch bypasses the io_service_ post queue, an inline handler could still execute HandleRequestImpl even if io_service_.stopped() is true. This can lead to use-after-free bugs or crashes if the underlying service handler (e.g., GcsNodeManager) is already being destroyed.
We should check !io_service_.stopped() before executing the inline handler to ensure safe shutdown behavior.
if constexpr (DispatchPolicy == ServerCallDispatchPolicy::kInline) {
static_assert(!std::is_base_of_v<DelayedServiceHandler, ServiceHandler>,
"Inline dispatch would block a gRPC polling thread until the "
"service handler finishes initializing; use kPosted instead.");
// Run the handler inline on the gRPC polling thread, skipping the
// io_context so this call cannot queue behind unrelated work. The
// handler must be non-blocking, O(1), and thread-safe (it may run
// concurrently on every polling thread). RAY_testing_asio_delay_us does
// not apply to inline methods: there is no post to delay.
if (!io_service_.stopped()) {
HandleRequestImpl(auth_success, token_auth_failed, cluster_id_auth_failed);
}
} else if (!io_service_.stopped()) {5412c2b to
57b768e
Compare
|
Split per review preference: this PR now carries only the server-side inline-dispatch change; the client-side bounded connect retry moved to its own independently mergeable PR: #64847. The retry PR also hardens the attempt math against zero/negative timeout configs (no silent-OK skip, no 1 ms-attempt RPC storm), with regression tests. |
…ight-reads io_context GetClusterId is a lock-free read of an immutable value, but its handler is posted to the single-threaded node_manager_io_context shared with RegisterNode/GetAllNodeInfo/CheckAlive. During mass node registration the loop's queue delay exceeds client deadlines, and DEADLINE_EXCEEDED maps to TimedOut which IsGrpcRetryableStatus deliberately never retries — so every connecting process's cluster-ID fetch dies on a constant-value read (observed as cluster bring-up collapse at 400 nodes). Fix by isolation on an existing axis instead of new dispatch machinery: add a dedicated lightweight_rpc_reads_io_context to GcsServerIOContextPolicy (the GCS's existing mechanism for isolating workloads), and a RPC_SERVICE_HANDLER_CUSTOM_AUTH_IN_IO_CONTEXT macro variant that posts one handler to an explicit io_context (_RPC_SERVICE_HANDLER now delegates with the service's main_service_). GetClusterId is the only opt-in; CheckAlive, which is starved by the same storms, can follow. A slow handler on the dedicated loop hurts only itself — unlike inline dispatch on the gRPC polling thread, which ray-project#55904 tried wholesale and ray-project#59448 reverted for a 2x plasma-put regression. Tests: an rpc-layer test proving a handler bound to a dedicated io_context replies while the service's io_context never runs, and a GCS-layer regression test that blocks the node_manager io_context and asserts a 2s-deadline SyncGetClusterId still succeeds (fails pre-fix). Signed-off-by: xyuzh <[email protected]>
57b768e to
d437c45
Compare
|
Reworked per design review: replaced the inline-dispatch template machinery with a dedicated |
…DataContext.max_consecutive_actor_init_deaths (#64846) ## Why are these changes needed? A single actor whose `__init__` fails (e.g. an LLM engine failing to boot) kills the whole Dataset job: the readiness ref resolves with `ActorDiedError`, `_ActorPool.pending_to_running` re-raises it, and the metadata-task branch of `process_completed_tasks` has no guard (`max_errored_blocks` only protects the `DataOpTask` branch), so the exception fails the execution. `max_restarts=-1` (Ray Data's own default) cannot help because Ray Core does not restart actors whose creation task failed — the death is a `USER_ERROR` and `gcs_actor_manager` zeroes `remaining_restarts`. At an N-actor pool, any per-boot flake probability p becomes job-death probability 1-(1-p)^N: at 1,600 vLLM engines, three separate boot-flake classes (port races, VRAM residue, ramp-wave timeouts) each repeatedly killed full production runs. This PR catches the failure at the pool boundary (`_task_done_callback`) and charges it against a new per-operator budget, `DataContext.max_consecutive_actor_init_deaths` (env `RAY_DATA_MAX_CONSECUTIVE_ACTOR_INIT_DEATHS`; default `0` preserves today's fail-fast behavior; `-1` = unlimited). The counter is **consecutive**: it resets whenever any actor of the operator initializes successfully — the same semantics as the existing `actor_init_max_retries`. Sporadic boot flakes in a progressing pipeline are tolerated indefinitely within the budget, while a systemically broken UDF (bad model path) never resets the counter and exhausts the budget, so no separate systemic-failure heuristic or hardcoded threshold is needed. Tolerated failures are logged with a running count and the actor autoscaler starts a replacement (the pool is below target size, and the below-min branch runs before the no-input guard, so no explicit re-provision is needed). Counting is per actor incarnation, after any in-actor `actor_init_retry_on_errors` retries. ## Production-scale evidence Two byte-identical 1,600-engine / 70M-caption video-captioning runs on Anyscale (CoreWeave, RTX PRO 6000 fleet), same input corpus and knobs; the only variable is boot-failure handling (run against the earlier cumulative-budget revision of this patch; the consecutive-counting revision is strictly more permissive for the interleaved-flake pattern observed): | | Baseline (app-level workaround that swallows pending_to_running errors) | This patch (workaround disabled, budget=200) | |---|---|---| | Outcome | SUCCEEDED | SUCCEEDED | | Captions written | 69,982,028 | 69,982,028 (identical) | | Wall time | 5,525 s | 5,778 s | | Real engine-boot failures absorbed | 2 | 8 (single ramp-wave burst; every one logged and the pool recovered to its full 1,500 floor) | A separate fault-injection job validated both semantics deterministically on the same stack: 3 injected creation-task failures with budget 5 → dataset completes with correct output; budget 1 → tolerates one, then re-raises the original `ActorDiedError` after exactly 2 incarnations. Companion PR for the GCS-side half of the same incident: #64845. ## Related issue number None found — searched open PRs/issues for actor init/boot failure tolerance before opening; no in-flight work. Adjacent context: the vLLM batch stage's `os._exit(1)` workaround handles post-boot engine death via `max_restarts` (see #59522), but nothing covers creation-task failures. ## Checks - [x] I've signed off every commit (DCO). - [x] I've run pre-commit on the changed files. - [x] Testing strategy: - New tests in `python/ray/data/tests/test_actor_pool_map_operator.py`: `test_actor_init_death_budget` (parametrized: budget covers / exceeded / unlimited), `test_actor_init_death_budget_with_in_actor_retries` (proves incarnation-level counting), `test_on_actor_init_death_unit` (raise timing against the consecutive budget, reset-on-success, re-raise identity). - `python -m pytest python/ray/data/tests/test_actor_pool_map_operator.py -k "init_death or init_failure"` → 8 passed (pytest 7.4.4). Existing `test_actor_init_failure_retry` and `test_actor_pool_map_operator_init` pass unchanged. Per the repo's AI contribution policy: AI assistance was used to develop this change; every changed line was reviewed, the tests above were run locally, and the change was exercised end-to-end at production scale as described. --------- Signed-off-by: xyuzh <[email protected]>
…DataContext.max_consecutive_actor_init_deaths (ray-project#64846) ## Why are these changes needed? A single actor whose `__init__` fails (e.g. an LLM engine failing to boot) kills the whole Dataset job: the readiness ref resolves with `ActorDiedError`, `_ActorPool.pending_to_running` re-raises it, and the metadata-task branch of `process_completed_tasks` has no guard (`max_errored_blocks` only protects the `DataOpTask` branch), so the exception fails the execution. `max_restarts=-1` (Ray Data's own default) cannot help because Ray Core does not restart actors whose creation task failed — the death is a `USER_ERROR` and `gcs_actor_manager` zeroes `remaining_restarts`. At an N-actor pool, any per-boot flake probability p becomes job-death probability 1-(1-p)^N: at 1,600 vLLM engines, three separate boot-flake classes (port races, VRAM residue, ramp-wave timeouts) each repeatedly killed full production runs. This PR catches the failure at the pool boundary (`_task_done_callback`) and charges it against a new per-operator budget, `DataContext.max_consecutive_actor_init_deaths` (env `RAY_DATA_MAX_CONSECUTIVE_ACTOR_INIT_DEATHS`; default `0` preserves today's fail-fast behavior; `-1` = unlimited). The counter is **consecutive**: it resets whenever any actor of the operator initializes successfully — the same semantics as the existing `actor_init_max_retries`. Sporadic boot flakes in a progressing pipeline are tolerated indefinitely within the budget, while a systemically broken UDF (bad model path) never resets the counter and exhausts the budget, so no separate systemic-failure heuristic or hardcoded threshold is needed. Tolerated failures are logged with a running count and the actor autoscaler starts a replacement (the pool is below target size, and the below-min branch runs before the no-input guard, so no explicit re-provision is needed). Counting is per actor incarnation, after any in-actor `actor_init_retry_on_errors` retries. ## Production-scale evidence Two byte-identical 1,600-engine / 70M-caption video-captioning runs on Anyscale (CoreWeave, RTX PRO 6000 fleet), same input corpus and knobs; the only variable is boot-failure handling (run against the earlier cumulative-budget revision of this patch; the consecutive-counting revision is strictly more permissive for the interleaved-flake pattern observed): | | Baseline (app-level workaround that swallows pending_to_running errors) | This patch (workaround disabled, budget=200) | |---|---|---| | Outcome | SUCCEEDED | SUCCEEDED | | Captions written | 69,982,028 | 69,982,028 (identical) | | Wall time | 5,525 s | 5,778 s | | Real engine-boot failures absorbed | 2 | 8 (single ramp-wave burst; every one logged and the pool recovered to its full 1,500 floor) | A separate fault-injection job validated both semantics deterministically on the same stack: 3 injected creation-task failures with budget 5 → dataset completes with correct output; budget 1 → tolerates one, then re-raises the original `ActorDiedError` after exactly 2 incarnations. Companion PR for the GCS-side half of the same incident: ray-project#64845. ## Related issue number None found — searched open PRs/issues for actor init/boot failure tolerance before opening; no in-flight work. Adjacent context: the vLLM batch stage's `os._exit(1)` workaround handles post-boot engine death via `max_restarts` (see ray-project#59522), but nothing covers creation-task failures. ## Checks - [x] I've signed off every commit (DCO). - [x] I've run pre-commit on the changed files. - [x] Testing strategy: - New tests in `python/ray/data/tests/test_actor_pool_map_operator.py`: `test_actor_init_death_budget` (parametrized: budget covers / exceeded / unlimited), `test_actor_init_death_budget_with_in_actor_retries` (proves incarnation-level counting), `test_on_actor_init_death_unit` (raise timing against the consecutive budget, reset-on-success, re-raise identity). - `python -m pytest python/ray/data/tests/test_actor_pool_map_operator.py -k "init_death or init_failure"` → 8 passed (pytest 7.4.4). Existing `test_actor_init_failure_retry` and `test_actor_pool_map_operator_init` pass unchanged. Per the repo's AI contribution policy: AI assistance was used to develop this change; every changed line was reviewed, the tests above were run locally, and the change was exercised end-to-end at production scale as described. --------- Signed-off-by: xyuzh <[email protected]>
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
…DataContext.max_consecutive_actor_init_deaths (ray-project#64846) ## Why are these changes needed? A single actor whose `__init__` fails (e.g. an LLM engine failing to boot) kills the whole Dataset job: the readiness ref resolves with `ActorDiedError`, `_ActorPool.pending_to_running` re-raises it, and the metadata-task branch of `process_completed_tasks` has no guard (`max_errored_blocks` only protects the `DataOpTask` branch), so the exception fails the execution. `max_restarts=-1` (Ray Data's own default) cannot help because Ray Core does not restart actors whose creation task failed — the death is a `USER_ERROR` and `gcs_actor_manager` zeroes `remaining_restarts`. At an N-actor pool, any per-boot flake probability p becomes job-death probability 1-(1-p)^N: at 1,600 vLLM engines, three separate boot-flake classes (port races, VRAM residue, ramp-wave timeouts) each repeatedly killed full production runs. This PR catches the failure at the pool boundary (`_task_done_callback`) and charges it against a new per-operator budget, `DataContext.max_consecutive_actor_init_deaths` (env `RAY_DATA_MAX_CONSECUTIVE_ACTOR_INIT_DEATHS`; default `0` preserves today's fail-fast behavior; `-1` = unlimited). The counter is **consecutive**: it resets whenever any actor of the operator initializes successfully — the same semantics as the existing `actor_init_max_retries`. Sporadic boot flakes in a progressing pipeline are tolerated indefinitely within the budget, while a systemically broken UDF (bad model path) never resets the counter and exhausts the budget, so no separate systemic-failure heuristic or hardcoded threshold is needed. Tolerated failures are logged with a running count and the actor autoscaler starts a replacement (the pool is below target size, and the below-min branch runs before the no-input guard, so no explicit re-provision is needed). Counting is per actor incarnation, after any in-actor `actor_init_retry_on_errors` retries. ## Production-scale evidence Two byte-identical 1,600-engine / 70M-caption video-captioning runs on Anyscale (CoreWeave, RTX PRO 6000 fleet), same input corpus and knobs; the only variable is boot-failure handling (run against the earlier cumulative-budget revision of this patch; the consecutive-counting revision is strictly more permissive for the interleaved-flake pattern observed): | | Baseline (app-level workaround that swallows pending_to_running errors) | This patch (workaround disabled, budget=200) | |---|---|---| | Outcome | SUCCEEDED | SUCCEEDED | | Captions written | 69,982,028 | 69,982,028 (identical) | | Wall time | 5,525 s | 5,778 s | | Real engine-boot failures absorbed | 2 | 8 (single ramp-wave burst; every one logged and the pool recovered to its full 1,500 floor) | A separate fault-injection job validated both semantics deterministically on the same stack: 3 injected creation-task failures with budget 5 → dataset completes with correct output; budget 1 → tolerates one, then re-raises the original `ActorDiedError` after exactly 2 incarnations. Companion PR for the GCS-side half of the same incident: ray-project#64845. ## Related issue number None found — searched open PRs/issues for actor init/boot failure tolerance before opening; no in-flight work. Adjacent context: the vLLM batch stage's `os._exit(1)` workaround handles post-boot engine death via `max_restarts` (see ray-project#59522), but nothing covers creation-task failures. ## Checks - [x] I've signed off every commit (DCO). - [x] I've run pre-commit on the changed files. - [x] Testing strategy: - New tests in `python/ray/data/tests/test_actor_pool_map_operator.py`: `test_actor_init_death_budget` (parametrized: budget covers / exceeded / unlimited), `test_actor_init_death_budget_with_in_actor_retries` (proves incarnation-level counting), `test_on_actor_init_death_unit` (raise timing against the consecutive budget, reset-on-success, re-raise identity). - `python -m pytest python/ray/data/tests/test_actor_pool_map_operator.py -k "init_death or init_failure"` → 8 passed (pytest 7.4.4). Existing `test_actor_init_failure_retry` and `test_actor_pool_map_operator_init` pass unchanged. Per the repo's AI contribution policy: AI assistance was used to develop this change; every changed line was reviewed, the tests above were run locally, and the change was exercised end-to-end at production scale as described. --------- Signed-off-by: xyuzh <[email protected]> Signed-off-by: 400Ping <[email protected]>
|
This pull request has been automatically closed because there has been no more activity in the 14 days Please feel free to reopen or open a new pull request if you'd still like this to be addressed. Again, you can always ask for help on our discussion forum or Ray's public slack channel. Thanks again for your contribution! |
…DataContext.max_consecutive_actor_init_deaths (ray-project#64846) ## Why are these changes needed? A single actor whose `__init__` fails (e.g. an LLM engine failing to boot) kills the whole Dataset job: the readiness ref resolves with `ActorDiedError`, `_ActorPool.pending_to_running` re-raises it, and the metadata-task branch of `process_completed_tasks` has no guard (`max_errored_blocks` only protects the `DataOpTask` branch), so the exception fails the execution. `max_restarts=-1` (Ray Data's own default) cannot help because Ray Core does not restart actors whose creation task failed — the death is a `USER_ERROR` and `gcs_actor_manager` zeroes `remaining_restarts`. At an N-actor pool, any per-boot flake probability p becomes job-death probability 1-(1-p)^N: at 1,600 vLLM engines, three separate boot-flake classes (port races, VRAM residue, ramp-wave timeouts) each repeatedly killed full production runs. This PR catches the failure at the pool boundary (`_task_done_callback`) and charges it against a new per-operator budget, `DataContext.max_consecutive_actor_init_deaths` (env `RAY_DATA_MAX_CONSECUTIVE_ACTOR_INIT_DEATHS`; default `0` preserves today's fail-fast behavior; `-1` = unlimited). The counter is **consecutive**: it resets whenever any actor of the operator initializes successfully — the same semantics as the existing `actor_init_max_retries`. Sporadic boot flakes in a progressing pipeline are tolerated indefinitely within the budget, while a systemically broken UDF (bad model path) never resets the counter and exhausts the budget, so no separate systemic-failure heuristic or hardcoded threshold is needed. Tolerated failures are logged with a running count and the actor autoscaler starts a replacement (the pool is below target size, and the below-min branch runs before the no-input guard, so no explicit re-provision is needed). Counting is per actor incarnation, after any in-actor `actor_init_retry_on_errors` retries. ## Production-scale evidence Two byte-identical 1,600-engine / 70M-caption video-captioning runs on Anyscale (CoreWeave, RTX PRO 6000 fleet), same input corpus and knobs; the only variable is boot-failure handling (run against the earlier cumulative-budget revision of this patch; the consecutive-counting revision is strictly more permissive for the interleaved-flake pattern observed): | | Baseline (app-level workaround that swallows pending_to_running errors) | This patch (workaround disabled, budget=200) | |---|---|---| | Outcome | SUCCEEDED | SUCCEEDED | | Captions written | 69,982,028 | 69,982,028 (identical) | | Wall time | 5,525 s | 5,778 s | | Real engine-boot failures absorbed | 2 | 8 (single ramp-wave burst; every one logged and the pool recovered to its full 1,500 floor) | A separate fault-injection job validated both semantics deterministically on the same stack: 3 injected creation-task failures with budget 5 → dataset completes with correct output; budget 1 → tolerates one, then re-raises the original `ActorDiedError` after exactly 2 incarnations. Companion PR for the GCS-side half of the same incident: ray-project#64845. ## Related issue number None found — searched open PRs/issues for actor init/boot failure tolerance before opening; no in-flight work. Adjacent context: the vLLM batch stage's `os._exit(1)` workaround handles post-boot engine death via `max_restarts` (see ray-project#59522), but nothing covers creation-task failures. ## Checks - [x] I've signed off every commit (DCO). - [x] I've run pre-commit on the changed files. - [x] Testing strategy: - New tests in `python/ray/data/tests/test_actor_pool_map_operator.py`: `test_actor_init_death_budget` (parametrized: budget covers / exceeded / unlimited), `test_actor_init_death_budget_with_in_actor_retries` (proves incarnation-level counting), `test_on_actor_init_death_unit` (raise timing against the consecutive budget, reset-on-success, re-raise identity). - `python -m pytest python/ray/data/tests/test_actor_pool_map_operator.py -k "init_death or init_failure"` → 8 passed (pytest 7.4.4). Existing `test_actor_init_failure_retry` and `test_actor_pool_map_operator_init` pass unchanged. Per the repo's AI contribution policy: AI assistance was used to develop this change; every changed line was reviewed, the tests above were run locally, and the change was exercised end-to-end at production scale as described. --------- Signed-off-by: xyuzh <[email protected]>

Why are these changes needed?
GetClusterIdis a lock-free read of an immutable value (gcs_node_manager.cc), but its handler is posted to the single-threadednode_manager_io_contextshared withRegisterNode,GetAllNodeInfo,CheckAlive, etc. During mass node registration the loop's queue delay exceeds client deadlines, andDEADLINE_EXCEEDEDmaps toTimedOutwhichIsGrpcRetryableStatusdeliberately never retries — so every connecting process's cluster-ID fetch dies on a constant-value read:We hit this as a full cluster bring-up collapse at 400 nodes (~60k potential worker processes) on Ray 2.56.
gcs_server_rpc_server_thread_numcannot help (it only sizes completion-queue polling threads, which never run handlers).Fix: isolate on an existing axis instead of adding dispatch machinery. The GCS already isolates workloads with dedicated io_contexts (
GcsServerIOContextPolicy). This PR adds alightweight_rpc_reads_io_contextentry there, plus a smallRPC_SERVICE_HANDLER_CUSTOM_AUTH_IN_IO_CONTEXTmacro variant that posts one handler to an explicit io_context (_RPC_SERVICE_HANDLERnow delegates with the service'smain_service_, so all other handlers are unchanged).GetClusterIdis the only opt-in;CheckAlive— which is starved by the same storms and causes false node-death — can follow in a later PR.An earlier revision of this PR ran the handler inline on the gRPC polling thread. That worked, but it created a new hazard class: any future inline handler that gets slow stalls completion-queue polling for the whole server — exactly the failure mode of #55904, reverted in #59448. A dedicated io_context gets identical starvation immunity while a slow handler hurts only itself, and it reuses the GCS's existing isolation pattern (~10-line server diff instead of a new template axis through
ServerCallImpl).The new io_context is lag-probed and health-check-critical (it sits on every client's
Connect()path).Companion PR (client-side half, independently mergeable/revertable): #64847.
Related issue number
None found — searched open PRs/issues for GetClusterId / io_context starvation before opening (closest, orthogonal: #64422 GCS passive-mode refactor). Not a duplicate of in-flight work.
Checks
//src/ray/rpc/tests:grpc_server_client_testcaseDedicatedIoContextHandlerRepliesWhileServiceIoContextNeverRuns: the service's main io_context is never run; only a handler posted to the dedicated io_context can reply.//src/ray/gcs/tests:gcs_server_rpc_testcaseGetClusterIdNotDelayedByNodeManagerIoContextBacklog: blocks the node_manager io_context with a task that waits until released and asserts a 2s-deadlineSyncGetClusterIdstill succeeds (fails with DEADLINE_EXCEEDED pre-fix).--dynamic_mode=off): both targets pass.Per the repo's AI contribution policy: AI assistance was used to develop this change; every changed line was reviewed and the tests above were run locally.