Skip to content

[data] Tolerate actor deaths during init in ActorPoolMapOperator via DataContext.max_consecutive_actor_init_deaths - #64846

Merged
goutamvenkat-anyscale merged 7 commits into
ray-project:masterfrom
xyuzh:data-actor-init-failure-budget
Aug 3, 2026
Merged

goutamvenkat-anyscale merged 7 commits into
ray-project:masterfrom
xyuzh:data-actor-init-failure-budget

Conversation

@xyuzh

@xyuzh xyuzh commented Jul 17, 2026 •

Copy link
Copy Markdown
Member

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

  • I've signed off every commit (DCO).
  • I've run pre-commit on the changed files.
  • 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.

…ontext.max_actor_init_failures

A single actor whose __init__ fails (e.g. an LLM engine failing to boot)
currently kills the whole Dataset job: the readiness ref resolves with
ActorDiedError, _ActorPool.pending_to_running re-raises it, and the
unguarded metadata-task path propagates it out of the streaming executor.
max_restarts=-1 does not help because Ray Core does not restart actors
whose creation task failed (USER_ERROR zeroes remaining_restarts), and
max_errored_blocks only guards the data-task path. At N-actor pools any
per-boot flake probability p becomes job-death probability 1-(1-p)^N.

Catch the failure at the pool boundary and charge it against a new
per-operator budget, DataContext.max_actor_init_failures (default 0 =
today's fail-fast behavior; -1 = unlimited; env
RAY_DATA_MAX_ACTOR_INIT_FAILURES). Tolerated failures are logged and the
actor autoscaler starts a replacement (the pool is below its target
size). To avoid endless crash loops on deterministic misconfiguration, a
systemic guard re-raises when no actor of the operator has ever
initialized successfully after max(initial pool size, 3) failures.

Signed-off-by: xyuzh <[email protected]>

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces a per-operator budget for actor initialization failures in Ray Data, allowing failed actors to be replaced up to a specified limit (DataContext.max_actor_init_failures). It also implements a systemic failure guard to fail fast if no actors can initialize successfully, preventing infinite crash loops. Unit and integration tests have been added to verify this behavior. No review comments were provided, so there is no additional feedback.

…unting

Replace the cumulative failure budget plus hardcoded systemic-failure
threshold with a single consecutive-failure counter that resets whenever
an actor initializes successfully. This matches the semantics of
actor_init_max_retries, removes the magic constant and the
_any_actor_started flag, and renames the config to
max_consecutive_actor_init_failures to make the semantics explicit.

Signed-off-by: xyuzh <[email protected]>
@xyuzh xyuzh changed the title [data] Tolerate actor init failures in ActorPoolMapOperator via DataContext.max_actor_init_failures [data] Tolerate actor init failures in ActorPoolMapOperator via DataContext.max_consecutive_actor_init_failures Jul 30, 2026
@xyuzh xyuzh changed the title [data] Tolerate actor init failures in ActorPoolMapOperator via DataContext.max_consecutive_actor_init_failures [data] Fault tolerant actor init for large scale data pipeline Jul 30, 2026
Comment on lines 870 to 871
actor_init_retry_on_errors: bool = DEFAULT_ACTOR_INIT_RETRY_ON_ERRORS
actor_init_max_retries: int = DEFAULT_ACTOR_INIT_MAX_RETRIES

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.

How come you need consecutive retries, rather than these 2 vars?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

These are at different level,

    actor_init_retry_on_errors: bool = DEFAULT_ACTOR_INIT_RETRY_ON_ERRORS
    actor_init_max_retries: int = DEFAULT_ACTOR_INIT_MAX_RETRIES

catches user code exceptions but when there is a hardware failure this level doesn't raise.

Failure handling at this PR is for _task_done_callback which is when an actor doesn't return and we reschedule this actor at potentially different hardware.

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.

Hmm so we have retries in the Actor __init__ function itself, and we have retries on the driver? Is it possible to unify both then? How come

while max_retries < 0 or attempt <= max_retries:
try:
self._map_transformer.init()
return # Success
except Exception as e:
last_exception = e
logger.debug(
f"Failed to initialize UDF on attempt {attempt + 1} "
f"(max_retries={'infinite' if max_retries < 0 else max_retries}): {e}",
exc_info=True,
)
attempt += 1
# All retries exhausted
raise last_exception
doesn't trigger? Is it somehow failing outside this function in the creation task?

@iamjustinhsu iamjustinhsu Jul 30, 2026 •

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.

oh i see https://docs.ray.io/en/latest/ray-core/api/doc/ray.exceptions.RayActorError.html#ray-exceptions-rayactorerror, this means outside of the ray task, and since ray creation task is also a task, this can fail before init can be called?

if that's the case, then I think it's fine to catch the exception. I'm wondering if we should narrow it further with ActorDiedError or ActorUnavailableError

@xyuzh xyuzh Jul 31, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

  • this can fail before init can be called?
    • yes

This error could fall to ActorDiedError OwnerDiedError, ActorUnavailableError
RayError is the right catch

… from in-process UDF init retries

'actor init failure' was ambiguous next to actor_init_retry_on_errors /
actor_init_max_retries, which retry the UDF constructor in-process inside
a live actor. The new knob counts actor deaths (Ray's own vocabulary:
ActorDiedError), so name it accordingly and cross-reference the two
mechanisms in the DataContext docstrings.

Signed-off-by: xyuzh <[email protected]>
@xyuzh xyuzh changed the title [data] Fault tolerant actor init for large scale data pipeline [data] Tolerate actor deaths during init in ActorPoolMapOperator via DataContext.max_consecutive_actor_init_deaths Jul 30, 2026

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 1c28913. Configure here.

def test_actor_init_death_budget_with_in_actor_retries(
ray_start_regular_shared_2_cpus, restore_data_context
):
"""Tests that the pool-level death budget counts actor incarnations, not

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.

not sure what actor incarnations are, but could you explain why the test succeeds? Like you fail 3 times in the init function, but we succeed because we fail 2x init, then register consecutive death as 1, then do that again?)

@xyuzh xyuzh Jul 31, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

incarnations mean actor process
ctx.actor_init_max_retries = 1 allows a single actor to fail once so
T1: actor process 1, it fails once and retries
T2: actor process 1, it fails again and dies
T3: (ctx.max_consecutive_actor_init_deaths = 1) restart actor process 2
T4: actor process 2, it fails again and dies and retries
T5: actor process 2, it succeeds

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 see, i think that would be helpful in the docstring

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

assert len(result.take_all()) == 10


def test_on_actor_init_death_unit(

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.

Im curious, how come it has to be consecutive, what about non-consecutive? Is checking for consecutive more defensive against hardware failures?

@xyuzh xyuzh Jul 31, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

consecutiveness decides if the error is deterministic.
Normally such failures(for large scale data pipeline) should be rare and low probability, if it happens consecutively we should tolerate it as it mostly should be a bug

# Consecutive actor deaths during initialization; resets whenever an actor
# of this operator initializes successfully (see
# ``DataContext.max_consecutive_actor_init_deaths``).
self._consecutive_actor_init_deaths = 0

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.

hmm also this is a global variable, should we make this per-actor?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This defines the behavior of actors globally
Why make it per actor?

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.

My reasoning is that actors are scheduled across nodes. Some nodes are healthier than others, so an actor trying to schedule on the same node 3 times would trigger the failure, rather than 3 separate actors scheduling on 3 separate nodes (and the reason we could tolerate this in ray data is that maybe it's a temporary network partition, and all actors fail consecutively). Now i'm not sure how common that is, but wanted ur thoughts.

@xyuzh xyuzh Jul 31, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In my case where I use 200 nodes and each node has 192 cores I am able to get the workload running with the fix applied.
SPREAD is the default for Ray data so I think it's less of a concern

@xyuzh xyuzh added the go add ONLY when ready to merge, run all tests label Jul 31, 2026
…meline

Spell out how actor_init_max_retries and max_consecutive_actor_init_deaths
interact in test_actor_init_death_budget_with_in_actor_retries: two init
attempts per actor process, one budget charge per dead process. Collapse the
comment above the mapper that restated the same walkthrough.

Signed-off-by: xyuzh <[email protected]>
@goutamvenkat-anyscale
goutamvenkat-anyscale merged commit f8aa4d1 into ray-project:master Aug 3, 2026
3 checks passed
Artimislyy pushed a commit to Artimislyy/ray that referenced this pull request Aug 11, 2026
…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]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…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]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data Ray Data-related issues go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants