Skip to content

[Data] Cluster autoscaler requests a bundle larger than the node it was copied from, because node memory is rounded up #65237

Open

Description

@Oblynx

What happened + What you expected to happen

What happened

DefaultClusterAutoscalerV2.try_trigger_scaling() builds its resource request by copying
whole live nodes out of ray.nodes() into _NodeResourceSpec, then replicating each node's
bundle:

node_resource_spec_count = self._get_node_counts()
for node_resource_spec, count in node_resource_spec_count.items():
    bundle = node_resource_spec.to_bundle()
    active_bundles.extend([bundle] * count)
    pending_bundles.extend([bundle] * self._cluster_scaling_up_delta)

_NodeResourceSpec.of() rounds memory to the nearest 0.1 GiB, and its comment says this is
for grouping:

@classmethod
def of(cls, *, cpu=0, gpu=0, mem=0):
    cpu = math.floor(cpu)
    gpu = math.floor(gpu)
    # Round memory to the nearest 0.1 GiB so that nodes of the same type
    # with slightly different reported physical memory are grouped together.
    mem = int(round(mem / GiB, 1) * GiB) if mem > 0 else 0
    return cls(cpu=cpu, gpu=gpu, mem=mem)

But to_bundle() re-emits that same rounded value as the resource request. Since
round() goes to nearest, it can round up, and the request then describes a node larger
than any node in the cluster. The autoscaler correctly reports it cannot be satisfied, and
repeats that every few seconds for the entire lifetime of the job:

(autoscaler +15s) No available node types can fulfill cluster constraint: {'CPU': 7.0, 'memory': 51432233369.0, 'GPU': 0.0}*3. Add suitable node types to this cluster to resolve this issue.

The node those bundles were copied from advertises memory = 51405389824 — the request is
26,843,545 bytes larger than the node it describes. Confirmed against the autoscaler's own
node-type view (ray.autoscaler.v2.sdk.get_cluster_status()), which reports this node type's
total as CPU=7.0, memory=51405389824: the CPU figure matches the bundle exactly, so memory is
the only dimension that overshoots.

This is not a niche node size. Over every whole-MiB pod memory limit from 1 GiB to 256 GiB,
half of them will produce a request larger than the node, because a value anywhere in
the upper half of its 0.1 GiB bucket rounds up.

What I expected to happen

A resource request derived from an existing node's own resources should be satisfiable by that
node. Rounding for a grouping key should not change the requested quantity: flooring to
the 0.1 GiB grid preserves the grouping the comment describes (nodes still share a bucket) while
never describing a node larger than one that exists.

Why this matters beyond the log noise

The wording is almost identical to a genuinely actionable message from the same subsystem:

(autoscaler +23s) No available node types can fulfill resource requests {'CPU': 1.0}*5. Add suitable node types to this cluster to resolve this issue.

That one reports actors Ray Data cannot place — in our measurements the multiplier is exactly the
number of unplaceable actors (*5 while 5 actors were pending, and absent entirely when the pool
was fully placed). Because the infeasible-constraint message above fires continuously and
unconditionally, it buries the one that matters. We spent a long time treating both as noise, and
missed a real actor-placement problem as a result.

Additional contributing cause (possibly a separate issue)

While verifying the fix on a real cluster I found that flooring the memory alone does not
silence the warning, because there is a second, independent cause: the request always asks for
count + _cluster_scaling_up_delta nodes of each shape, and cap_resource_request_to_limits()
caps that surplus only against DataContext.execution_options.resource_limits — never against
the worker group's maximum replica count. A group already at its maximum can therefore never
satisfy the extra bundle.

Measured as a 2x2 on one KubeRay cluster, identical workload in each arm (worker group at
maxReplicas: 2):

memory floored resource_limits capped bundle request > node warnings in job
no no *3 yes 23
yes no *3 no 23
no yes *2 yes 22
yes yes *2 no 0

Both causes have to be addressed for the symptom to disappear. Happy to split this second one
into its own issue if you'd prefer — I've kept it here because a fix to the rounding alone will
look ineffective to anyone reproducing the symptom end to end.

Versions / Dependencies

  • Ray: 2.55.1. I also checked
    python/ray/data/_internal/cluster_autoscaler/default_cluster_autoscaler_v2.py at tags
    ray-2.56.0, ray-2.56.1, and on master: _NodeResourceSpec.of() and to_bundle() are
    byte-identical, so this is still present on master.
  • Python: 3.12.3
  • OS: Debian-based container image, Linux aarch64 (kernel 6.12)
  • Cluster: KubeRay with enableInTreeAutoscaling: true on AKS; head plus two worker pods,
    worker resources.limits of cpu: 6400m and memory: 49024Mi (the raylet then advertises
    CPU: 7.0, memory: 51405389824)
  • Ray Data cluster autoscaler: V2 (the default; RAY_DATA_CLUSTER_AUTOSCALER unset)

Reproduction script

The arithmetic reproduces with no cluster and no external dependencies. It calls the same
classmethod try_trigger_scaling() uses, with the memory value a real KubeRay worker advertises:

from ray.data._internal.cluster_autoscaler.default_cluster_autoscaler_v2 import (
    _NodeResourceSpec,
)
from ray.data._internal.util import GiB

# Memory a real KubeRay worker raylet advertises (pod memory limit 49024Mi).
advertised = int(47.875 * GiB)  # 51405389824

spec = _NodeResourceSpec.of(cpu=7, gpu=0, mem=advertised)
requested = spec.to_bundle()["memory"]

print(f"node advertises : {advertised}")
print(f"bundle requests : {requested}")
print(f"difference      : {requested - advertised} bytes")
assert requested <= advertised, "request is larger than the node it was copied from"

Output on Ray 2.55.1:

node advertises : 51405389824
bundle requests : 51432233369
difference      : 26843545 bytes
Traceback (most recent call last):
  File "repro.py", line 15, in <module>
    assert requested <= advertised, "request is larger than the node it was copied from"
AssertionError: request is larger than the node it was copied from

To see the user-visible symptom instead, run any Ray Data job that uses an actor pool on a
KubeRay cluster whose worker memory limit is not a whole number of tenths of a GiB (about half of
all limits), keep cluster utilisation above the scale-up threshold, and watch the driver log: the
No available node types can fulfill cluster constraint line repeats every few seconds with a
bundle whose memory is larger than any node in ray.nodes().

Suggested fix

Floor rather than round when the value will be used as a request, e.g. keep of() for the
grouping key but have the bundle carry a floored figure:

mem = int(math.floor(mem / GiB * 10) * GiB / 10) if mem > 0 else 0

Verified locally: this makes the request equal to or smaller than the source node for every size
tested, and still groups nodes whose reported memory differs by less than 0.1 GiB.

Issue Severity

Medium: It is a significant difficulty but I can work around it.

Activity

  1. added
    bug
    triage
    on Aug 5, 2026
  2. adityaanikam commented on Aug 6, 2026

    @adityaanikam

    Checked _NodeResourceSpec.of()/to_bundle() on current master — byte identical to what's quoted here, so the rounding up behavior is real and unchanged since 2.55.1. The floor fix you've proposed is minimal and doesn't touch the grouping semantics (nodes within the same 0.1 GiB bucket still group together), happy to open a PR for it.

    For the second cause, cap_resource_request_to_limits() does cap only against self._resource_limits (traced through try_trigger_scaling) and has no visibility into a worker group's maxReplicas — so a group already at max legitimately can't satisfy the pending delta bundle either way. Splitting that into its own issue seems right per your note, since fixing it means threading maxReplicas (or an equivalent bound) into a function that currently only knows about DataContext limits, which is a bigger surface than the rounding fix. Want me to open the rounding PR now and file the second part separately, or would you rather see both addressed together?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcommunity-backlogdatastabilitytriage

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions