Skip to content

[core] Include owner node ID in OwnerDiedError message - #63727

Merged
edoakes merged 4 commits into
ray-project:masterfrom
prince8273:pubsub-notification-staleness-diagnostics
Jun 3, 2026
Merged

edoakes merged 4 commits into
ray-project:masterfrom
prince8273:pubsub-notification-staleness-diagnostics

Conversation

@prince8273

Copy link
Copy Markdown
Contributor

This change adds a bit more context around object ownership loss and GCS pub/sub resubscription behavior.

Changes are in src/ray/pubsub/subscriber.h, subscriber.cc, subscriber_test.cc, and python/ray/exceptions.py.

On the pub/sub side, each subscriber entry now records the last time it processed a published message. When a publisher ID changes, which can happen after GCS failover, the reconnect log now includes per-channel subscription state and how recently each channel saw a notification. This should make it easier to tell whether a subscriber had an active but stale view, had never received a notification, or had no active subscriptions for that publisher.

The subscriber test now checks the timestamp behavior directly instead of relying on the debug string format.

For OwnerDiedError, the error message now includes the owner worker ID, owner node ID, and owner address when that information is available. If the node ID is missing, it is shown as unknown instead of printing an empty value.

This is intended to make ownership-loss and stale-subscription debugging less dependent on manually piecing together ObjectRef IDs and cluster logs.

@prince8273
prince8273 requested a review from a team as a code owner May 29, 2026 17:06

@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 error reporting and subscription diagnostics. In Python, OwnerDiedError now includes the owner's worker ID, node ID, and address. In C++, the pubsub subscriber now tracks and logs the timestamp of the last published message for each subscription, which is included in debug strings and during GCS failover events. The review feedback highlights two main improvements: first, a potential segmentation fault should be avoided by adding a null check when looking up the channel type descriptor name; second, the age calculation for the last notification should guard against negative values caused by backward system clock shifts.

Comment thread src/ray/pubsub/subscriber.cc Resolved
Comment thread src/ray/pubsub/subscriber.cc Resolved
@prince8273
prince8273 force-pushed the pubsub-notification-staleness-diagnostics branch 2 times, most recently from 3f358ff to 973a002 Compare May 29, 2026 17:18
…ch OwnerDiedError diagnostics

Signed-off-by: Prince Kumar <[email protected]>
@prince8273
prince8273 force-pushed the pubsub-notification-staleness-diagnostics branch from 973a002 to df1268d Compare May 29, 2026 17:20
@prince8273
prince8273 force-pushed the pubsub-notification-staleness-diagnostics branch 2 times, most recently from 5de9b57 to e3b4bf1 Compare May 29, 2026 19:03
Signed-off-by: Prince Kumar <[email protected]>
@prince8273
prince8273 force-pushed the pubsub-notification-staleness-diagnostics branch from d7de93c to 3e1f695 Compare May 29, 2026 19:06
@Yicheng-Lu-llll

Copy link
Copy Markdown
Member

@prince8273 Thanks for the PR!

I'm not sure I fully follow the motivation though. Could you describe a concrete situation you ran into where debugging was hard without this information, and how these additions would have helped? Thanks!

@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 29, 2026
@prince8273

Copy link
Copy Markdown
Contributor Author

@prince8273 Thanks for the PR!

I'm not sure I fully follow the motivation though. Could you describe a concrete situation you ran into where debugging was hard without this information, and how these additions would have helped? Thanks!

Sure @Yicheng-Lu-llll! The concrete situation I ran into is a borrowed ObjectRef that fails with OwnerDiedError in a multi-node cluster.
When I traced that path, the borrower resolves the ObjectRef by asking the owner for object status through FutureResolver. If that owner-status RPC can't reach the owner, the callback records an OWNER_DIED error for the ObjectRef, and Python deserialization later turns that into OwnerDiedError.
The hard part is the final Python error mostly points at the ObjectRef and a worker-log glob. In a multi-node failure I usually want the owner node id too, because that lets me jump straight to the relevant raylet/node logs or GCS worker/node records. That's the reason for the OwnerDiedError addition.
The pubsub part is a separate issue but came from the same path. Object-location updates go through the subscriber, which tracks processed sequence state per publisher. When the publisher id changes, for example after pubsub/GCS restart or reconnect, that sequence state resets. Before this PR the log only said the publisher id changed. It didn't say whether we still had active subscriptions, whether they'd ever received a notification, or how old the last one was.
That's what makes it hard to tell whether the owner died while subscription state was fresh, or whether it was already stale before the failure surfaced.
No behavior change here, just the context I kept wishing was already in the logs.

@Yicheng-Lu-llll

Copy link
Copy Markdown
Member

@prince8273 The OwnerDiedError part makes sense to me. I haven't looked at your PR changes yet, but basically you're saying that when you receive an OwnerDiedError, you want to know the object owner's node ID so you can go to that node and figure out why the owner died. Let me know if I'm understanding this correctly.

But I don't get the pubsub part, could you explain a bit more? You mentioned knowing whether the "subscription state was fresh, or whether it was already stale before the failure surfaced." How does that help, and what useful information does it give you?

@prince8273

Copy link
Copy Markdown
Contributor Author

@Yicheng-Lu-llll Yes, that’s exactly right for the OwnerDiedError part. The goal is to include the owner node id so that, when a user sees OwnerDiedError, they can go directly to the relevant node/raylet logs and investigate why the owner worker died.

For the pubsub part, I should separate the motivation a bit more clearly. This is not meant to explain why the owner died. It is for debugging object-location subscriptions around publisher id changes.

For WORKER_OBJECT_LOCATIONS_CHANNEL, the subscriber keeps processed sequence state per publisher. When the publisher id changes, for example after a pubsub/GCS restart or reconnect, that sequence state is reset. Currently the log only says that the publisher id changed, but not whether the subscriber had active subscriptions or had received recent object-location notifications before the reset.

That timestamp helps answer whether the subscriber was actually receiving object-location updates recently. If it had never received a notification, I would look at the subscribe / initial snapshot path. If it had received one recently, the subscription path was probably alive and I would look elsewhere, such as owner death, eviction, or owner-side location state. If the last notification was old around the publisher-id change, then the reconnect/stale-subscription path becomes more suspicious.

So the pubsub part is meant as a small debugging breadcrumb for object-location subscription state, not as a direct diagnosis for OwnerDiedError or a behavior change.

Comment thread python/ray/exceptions.py
f"Owner worker ID: {worker_id.hex()}, "
f"owner node ID: {node_id}, "
f"owner address: {ip_addr}:{addr.port}."
)
log_loc = (
f"`/tmp/ray/session_latest/logs/*{worker_id.hex()}*`"
f" at IP address {ip_addr}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But looking at the code, it seems like this line already tells you where to find the log. You'd go to that IP address's node and check the log there.

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.

You're right that the IP is already there for finding the worker log. The node ID is more useful when correlating with Ray/GCS state directly, for example ray list nodes or GCS worker/node records, where you match on node ID rather than IP. Having it in the error avoids an extra lookup from IP to node ID.

@Yicheng-Lu-llll

Copy link
Copy Markdown
Member

whether the subscriber was actually receiving object-location updates recently.

I don't quite get why you need to know this. Could you give me a concrete example?

@prince8273

Copy link
Copy Markdown
Contributor Author

whether the subscriber was actually receiving object-location updates recently.

I don't quite get why you need to know this. Could you give me a concrete example?

Say a worker holds a borrowed ObjectRef and eventually gets OwnerDiedError. One question during debugging is whether the object-location subscription was working normally up until the owner died, or whether it had already silently stopped receiving updates before the failure.

If the subscriber never received a notification for that object, the problem might be in the initial subscription or snapshot path, not the owner dying. If it received one recently, I’d be less suspicious of the subscription path and would look more at owner death, eviction, or owner-side location state. If the last notification was a long time ago relative to the publisher-id change, the stale subscription path becomes worth investigating.

Without the timestamp, the reconnect log just says the publisher id changed and sequence state was reset. You can't tell which of those cases you're in without digging further. The timestamp gives you that at a glance.

@Yicheng-Lu-llll

Copy link
Copy Markdown
Member

One question during debugging is whether the object-location subscription was working normally up until the owner died, or whether it had already silently stopped receiving updates before the failure.

I see, thanks for explaining, You could take a look at how pubsub is implemented. Basically, pubsub will not "silently stop."

@prince8273

Copy link
Copy Markdown
Contributor Author

Thanks, that makes sense. I misunderstood that part of the pubsub behavior.

Given that pubsub keeps the long-polling connection active and handles publisher failures explicitly, I agree the timestamp/staleness tracking is not well motivated by the case I described. I’ll remove the pubsub changes and keep this PR focused on the OwnerDiedError owner-node-id context.

@prince8273 prince8273 changed the title [core][pubsub] Add per-subscription notification staleness tracking and enrich OwnerDiedError diagnostics [core] Include owner node ID in OwnerDiedError message May 30, 2026
@prince8273

Copy link
Copy Markdown
Contributor Author

@Yicheng-Lu-llll
I removed the pubsub staleness-tracking changes and pushed an update. The PR is now focused only on adding the owner node id to OwnerDiedError.

@edoakes edoakes added the go add ONLY when ready to merge, run all tests label Jun 1, 2026
@prince8273

Copy link
Copy Markdown
Contributor Author

@edoakes
CI failure in core: python tests [g6_s10] looks like a pre-existing flake. The same tests failed in the previous run as well, and the failures are unrelated to the changes in dashboard/agent.py or node_head.py. Requesting a rerun.

@edoakes
edoakes merged commit 70f6273 into ray-project:master Jun 3, 2026
4 checks passed
@prince8273
prince8273 deleted the pubsub-notification-staleness-diagnostics branch June 3, 2026 04:14
@prince8273

Copy link
Copy Markdown
Contributor Author

Thank you @edoakes @Yicheng-Lu-llll both

@Yicheng-Lu-llll your questions on the pubsub motivation were spot on, and I learned something new about how Ray's pubsub works.

Hope to contribute more going forward.
Always open to feedback! 😊

rueian pushed a commit to rueian/ray that referenced this pull request Jun 4, 2026
…3727)

This change adds a bit more context around object ownership loss and GCS
pub/sub resubscription behavior.

Changes are in src/ray/pubsub/subscriber.h, subscriber.cc,
subscriber_test.cc, and python/ray/exceptions.py.

On the pub/sub side, each subscriber entry now records the last time it
processed a published message. When a publisher ID changes, which can
happen after GCS failover, the reconnect log now includes per-channel
subscription state and how recently each channel saw a notification.
This should make it easier to tell whether a subscriber had an active
but stale view, had never received a notification, or had no active
subscriptions for that publisher.

The subscriber test now checks the timestamp behavior directly instead
of relying on the debug string format.

For OwnerDiedError, the error message now includes the owner worker ID,
owner node ID, and owner address when that information is available. If
the node ID is missing, it is shown as unknown instead of printing an
empty value.

This is intended to make ownership-loss and stale-subscription debugging
less dependent on manually piecing together ObjectRef IDs and cluster
logs.

---------

Signed-off-by: Prince Kumar <[email protected]>
limarkdcunha pushed a commit to limarkdcunha/ray that referenced this pull request Jun 30, 2026
…3727)

This change adds a bit more context around object ownership loss and GCS
pub/sub resubscription behavior.

Changes are in src/ray/pubsub/subscriber.h, subscriber.cc,
subscriber_test.cc, and python/ray/exceptions.py.

On the pub/sub side, each subscriber entry now records the last time it
processed a published message. When a publisher ID changes, which can
happen after GCS failover, the reconnect log now includes per-channel
subscription state and how recently each channel saw a notification.
This should make it easier to tell whether a subscriber had an active
but stale view, had never received a notification, or had no active
subscriptions for that publisher.

The subscriber test now checks the timestamp behavior directly instead
of relying on the debug string format.

For OwnerDiedError, the error message now includes the owner worker ID,
owner node ID, and owner address when that information is available. If
the node ID is missing, it is shown as unknown instead of printing an
empty value.

This is intended to make ownership-loss and stale-subscription debugging
less dependent on manually piecing together ObjectRef IDs and cluster
logs.

---------

Signed-off-by: Prince Kumar <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…3727)

This change adds a bit more context around object ownership loss and GCS
pub/sub resubscription behavior.

Changes are in src/ray/pubsub/subscriber.h, subscriber.cc,
subscriber_test.cc, and python/ray/exceptions.py.

On the pub/sub side, each subscriber entry now records the last time it
processed a published message. When a publisher ID changes, which can
happen after GCS failover, the reconnect log now includes per-channel
subscription state and how recently each channel saw a notification.
This should make it easier to tell whether a subscriber had an active
but stale view, had never received a notification, or had no active
subscriptions for that publisher.

The subscriber test now checks the timestamp behavior directly instead
of relying on the debug string format.

For OwnerDiedError, the error message now includes the owner worker ID,
owner node ID, and owner address when that information is available. If
the node ID is missing, it is shown as unknown instead of printing an
empty value.

This is intended to make ownership-loss and stale-subscription debugging
less dependent on manually piecing together ObjectRef IDs and cluster
logs.

---------

Signed-off-by: Prince Kumar <[email protected]>
Signed-off-by: 400Ping <[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 observability Issues related to the Ray Dashboard, Logging, Metrics, Tracing, and/or Profiling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants