Skip to content

[Core] Log actor class import failures with their traceback - #66564

Merged
rueian merged 4 commits into
ray-project:masterfrom
xuwwwww:improve-actor-import-error
Oct 2, 2026
Merged

rueian merged 4 commits into
ray-project:masterfrom
xuwwwww:improve-actor-import-error

Conversation

@xuwwwww

@xuwwwww xuwwwww commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Description

When an actor class fails to import on a worker, Ray logs the failure at DEBUG level and creates a temporary actor to report it later. In the case reported in #49285, the user saw an async actor startup error without the original ModuleNotFoundError in the worker log.

Log the import failure with its traceback at ERROR level. The temporary actor behavior stays the same. A focused test simulates a missing module and checks both the log and the existing fallback error. The test is registered in Bazel and includes a pytest entrypoint.

Related issues

Fixes #49285.

Additional information

I checked the issue and open PRs on 2026-09-29. The issue is open and unassigned, and I found no open PR for this log path.

Tests run on Windows:

  • ..\ray-venv\Scripts\python.exe ..\..\outputs\run-ray-first-pr-test.py — 1 passed after the CI logging fix. This local helper loads the modified function_manager.py over the Ray 2.58.0 binary wheel and sets the ray logger's propagation to False to reproduce the CI condition; it is not part of the PR.
  • The test file's __main__ entrypoint — 1 passed.
  • Applicable pre-commit hooks passed. The Bash-based docstyle and Buildifier hooks could not run through Windows pre-commit. I ran docstyle with Git Bash and checked BUILD.bazel with Buildifier 8.0.1 on an LF-normalized copy; both passed.
  • git diff --check — passed.

AI assistance was used to investigate this issue and prepare the patch and test. The submitter ran the focused test locally.

@xuwwwww
xuwwwww requested a review from a team as a code owner September 29, 2026 01:30

@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 updates the actor class loading logic in function_manager.py to use logger.exception instead of logger.debug when an error occurs, ensuring that the full traceback is captured. Additionally, a new test case has been added to verify that actor import errors are correctly logged. I have no further feedback to provide.

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

Stale Bugbot comment from a previous run.

@ray-gardener ray-gardener Bot added core Issues that should be addressed in Ray Core community-contribution Contributed by the community labels Sep 29, 2026
@rueian rueian added the go add ONLY when ready to merge, run all tests label Sep 29, 2026
@rueian
rueian enabled auto-merge (squash) September 30, 2026 23:18

@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 4ccb698. Configure here.

auto-merge was automatically disabled October 1, 2026 00:20

Head branch was pushed to by a user without write access

@rueian
rueian merged commit f54b8b3 into ray-project:master Oct 2, 2026
6 checks passed
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…ect#66564)

## Description

When an actor class fails to import on a worker, Ray logs the failure at
DEBUG level and creates a temporary actor to report it later. In the
case reported in ray-project#49285, the user saw an async actor startup error
without the original `ModuleNotFoundError` in the worker log.

Log the import failure with its traceback at ERROR level. The temporary
actor behavior stays the same. A focused test simulates a missing module
and checks both the log and the existing fallback error. The test is
registered in Bazel and includes a pytest entrypoint.

## Related issues

Fixes ray-project#49285.

## Additional information

I checked the issue and open PRs on 2026-09-29. The issue is open and
unassigned, and I found no open PR for this log path.

Tests run on Windows:

- `..\ray-venv\Scripts\python.exe
..\..\outputs\run-ray-first-pr-test.py` — 1 passed after the CI logging
fix. This local helper loads the modified `function_manager.py` over the
Ray 2.58.0 binary wheel and sets the `ray` logger's propagation to
`False` to reproduce the CI condition; it is not part of the PR.
- The test file's `__main__` entrypoint — 1 passed.
- Applicable pre-commit hooks passed. The Bash-based docstyle and
Buildifier hooks could not run through Windows pre-commit. I ran
docstyle with Git Bash and checked `BUILD.bazel` with Buildifier 8.0.1
on an LF-normalized copy; both passed.
- `git diff --check` — passed.

AI assistance was used to investigate this issue and prepare the patch
and test. The submitter ran the focused test locally.

---------

Signed-off-by: xuwwwww <[email protected]>
Co-authored-by: Rueian <[email protected]>
elliot-barn pushed a commit that referenced this pull request Oct 21, 2026
… `test_token_auth_integration` on Windows (#66623) (#67213)

Cherry-pick of #66623 (master commit
43cb165) onto `releases/2.60.0`.

## Why

Both tests fail in the `:ray: core: :windows: python tests` job in all
11 `releases/2.60.0` postmerge builds so far, including build 20362 for
the current branch head:

- `test_runtime_env_image_uri.py::test_mounts_default_token_file` fails
its token-mount assertion. The `auth_env` fixture redirects only `HOME`,
but on Windows `Path.home()` reads `USERPROFILE`.
- `test_token_auth_integration` times out at the 300s `medium` limit.

Both failures started with #66467, which this branch has. #66623 sets
`USERPROFILE` in the fixture and moves `test_token_auth_integration.py`
to the `large` list (900s). It changes only tests and `BUILD.bazel`.

On master, both tests failed in every release-automation postmerge build
that ran them, from the branch point through build 20097. They have
passed in all 49 builds that ran them since build 20102, the first to
include #66623.

## Cherry-pick details

Applied cleanly with `git cherry-pick -x`. The change is identical to
the master commit:

- Same 2 files, 5 insertions and 1 deletion, and the same `git patch-id
--stable`.
- The diff text matches except for the second `BUILD.bazel` hunk header.
It starts 1 line earlier here, because this branch doesn't have the
`test_function_manager_import_error.py` entry that #66564 added above it
on master.

No prerequisite commits are missing:

- On master, only #66564 touched these files between the branch cut and
#66623. It added that one test entry to another list.
- After the pick, `test_runtime_env_image_uri.py` is identical to master
at 43cb165, and `BUILD.bazel` differs only by that entry.
- `test_token_auth_integration.py` is now in the same `large` list as on
master (tag `large_size_python_tests_shard_0`). The separate
`_client_mode` entry was already `large` and is unchanged.
- On this branch, no commit after the cut touched these files.

Not a duplicate: this branch doesn't contain #66623, and no PR against
`releases/2.60.0` references it.

## Testing

| Command | Result |
|---|---|
| `pre-commit run --files python/ray/tests/BUILD.bazel
python/ray/tests/unit/test_runtime_env_image_uri.py` | Passed (ruff,
black, buildifier, buildifier-lint, and the other applicable hooks) |

Both fixes only change behavior on Windows, so I didn't run the tests
locally on Linux. In CI they run in the `:ray: core: :windows: python
tests` job. On premerge and microcheck, that job waits on the "run
windows tests" block step.

AI assistance was used to prepare this cherry-pick.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Chi-Sheng Liu <[email protected]>
Signed-off-by: Sai Miduthuri <[email protected]>
Co-authored-by: Chi-Sheng Liu <[email protected]>
Co-authored-by: Mengjin Yan <[email protected]>
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 go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed to create actor. You set the async flag, but the actor does not have any coroutine functions.

2 participants