Skip to content

Conversation

@sunsetxh
Copy link
Contributor

@sunsetxh sunsetxh commented Nov 13, 2025

Description

Move gcs_callback_types.h to rpc_callback_types.h

Related issues

Closes #58597

@sunsetxh sunsetxh requested a review from a team as a code owner November 13, 2025 14:41
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

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 refactors gcs_callback_types.h to grpc_callback_types.h, making the callback types more generic by removing the gcs namespace. The changes across the codebase correctly reflect this rename and namespace removal.

My main feedback is to update the comments within the newly renamed grpc_callback_types.h to remove specific references to "GCS", aligning them with the goal of making these types more generic. This will improve code clarity and maintainability.

@sunsetxh sunsetxh changed the title [wip]move gcs_callback_types.h to grpc_callback_types.h [wip]rename gcs_callback_types.h to grpc_callback_types.h Nov 13, 2025
@sunsetxh
Copy link
Contributor Author

@tianyi-ge

@edoakes
Copy link
Collaborator

edoakes commented Nov 13, 2025

The callbacks in that file are not specific to gRPC. To avoid leaking implementation details of the rpc layer, let's call this rpc_callback_types. We could also move it to the rpc/ directory instead, might make more sense than dropping it in common/.

@sunsetxh
Copy link
Contributor Author

@edoakes Thinks. I'll fix it soon.

@tianyi-ge
Copy link
Contributor

Thanks! Could you fix this comment as well
#57004 (comment)

@sunsetxh sunsetxh force-pushed the br_grpc_callback branch 2 times, most recently from 04821bd to 14586e3 Compare November 13, 2025 16:42
@ray-gardener ray-gardener bot added core Issues that should be addressed in Ray Core community-contribution Contributed by the community labels Nov 13, 2025
@sunsetxh sunsetxh force-pushed the br_grpc_callback branch 3 times, most recently from fbaaccc to 87d8331 Compare November 19, 2025 14:38
@jjyao jjyao marked this pull request as draft November 19, 2025 15:52
@jjyao
Copy link
Collaborator

jjyao commented Nov 19, 2025

I converted it to draft since it's still wip.

@sunsetxh sunsetxh force-pushed the br_grpc_callback branch 3 times, most recently from 7dcfe82 to f48d26d Compare November 24, 2025 14:33
@sunsetxh sunsetxh force-pushed the br_grpc_callback branch 2 times, most recently from f0c56ca to 74af556 Compare December 1, 2025 15:33
@sunsetxh sunsetxh changed the title [wip]rename gcs_callback_types.h to grpc_callback_types.h rename gcs_callback_types.h to grpc_callback_types.h Dec 1, 2025
@sunsetxh sunsetxh marked this pull request as ready for review December 1, 2025 15:35
/// during the whole lifetime of client.
std::unique_ptr<rpc::ClientCallManager> client_call_manager_;
std::unique_ptr<rpc::RayletClient> raylet_client_;
InstrumentedIOContextWithThread io_context_;
Copy link
Contributor

Choose a reason for hiding this comment

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

It's different from the original design. io_context_ used to be static, so all raylet clients share one io_context_. Now each raylet client creates their own. Consider static it and initialize it only once

Signed-off-by: yuchao-wang <wyc984872769@hotmail.com>
/// during the whole lifetime of client.
std::unique_ptr<rpc::ClientCallManager> client_call_manager_;
std::unique_ptr<rpc::RayletClient> raylet_client_;
inline static InstrumentedIOContextWithThread io_context_{"raylet_client_io_service"};
Copy link

Choose a reason for hiding this comment

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

Bug: Static member changes io_context initialization timing

The io_context_ was changed from a function-local static to a class-level inline static member. While both create a singleton, the initialization timing differs significantly: function-local static uses lazy initialization (thread starts on first use), whereas class-level inline static uses eager initialization (thread starts during static initialization, before main()). Since InstrumentedIOContextWithThread spawns a thread in its constructor, this change causes a background thread to start before the program's main() function runs, which could cause issues with static initialization order or when the code is used from shared libraries. As noted by the reviewer, this differs from the original design intent.

Additional Locations (1)

Fix in Cursor Fix in Web

@jjyao jjyao changed the title rename gcs_callback_types.h to grpc_callback_types.h Move gcs_callback_types.h to rpc_callback_types.h Dec 2, 2025
Copy link
Collaborator

@jjyao jjyao left a comment

Choose a reason for hiding this comment

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

LG. Thanks for the contribution!

// This is to avoid creating multiple threads for multiple clients in python.
static InstrumentedIOContextWithThread io_context("raylet_client_io_service");
instrumented_io_context &io_service = io_context.GetIoService();
instrumented_io_context &io_service = io_context_.GetIoService();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why changing this, seems unrelated to this PR

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah @sunsetxh is fixing your old comments #57004 (comment)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Core]rename src/ray/common/gcs_callback_types.h to grpc_callback_types.h

4 participants