Skip to content

[core] Improve traversal context in inspect_serializability#63258

Merged
edoakes merged 9 commits into
ray-project:masterfrom
prince8273:improve-serialization-path-tracing
May 13, 2026
Merged

[core] Improve traversal context in inspect_serializability#63258
edoakes merged 9 commits into
ray-project:masterfrom
prince8273:improve-serialization-path-tracing

Conversation

@prince8273

Copy link
Copy Markdown
Contributor

Summary

Improve serialization debugging by propagating traversal ancestry/path context during recursive serialization inspection.

Problem

Current diagnostics only preserve immediate parent context, making localization difficult for nested object graphs and closures.

Solution

Track traversal paths during recursive inspection while preserving all existing behavior.

Example Improvement

Before: FailTuple(lock [obj=<lock>, parent=<Pipeline>])
After: FailTuple(lock [path=train -> model -> pipeline -> executor -> lock, obj=<lock>, parent=<Pipeline>])

Non-goals

  • No serialization behavior changes
  • No traversal algorithm redesign
  • No cloudpickle modifications

Tests

Added regression coverage for nested objects, closures, and path propagation.

@prince8273 prince8273 requested a review from a team as a code owner May 10, 2026 08:36

@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 enhances the serialization inspection utility by replacing the single 'name' attribute with a full traversal 'path' in FailureTuple, allowing for better debugging of serialization failures. It includes updates to the inspection functions to propagate this path and adds corresponding test cases. Feedback highlights a critical issue in the path initialization logic that leads to name duplication and a potential TypeError when the object name is None.

Comment thread python/ray/util/check_serialize.py Outdated
Comment thread python/ray/util/check_serialize.py Outdated
Comment thread python/ray/util/check_serialize.py Outdated
- Track traversal ancestry during recursive serialization inspection
- Preserve existing FailureTuple semantics and set deduplication
- Add path context to failure output for better localization
- Update docstring and add regression tests for path propagation

This improves debugging ergonomics for nested serialization failures
by showing complete traversal paths (e.g., train -> model -> lock)
without changing serialization behavior or traversal algorithms.

Signed-off-by: Prince Kumar <167613824+prince8273@users.noreply.github.com>
Signed-off-by: Prince Kumar <167613824+prince8273@users.noreply.github.com>
Signed-off-by: Prince Kumar <167613824+prince8273@users.noreply.github.com>
@prince8273 prince8273 force-pushed the improve-serialization-path-tracing branch from 6420425 to 5d6fb95 Compare May 10, 2026 10:57

@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 and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 826ac2f81ce1d5d483c1063142486757b41aaab6. Configure here.

Comment thread python/ray/util/check_serialize.py
Signed-off-by: Prince Kumar <167613824+prince8273@users.noreply.github.com>
@prince8273 prince8273 force-pushed the improve-serialization-path-tracing branch from 826ac2f to 15613dc Compare May 10, 2026 11:56
Signed-off-by: Prince Kumar <167613824+prince8273@users.noreply.github.com>
Signed-off-by: Prince Kumar <167613824+prince8273@users.noreply.github.com>
Signed-off-by: Prince Kumar <167613824+prince8273@users.noreply.github.com>
@ray-gardener ray-gardener Bot added core Issues that should be addressed in Ray Core observability Issues related to the Ray Dashboard, Logging, Metrics, Tracing, and/or Profiling community-contribution Contributed by the community labels May 10, 2026
Signed-off-by: Prince Kumar <167613824+prince8273@users.noreply.github.com>
Signed-off-by: Prince Kumar <167613824+prince8273@users.noreply.github.com>
@edoakes edoakes added the go add ONLY when ready to merge, run all tests label May 11, 2026
@prince8273

Copy link
Copy Markdown
Contributor Author

@edoakes
The test_object_summary_aggregator failure appears unrelated to this PR's changes (which only touch check_serialize.py). This test has no overlap with path tracking in inspect_serializability. Requesting a re-run of the affected shard.

@edoakes edoakes merged commit 99d372f into ray-project:master May 13, 2026
7 of 8 checks passed
@prince8273 prince8273 deleted the improve-serialization-path-tracing branch June 2, 2026 11:43
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 observability Issues related to the Ray Dashboard, Logging, Metrics, Tracing, and/or Profiling

2 participants