Skip to content

[Core] Make MAX_APPLICATION_ERROR_LEN configurable via env var#59543

Merged
edoakes merged 4 commits into
ray-project:masterfrom
preneond:patch-1
Jan 2, 2026
Merged

[Core] Make MAX_APPLICATION_ERROR_LEN configurable via env var#59543
edoakes merged 4 commits into
ray-project:masterfrom
preneond:patch-1

Conversation

@preneond

@preneond preneond commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

Why are these changes needed?

Ray truncates error messages to 500 bytes, keeping only the last 500 characters. This often cuts off the exception type and actual error message, making debugging hard.

This PR makes the limit configurable via RAY_MAX_APPLICATION_ERROR_LEN environment variable while keeping the 500 byte default.

Related issue

Fixes #50976

Changes

# In ray/_private/ray_constants.py
MAX_APPLICATION_ERROR_LEN = env_integer("RAY_MAX_APPLICATION_ERROR_LEN", 500)

Usage

# Set higher limit
export RAY_MAX_APPLICATION_ERROR_LEN=5000
ray start --head

In Kubernetes:

env:
  - name: RAY_MAX_APPLICATION_ERROR_LEN
    value: "5000"

Currently MAX_APPLICATION_ERROR_LEN is hardcoded to 500 bytes, which truncates error messages in the dashboard. This adds RAY_MAX_APPLICATION_ERROR_LEN 
env var to make it configurable while keeping the 500 bytes default.

Fixes ray-project#50976


Signed-off-by: Ondrej Prenek <ondra.prenek@gmail.com>
@preneond preneond requested a review from a team as a code owner December 18, 2025 11:34
@preneond preneond marked this pull request as draft December 18, 2025 11:37

@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 successfully introduces configurability for the maximum application error message length via an environment variable. This is a valuable change that addresses the issue of truncated error messages, improving debugging capabilities for users.

Comment thread python/ray/_private/ray_constants.py Outdated

# The max number of bytes for task execution error message.
MAX_APPLICATION_ERROR_LEN = 500
MAX_APPLICATION_ERROR_LEN = env_integer("RAY_MAX_APPLICATION_ERROR_LEN", 500)

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.

medium

The constant MAX_APPLICATION_ERROR_LEN is explicitly described in the preceding comment (line 388) as representing "the max number of bytes". For improved clarity and consistency with other byte-related constants in this file (e.g., MACH_PAGE_SIZE_BYTES, DEFAULT_MIN_SYSTEM_RESERVED_MEMORY_BYTES), it would be more precise to rename this constant to MAX_APPLICATION_ERROR_BYTES. The corresponding environment variable RAY_MAX_APPLICATION_ERROR_LEN should also be updated to RAY_MAX_APPLICATION_ERROR_BYTES to reflect this unit.

Suggested change
MAX_APPLICATION_ERROR_LEN = env_integer("RAY_MAX_APPLICATION_ERROR_LEN", 500)
MAX_APPLICATION_ERROR_BYTES = env_integer("RAY_MAX_APPLICATION_ERROR_BYTES", 500)

@preneond preneond Dec 18, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not sure if we want to rename the variable, I'll leave it up to reviewer (the human one :) )

@preneond preneond marked this pull request as ready for review December 18, 2025 11:50
@ray-gardener ray-gardener Bot added docs An issue or change related to documentation core Issues that should be addressed in Ray Core community-contribution Contributed by the community labels Dec 18, 2025
@edoakes

edoakes commented Dec 18, 2025

Copy link
Copy Markdown
Collaborator

Let's call it MAX_APPLICATION_ERROR_LENGTH to match other existing vars:

(ray) eoakes@eoakes-CQTYX0Y0RV ray % grep -r "LENGTH" _private/ray_constants.py
_private/ray_constants.py:AGENT_GRPC_MAX_MESSAGE_LENGTH = env_integer(
_private/ray_constants.py:    "AGENT_GRPC_MAX_MESSAGE_LENGTH", 20 * 1024 * 1024  # 20MB

preneond and others added 2 commits December 19, 2025 09:16
…RROR_LENGTH to match other constants naming conventions

Signed-off-by: Ondrej Prenek <ondra.prenek@gmail.com>
Comment thread python/ray/_raylet.pyx Outdated
@preneond

Copy link
Copy Markdown
Contributor Author

@edoakes changed in fe29b9f

… string

Signed-off-by: Ondrej Prenek <ondra.prenek@gmail.com>
@edoakes edoakes added the go add ONLY when ready to merge, run all tests label Dec 19, 2025
@edoakes edoakes enabled auto-merge (squash) December 19, 2025 22:37
@preneond

preneond commented Jan 1, 2026

Copy link
Copy Markdown
Contributor Author

can I ask for review, please? 🙏

@edoakes edoakes disabled auto-merge January 2, 2026 15:34
@edoakes edoakes merged commit 5dea0af into ray-project:master Jan 2, 2026
8 checks passed
@preneond preneond deleted the patch-1 branch January 3, 2026 02:15
@preneond

preneond commented Jan 8, 2026

Copy link
Copy Markdown
Contributor Author

@edoakes Can i ask you to release a new version so i can use it? I haven't found a way to do it myself 🙏 Thanks!

@edoakes

edoakes commented Jan 8, 2026

Copy link
Copy Markdown
Collaborator

@edoakes Can i ask you to release a new version so i can use it? I haven't found a way to do it myself 🙏 Thanks!

Release should be coming in the next week or two. You can also use the nightly wheels, links here: https://docs.ray.io/en/latest/ray-overview/installation.html#daily-releases-nightlies

AYou0207 pushed a commit to AYou0207/ray that referenced this pull request Jan 13, 2026
…roject#59543)

## Why are these changes needed?

Ray truncates error messages to 500 bytes, keeping only the last 500
characters. This often cuts off the exception type and actual error
message, making debugging hard.

This PR makes the limit configurable via `RAY_MAX_APPLICATION_ERROR_LEN`
environment variable while keeping the 500 byte default.

## Related issue

Fixes ray-project#50976

## Changes

```python
# In ray/_private/ray_constants.py
MAX_APPLICATION_ERROR_LEN = env_integer("RAY_MAX_APPLICATION_ERROR_LEN", 500)
```

## Usage
```bash
# Set higher limit
export RAY_MAX_APPLICATION_ERROR_LEN=5000
ray start --head
```
In Kubernetes:
```yaml
env:
  - name: RAY_MAX_APPLICATION_ERROR_LEN
    value: "5000"
```

---------

Signed-off-by: Ondrej Prenek <ondra.prenek@gmail.com>
Signed-off-by: jasonwrwang <jasonwrwang@tencent.com>
@preneond

preneond commented Jan 29, 2026

Copy link
Copy Markdown
Contributor Author

@edoakes Can i ask you to release a new version so i can use it? I haven't found a way to do it myself 🙏 Thanks!

Release should be coming in the next week or two. You can also use the nightly wheels, links here: https://docs.ray.io/en/latest/ray-overview/installation.html#daily-releases-nightlies

Hi @edoakes, just checking in — any update on the release timeline? It's been about 3 weeks since the last mention. Thanks 🙏!

@edoakes

edoakes commented Jan 29, 2026

Copy link
Copy Markdown
Collaborator

@preneond I apologize, our testing infra has been more unstable than usual which has delayed the release process (we run a large suite of tests prior to releasing any new versions). We are pushing hard to have a release by the end of next week at the latest.

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

Labels

community-contribution Contributed by the community core Issues that should be addressed in Ray Core docs An issue or change related to documentation go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Ray Core] Ray task error stack trace is incomplete

2 participants