From 5a8d05e6a8d9ce56242b9bfa2f50dd690da1f121 Mon Sep 17 00:00:00 2001 From: Matti Picus Date: Tue, 25 Mar 2025 11:55:58 +0200 Subject: [PATCH 01/33] update to protbuf-28.2, absl-20240722, grpc-1.67 and patch for windows Signed-off-by: Matti Picus --- .bazelrc | 7 +-- bazel/ray_deps_setup.bzl | 30 ++++++------ .../task_event_buffer_export_event_test.cc | 2 +- .../gcs_server/test/gcs_actor_manager_test.cc | 21 +++------ src/ray/raylet_client/raylet_client.cc | 3 +- src/ray/rpc/server_call.h | 2 +- src/ray/util/event.cc | 2 +- .../patches/protobuf-windows-const-nan.patch | 46 +++++++++++++++++++ 8 files changed, 74 insertions(+), 39 deletions(-) create mode 100644 thirdparty/patches/protobuf-windows-const-nan.patch diff --git a/.bazelrc b/.bazelrc index 8c2be7ea8586..03922a248aaa 100644 --- a/.bazelrc +++ b/.bazelrc @@ -11,7 +11,7 @@ build:strict --incompatible_strict_action_env build --action_env=RAY_BUILD_ENV ############################################################################### -# On Windows, provide: BAZEL_SH, and BAZEL_LLVM (if using clang-cl) +# On Windows, provide: BAZEL_SH, and BAZEL_LLVM # On all platforms, provide: PYTHON3_BIN_PATH=python ############################################################################### build:windows --action_env=PATH @@ -20,12 +20,12 @@ build --compilation_mode=opt # Using C++ 17 on all platforms. build:linux --host_cxxopt="-std=c++17" build:macos --host_cxxopt="-std=c++17" -build:clang-cl --host_cxxopt="-std=c++17" +build:clang-cl --host_cxxopt="-std:c++17" build:msvc-cl --host_cxxopt="/std:c++17" build:windows --host_cxxopt="/std:c++17" build:linux --cxxopt="-std=c++17" build:macos --cxxopt="-std=c++17" -build:clang-cl --cxxopt="-std=c++17" +build:clang-cl --cxxopt="-std:c++17" build:msvc-cl --cxxopt="/std:c++17" build:windows --cxxopt="/std:c++17" # This workaround is needed to prevent Bazel from compiling the same file twice (once PIC and once not). @@ -226,3 +226,4 @@ try-import %workspace%/.llvm-local.bazelrc build:macos --sandbox_block_path=/usr/local/ # This option controls whether javac checks for missing direct dependencies. build --experimental_strict_java_deps=off +build:clang-cl --per_file_copt="-external/com_github_redis_hiredis/ssl.c$@-Wno-parenthesis,-Wno-int-conversion" diff --git a/bazel/ray_deps_setup.bzl b/bazel/ray_deps_setup.bzl index 0637dcb6e7e1..c119f8342672 100644 --- a/bazel/ray_deps_setup.bzl +++ b/bazel/ray_deps_setup.bzl @@ -86,20 +86,16 @@ def auto_http_archive( def ray_deps_setup(): # Explicitly bring in protobuf dependency to work around # https://github.com/ray-project/ray/issues/14117 - # This is copied from grpc's bazel/grpc_deps.bzl - # - # Pinned grpc version: v23.4 http_archive( name = "com_google_protobuf", - sha256 = "76a33e2136f23971ce46c72fd697cd94dc9f73d56ab23b753c3e16854c90ddfd", - strip_prefix = "protobuf-2c5fa078d8e86e5f4bd34e6f4c9ea9e8d7d4d44a", + sha256 = "b2340aa47faf7ef10a0328190319d3f3bee1b24f426d4ce8f4253b6f27ce16db", + strip_prefix = "protobuf-28.2", urls = [ - "https://github.com/protocolbuffers/protobuf/archive/2c5fa078d8e86e5f4bd34e6f4c9ea9e8d7d4d44a.tar.gz", + "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v28.2.tar.gz", ], patches = [ - "@com_github_grpc_grpc//third_party:protobuf.patch", + "@com_github_ray_project_ray//thirdparty/patches:protobuf-windows-const-nan.patch", ], - patch_args = ["-p1"], ) # NOTE(lingxuan.zlx): 3rd party dependencies could be accessed, so it suggests @@ -241,10 +237,10 @@ def ray_deps_setup(): # TODO(owner): Upgrade abseil to latest version after protobuf updated, which requires to upgrade `rules_cc` first. auto_http_archive( name = "com_google_absl", - sha256 = "987ce98f02eefbaf930d6e38ab16aa05737234d7afbab2d5c4ea7adbe50c28ed", - strip_prefix = "abseil-cpp-20230802.1", + sha256 = "f50e5ac311a81382da7fa75b97310e4b9006474f9560ac46f54a9967f07d4ae3", + strip_prefix = "abseil-cpp-20240722.0", urls = [ - "https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.1.tar.gz", + "https://github.com/abseil/abseil-cpp/archive/refs/tags/20240722.0.tar.gz", ], ) @@ -265,8 +261,8 @@ def ray_deps_setup(): auto_http_archive( name = "com_github_grpc_grpc", # NOTE: If you update this, also update @boringssl's hash. - url = "https://github.com/grpc/grpc/archive/refs/tags/v1.57.1.tar.gz", - sha256 = "0762f809b9de845e6a7c809cabccad6aa4143479fd43b396611fe5a086c0aeeb", + url = "https://github.com/grpc/grpc/archive/refs/tags/v1.67.1.tar.gz", + sha256 = "d74f8e99a433982a12d7899f6773e285c9824e1d9a173ea1d1fb26c9bd089299", patches = [ "@com_github_ray_project_ray//thirdparty/patches:grpc-cython-copts.patch", "@com_github_ray_project_ray//thirdparty/patches:grpc-zlib-fdopen.patch", @@ -309,13 +305,13 @@ def ray_deps_setup(): http_archive( # This rule is used by @com_github_grpc_grpc, and using a GitHub mirror # provides a deterministic archive hash for caching. Explanation here: - # https://github.com/grpc/grpc/blob/1ff1feaa83e071d87c07827b0a317ffac673794f/bazel/grpc_deps.bzl#L189 # Ensure this rule matches the rule used by grpc's bazel/grpc_deps.bzl + # https://github.com/grpc/grpc/blob/v1.67.1/bazel/grpc_deps.bzl#L33 name = "boringssl", - sha256 = "0675a4f86ce5e959703425d6f9063eaadf6b61b7f3399e77a154c0e85bad46b1", - strip_prefix = "boringssl-342e805bc1f5dfdd650e3f031686d6c939b095d9", + sha256 = "c70d519e4ee709b7a74410a5e3a937428b8198d793a3d771be3dd2086ae167c8", + strip_prefix = "boringssl-b8b3e6e11166719a8ebfa43c0cde9ad7d57a84f6", urls = [ - "https://github.com/google/boringssl/archive/342e805bc1f5dfdd650e3f031686d6c939b095d9.tar.gz", + "https://github.com/google/boringssl/archive/b8b3e6e11166719a8ebfa43c0cde9ad7d57a84f6.tar.gz", ], ) diff --git a/src/ray/core_worker/test/task_event_buffer_export_event_test.cc b/src/ray/core_worker/test/task_event_buffer_export_event_test.cc index f3869be7ffb5..36873eda0fe9 100644 --- a/src/ray/core_worker/test/task_event_buffer_export_event_test.cc +++ b/src/ray/core_worker/test/task_event_buffer_export_event_test.cc @@ -139,7 +139,7 @@ TEST_F(TaskEventTestWriteExport, TestWriteTaskExportEvents) { auto task_ids = GenTaskIDs(num_events); google::protobuf::util::JsonPrintOptions options; options.preserve_proto_field_names = true; - options.always_print_primitive_fields = true; + options.always_print_fields_with_no_presence = true; std::vector source_types = { rpc::ExportEvent_SourceType::ExportEvent_SourceType_EXPORT_TASK}; diff --git a/src/ray/gcs/gcs_server/test/gcs_actor_manager_test.cc b/src/ray/gcs/gcs_server/test/gcs_actor_manager_test.cc index 5ea63a0927e1..864716356841 100644 --- a/src/ray/gcs/gcs_server/test/gcs_actor_manager_test.cc +++ b/src/ray/gcs/gcs_server/test/gcs_actor_manager_test.cc @@ -1198,8 +1198,7 @@ TEST_F(GcsActorManagerTest, TestGetAllActorInfoFilters) { rpc::GetAllActorInfoRequest request; request.mutable_filters()->set_actor_id(actor->GetActorID().Binary()); - auto &reply = - *google::protobuf::Arena::CreateMessage(&arena); + auto &reply = *google::protobuf::Arena::Create(&arena); gcs_actor_manager_->HandleGetAllActorInfo(request, &reply, callback); ASSERT_EQ(reply.actor_table_data().size(), 1); ASSERT_EQ(reply.total(), 1 + num_other_actors); @@ -1211,8 +1210,7 @@ TEST_F(GcsActorManagerTest, TestGetAllActorInfoFilters) { rpc::GetAllActorInfoRequest request; request.mutable_filters()->set_job_id(job_id.Binary()); - auto &reply = - *google::protobuf::Arena::CreateMessage(&arena); + auto &reply = *google::protobuf::Arena::Create(&arena); gcs_actor_manager_->HandleGetAllActorInfo(request, &reply, callback); ASSERT_EQ(reply.actor_table_data().size(), 1); ASSERT_EQ(reply.num_filtered(), num_other_actors); @@ -1223,8 +1221,7 @@ TEST_F(GcsActorManagerTest, TestGetAllActorInfoFilters) { rpc::GetAllActorInfoRequest request; request.mutable_filters()->set_state(rpc::ActorTableData::ALIVE); - auto &reply = - *google::protobuf::Arena::CreateMessage(&arena); + auto &reply = *google::protobuf::Arena::Create(&arena); gcs_actor_manager_->HandleGetAllActorInfo(request, &reply, callback); ASSERT_EQ(reply.actor_table_data().size(), 1); ASSERT_EQ(reply.num_filtered(), num_other_actors); @@ -1236,8 +1233,7 @@ TEST_F(GcsActorManagerTest, TestGetAllActorInfoFilters) { request.mutable_filters()->set_state(rpc::ActorTableData::ALIVE); request.mutable_filters()->set_job_id(job_id.Binary()); - auto &reply = - *google::protobuf::Arena::CreateMessage(&arena); + auto &reply = *google::protobuf::Arena::Create(&arena); gcs_actor_manager_->HandleGetAllActorInfo(request, &reply, callback); ASSERT_EQ(reply.actor_table_data().size(), 1); ASSERT_EQ(reply.num_filtered(), num_other_actors); @@ -1247,8 +1243,7 @@ TEST_F(GcsActorManagerTest, TestGetAllActorInfoFilters) { request.mutable_filters()->set_state(rpc::ActorTableData::DEAD); request.mutable_filters()->set_job_id(job_id.Binary()); - auto &reply = - *google::protobuf::Arena::CreateMessage(&arena); + auto &reply = *google::protobuf::Arena::Create(&arena); gcs_actor_manager_->HandleGetAllActorInfo(request, &reply, callback); ASSERT_EQ(reply.num_filtered(), num_other_actors + 1); ASSERT_EQ(reply.actor_table_data().size(), 0); @@ -1271,8 +1266,7 @@ TEST_F(GcsActorManagerTest, TestGetAllActorInfoLimit) { { rpc::GetAllActorInfoRequest request; - auto &reply = - *google::protobuf::Arena::CreateMessage(&arena); + auto &reply = *google::protobuf::Arena::Create(&arena); auto callback = [](Status status, std::function success, std::function failure) {}; @@ -1280,8 +1274,7 @@ TEST_F(GcsActorManagerTest, TestGetAllActorInfoLimit) { ASSERT_EQ(reply.actor_table_data().size(), 3); request.set_limit(2); - auto &reply_2 = - *google::protobuf::Arena::CreateMessage(&arena); + auto &reply_2 = *google::protobuf::Arena::Create(&arena); gcs_actor_manager_->HandleGetAllActorInfo(request, &reply_2, callback); ASSERT_EQ(reply_2.actor_table_data().size(), 2); ASSERT_EQ(reply_2.total(), 3); diff --git a/src/ray/raylet_client/raylet_client.cc b/src/ray/raylet_client/raylet_client.cc index f81b6134178e..9bdcae9ff2ca 100644 --- a/src/ray/raylet_client/raylet_client.cc +++ b/src/ray/raylet_client/raylet_client.cc @@ -249,8 +249,7 @@ void RayletClient::RequestWorkerLease( const int64_t backlog_size, const bool is_selected_based_on_locality) { google::protobuf::Arena arena; - auto request = - google::protobuf::Arena::CreateMessage(&arena); + auto request = google::protobuf::Arena::Create(&arena); // The unsafe allocating here is actually safe because the life-cycle of // task_spec is longer than request. // Request will be sent before the end of this call, and after that, it won't be diff --git a/src/ray/rpc/server_call.h b/src/ray/rpc/server_call.h index 5cc2e909f04d..b35bc6c8c285 100644 --- a/src/ray/rpc/server_call.h +++ b/src/ray/rpc/server_call.h @@ -193,7 +193,7 @@ class ServerCallImpl : public ServerCall { cluster_id_(cluster_id), start_time_(0), record_metrics_(record_metrics) { - reply_ = google::protobuf::Arena::CreateMessage(&arena_); + reply_ = google::protobuf::Arena::Create(&arena_); // TODO(Yi Cheng) call_name_ sometimes get corrunpted due to memory issues. RAY_CHECK(!call_name_.empty()) << "Call name is empty"; if (record_metrics_) { diff --git a/src/ray/util/event.cc b/src/ray/util/event.cc index e8ce86cea675..7653191a703d 100644 --- a/src/ray/util/event.cc +++ b/src/ray/util/event.cc @@ -140,7 +140,7 @@ std::string LogEventReporter::ExportEventToString(const rpc::ExportEvent &export google::protobuf::util::JsonPrintOptions options; options.preserve_proto_field_names = true; // Required so enum with value 0 is not omitted - options.always_print_primitive_fields = true; + options.always_print_fields_with_no_presence = true; if (export_event.has_task_event_data()) { RAY_CHECK(google::protobuf::util::MessageToJsonString( export_event.task_event_data(), &event_data_as_string, options) diff --git a/thirdparty/patches/protobuf-windows-const-nan.patch b/thirdparty/patches/protobuf-windows-const-nan.patch new file mode 100644 index 000000000000..99b548f49f83 --- /dev/null +++ b/thirdparty/patches/protobuf-windows-const-nan.patch @@ -0,0 +1,46 @@ +diff -u upb/message/internal/message.c /tmp/message.c +--- upb/message/internal/message.c ++++ upb/message/internal/message.c +@@ -19,6 +19,26 @@ + + const float kUpb_FltInfinity = INFINITY; + const double kUpb_Infinity = INFINITY; +-const double kUpb_NaN = NAN; ++ ++// The latest win32 SDKs have an invalid definition of NAN. ++// https://developercommunity.visualstudio.com/t/NAN-is-no-longer-compile-time-constant-i/10688907 ++// ++// Unfortunately, the `0.0 / 0.0` workaround doesn't work in Clang under C23, so ++// try __builtin_nan first, if that exists. ++#ifdef _WIN32 ++#ifdef __has_builtin ++#if __has_builtin(__builtin_nan) ++#define UPB_NAN __builtin_nan("0") ++#endif ++#endif ++#ifndef UPB_NAN ++#define UPB_NAN 0.0 / 0.0 ++#endif ++#else ++// For !_WIN32, assume math.h works. ++#define UPB_NAN NAN ++#endif ++const double kUpb_NaN = UPB_NAN; ++ + + bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need, + +diff --git .bazelrc .bazelrc +--- .bazelrc ++++ .bazelrc +@@ -1,4 +1,9 @@ +-build --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 ++build --enable_platform_specific_config ++build:linux --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 ++build:macos --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 ++build:windows --compiler=clang-cl ++build:windows --cxxopt=-Wno-invalid-offsetof ++build:windows --cxxopt=-std:c++17 --host_cxxopt=-std:c++17 + + build:dbg --compilation_mode=dbg + From 4a98bda067651f1a91c6dec06b34b4572ee77208 Mon Sep 17 00:00:00 2001 From: mattip Date: Tue, 25 Mar 2025 21:23:16 +0200 Subject: [PATCH 02/33] ignore root user error Signed-off-by: mattip --- WORKSPACE | 1 + 1 file changed, 1 insertion(+) diff --git a/WORKSPACE b/WORKSPACE index be7a05ef4371..e89a02fa986b 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -64,6 +64,7 @@ python_register_toolchains( name = "python3_9", python_version = "3.9", register_toolchains = False, + ignore_root_user_error = True, ) load("@python3_9//:defs.bzl", python39 = "interpreter") From 9a823f2b891256cb22dee40577b37167242c0673 Mon Sep 17 00:00:00 2001 From: mattip Date: Fri, 28 Mar 2025 01:13:00 +0200 Subject: [PATCH 03/33] no warning/error on deprecated-declarations Signed-off-by: mattip --- .bazelrc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.bazelrc b/.bazelrc index 03922a248aaa..30880a4eaca5 100644 --- a/.bazelrc +++ b/.bazelrc @@ -52,10 +52,10 @@ build:windows --enable_runfiles # TODO(mehrdadn): Revert the "-\\.(asm|S)$" exclusion when this Bazel bug # for compiling assembly files is fixed on Windows: # https://github.com/bazelbuild/bazel/issues/8924 -# Warnings should be errors -build:linux --per_file_copt="-\\.(asm|S)$@-Werror" -build:macos --per_file_copt="-\\.(asm|S)$@-Werror" -build:clang-cl --per_file_copt="-\\.(asm|S)$@-Werror" +# Warnings should be errors, except for deprecated protobuf CreateMessage use +build:linux --per_file_copt="-\\.(asm|S)$@-Werror,-Wno-deprecated-declarations" +build:macos --per_file_copt="-\\.(asm|S)$@-Werror,-Wno-deprecated-declarations" +build:clang-cl --per_file_copt="-\\.(asm|S)$@-Werror,-Wno-deprecated-declarations" build:msvc-cl --per_file_copt="-\\.(asm|S)$@-WX" # Ignore warnings for protobuf generated files and external projects. build --per_file_copt="\\.pb\\.cc$@-w" From 583a597d342df06dde01b50168d5522eeddeb183 Mon Sep 17 00:00:00 2001 From: mattip Date: Sun, 30 Mar 2025 22:35:50 +0300 Subject: [PATCH 04/33] patch abseil for gcc bug Signed-off-by: mattip --- bazel/ray_deps_setup.bzl | 4 + ...-undefined-sanitizer-compilation-fix.patch | 305 ++++++++++++++++++ 2 files changed, 309 insertions(+) create mode 100644 thirdparty/patches/abseil-gcc-undefined-sanitizer-compilation-fix.patch diff --git a/bazel/ray_deps_setup.bzl b/bazel/ray_deps_setup.bzl index c119f8342672..af11bcfa2479 100644 --- a/bazel/ray_deps_setup.bzl +++ b/bazel/ray_deps_setup.bzl @@ -242,6 +242,10 @@ def ray_deps_setup(): urls = [ "https://github.com/abseil/abseil-cpp/archive/refs/tags/20240722.0.tar.gz", ], + patches = [ + "@com_github_ray_project_ray//thirdparty/patches:abseil-gcc-undefined-sanitizer-compilation-fix.patch", + ], + patch_args = ["-p1"], ) # OpenCensus depends on jupp0r/prometheus-cpp diff --git a/thirdparty/patches/abseil-gcc-undefined-sanitizer-compilation-fix.patch b/thirdparty/patches/abseil-gcc-undefined-sanitizer-compilation-fix.patch new file mode 100644 index 000000000000..3088fdf44b1c --- /dev/null +++ b/thirdparty/patches/abseil-gcc-undefined-sanitizer-compilation-fix.patch @@ -0,0 +1,305 @@ +From 8f23ddaab4c32bdd4e9cf91db25896f0cc58ca12 Mon Sep 17 00:00:00 2001 +From: Petr Matrix at Akamai Technologies +Date: Sun, 30 Mar 2025 22:30:04 +0300 +Subject: [PATCH] abseil undefined sanitizer compilation fix +See https://github.com/abseil/abseil-cpp/issues/1634. The project +considers this a bug in gcc, maybe this patch can be dropped after +updating gcc +--- + absl/container/flat_hash_map.h | 7 ++++--- + absl/container/flat_hash_set.h | 5 +++-- + absl/container/internal/hash_policy_traits.h | 4 ++-- + absl/container/internal/hash_policy_traits_test.cc | 13 +++++++------ + .../internal/raw_hash_set_allocator_test.cc | 5 +++-- + absl/container/internal/raw_hash_set_benchmark.cc | 9 +++++---- + .../internal/raw_hash_set_probe_benchmark.cc | 3 ++- + absl/container/internal/raw_hash_set_test.cc | 13 +++++++------ + absl/container/node_hash_map.h | 7 ++++--- + absl/container/node_hash_set.h | 5 +++-- + 10 files changed, 40 insertions(+), 31 deletions(-) + +diff --git a/absl/container/flat_hash_map.h b/absl/container/flat_hash_map.h +index ebd9ed6..3751ead 100644 +--- a/absl/container/flat_hash_map.h ++++ b/absl/container/flat_hash_map.h +@@ -34,6 +34,7 @@ + + #include + #include ++#include + #include + #include + +@@ -642,10 +643,10 @@ struct FlatHashMapPolicy { + } + + template +- static constexpr HashSlotFn get_hash_slot_fn() { ++ static constexpr std::optional get_hash_slot_fn() { + return memory_internal::IsLayoutCompatible::value +- ? &TypeErasedApplyToSlotFn +- : nullptr; ++ ? std::optional(&TypeErasedApplyToSlotFn) ++ : std::nullopt; + } + + static size_t space_used(const slot_type*) { return 0; } +diff --git a/absl/container/flat_hash_set.h b/absl/container/flat_hash_set.h +index a3e36e0..905f01a 100644 +--- a/absl/container/flat_hash_set.h ++++ b/absl/container/flat_hash_set.h +@@ -34,6 +34,7 @@ + + #include + #include ++#include + #include + #include + +@@ -540,8 +541,8 @@ struct FlatHashSetPolicy { + static size_t space_used(const T*) { return 0; } + + template +- static constexpr HashSlotFn get_hash_slot_fn() { +- return &TypeErasedApplyToSlotFn; ++ static constexpr std::optional get_hash_slot_fn() { ++ return std::optional(&TypeErasedApplyToSlotFn); + } + }; + } // namespace container_internal +diff --git a/absl/container/internal/hash_policy_traits.h b/absl/container/internal/hash_policy_traits.h +index ad835d6..ee3f1ee 100644 +--- a/absl/container/internal/hash_policy_traits.h ++++ b/absl/container/internal/hash_policy_traits.h +@@ -160,9 +160,9 @@ struct hash_policy_traits : common_policy_traits { + // silent error: the address of * will never be NULL [-Werror=address] + #pragma GCC diagnostic ignored "-Waddress" + #endif +- return Policy::template get_hash_slot_fn() == nullptr ++ return !Policy::template get_hash_slot_fn().has_value() + ? &hash_slot_fn_non_type_erased +- : Policy::template get_hash_slot_fn(); ++ : Policy::template get_hash_slot_fn().value(); + #if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic pop + #endif +diff --git a/absl/container/internal/hash_policy_traits_test.cc b/absl/container/internal/hash_policy_traits_test.cc +index 2d2c7c2..6655263 100644 +--- a/absl/container/internal/hash_policy_traits_test.cc ++++ b/absl/container/internal/hash_policy_traits_test.cc +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + + #include "gmock/gmock.h" + #include "gtest/gtest.h" +@@ -46,8 +47,8 @@ struct PolicyWithoutOptionalOps { + static std::function value; + + template +- static constexpr HashSlotFn get_hash_slot_fn() { +- return nullptr; ++ static constexpr std::optional get_hash_slot_fn() { ++ return std::nullopt; + } + }; + +@@ -100,8 +101,8 @@ struct PolicyNoHashFn { + } + + template +- static constexpr HashSlotFn get_hash_slot_fn() { +- return nullptr; ++ static constexpr std::optional get_hash_slot_fn() { ++ return std::nullopt; + } + }; + +@@ -109,8 +110,8 @@ size_t* PolicyNoHashFn::apply_called_count; + + struct PolicyCustomHashFn : PolicyNoHashFn { + template +- static constexpr HashSlotFn get_hash_slot_fn() { +- return &TypeErasedApplyToSlotFn; ++ static constexpr std::optional get_hash_slot_fn() { ++ return std::optional(&TypeErasedApplyToSlotFn); + } + }; + +diff --git a/absl/container/internal/raw_hash_set_allocator_test.cc b/absl/container/internal/raw_hash_set_allocator_test.cc +index 7e7a506..5990789 100644 +--- a/absl/container/internal/raw_hash_set_allocator_test.cc ++++ b/absl/container/internal/raw_hash_set_allocator_test.cc +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -181,8 +182,8 @@ struct Policy { + static slot_type& element(slot_type* slot) { return *slot; } + + template +- static constexpr HashSlotFn get_hash_slot_fn() { +- return nullptr; ++ static constexpr std::optional get_hash_slot_fn() { ++ return std::nullopt; + } + }; + +diff --git a/absl/container/internal/raw_hash_set_benchmark.cc b/absl/container/internal/raw_hash_set_benchmark.cc +index 424b72c..db052da 100644 +--- a/absl/container/internal/raw_hash_set_benchmark.cc ++++ b/absl/container/internal/raw_hash_set_benchmark.cc +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -65,8 +66,8 @@ struct IntPolicy { + } + + template +- static constexpr HashSlotFn get_hash_slot_fn() { +- return nullptr; ++ static constexpr std::optional get_hash_slot_fn() { ++ return std::nullopt; + } + }; + +@@ -128,8 +129,8 @@ class StringPolicy { + } + + template +- static constexpr HashSlotFn get_hash_slot_fn() { +- return nullptr; ++ static constexpr std::optional get_hash_slot_fn() { ++ return std::nullopt; + } + }; + +diff --git a/absl/container/internal/raw_hash_set_probe_benchmark.cc b/absl/container/internal/raw_hash_set_probe_benchmark.cc +index 8f36305..bfd1976 100644 +--- a/absl/container/internal/raw_hash_set_probe_benchmark.cc ++++ b/absl/container/internal/raw_hash_set_probe_benchmark.cc +@@ -16,6 +16,7 @@ + // distributions, all using the default hash function for swisstable. + + #include ++#include + #include // NOLINT + #include + +@@ -73,7 +74,7 @@ struct Policy { + + template + static constexpr auto get_hash_slot_fn() { +- return nullptr; ++ return set::nullopt; + } + }; + +diff --git a/absl/container/internal/raw_hash_set_test.cc b/absl/container/internal/raw_hash_set_test.cc +index f1257d4..45d1692 100644 +--- a/absl/container/internal/raw_hash_set_test.cc ++++ b/absl/container/internal/raw_hash_set_test.cc +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -523,8 +524,8 @@ struct ValuePolicy { + } + + template +- static constexpr HashSlotFn get_hash_slot_fn() { +- return nullptr; ++ static constexpr std::optional get_hash_slot_fn() { ++ return std::nullopt; + } + + static constexpr bool soo_enabled() { return kSoo; } +@@ -631,8 +632,8 @@ class StringPolicy { + } + + template +- static constexpr HashSlotFn get_hash_slot_fn() { +- return nullptr; ++ static constexpr std::optional get_hash_slot_fn() { ++ return std::nullopt; + } + }; + +@@ -1114,8 +1115,8 @@ struct DecomposePolicy { + } + + template +- static constexpr HashSlotFn get_hash_slot_fn() { +- return nullptr; ++ static constexpr std::optional get_hash_slot_fn() { ++ return std::nullopt; + } + }; + +diff --git a/absl/container/node_hash_map.h b/absl/container/node_hash_map.h +index 5615e49..34b6a93 100644 +--- a/absl/container/node_hash_map.h ++++ b/absl/container/node_hash_map.h +@@ -40,6 +40,7 @@ + + #include + #include ++#include + #include + #include + +@@ -640,10 +641,10 @@ class NodeHashMapPolicy + static const Value& value(const value_type* elem) { return elem->second; } + + template +- static constexpr HashSlotFn get_hash_slot_fn() { ++ static constexpr std::optional get_hash_slot_fn() { + return memory_internal::IsLayoutCompatible::value +- ? &TypeErasedDerefAndApplyToSlotFn +- : nullptr; ++ ? std::optional(&TypeErasedDerefAndApplyToSlotFn) ++ : std::nullopt; + } + }; + } // namespace container_internal +diff --git a/absl/container/node_hash_set.h b/absl/container/node_hash_set.h +index 53435ae..40cd71c 100644 +--- a/absl/container/node_hash_set.h ++++ b/absl/container/node_hash_set.h +@@ -39,6 +39,7 @@ + + #include + #include ++#include + #include + + #include "absl/algorithm/container.h" +@@ -534,8 +535,8 @@ struct NodeHashSetPolicy + static size_t element_space_used(const T*) { return sizeof(T); } + + template +- static constexpr HashSlotFn get_hash_slot_fn() { +- return &TypeErasedDerefAndApplyToSlotFn; ++ static constexpr std::optional get_hash_slot_fn() { ++ return std::optional(&TypeErasedDerefAndApplyToSlotFn); + } + }; + } // namespace container_internal +-- +2.43.0 + From 132533862aa57dfd2bc6c74968584ca05ba72a6c Mon Sep 17 00:00:00 2001 From: mattip Date: Sat, 5 Apr 2025 22:25:55 +0300 Subject: [PATCH 05/33] patch grpc to avoid goaway message on shutdown broadcast Signed-off-by: mattip --- bazel/ray_deps_setup.bzl | 1 + .../patches/grpc-avoid-goaway-messages.patch | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 thirdparty/patches/grpc-avoid-goaway-messages.patch diff --git a/bazel/ray_deps_setup.bzl b/bazel/ray_deps_setup.bzl index af11bcfa2479..2509e9e44626 100644 --- a/bazel/ray_deps_setup.bzl +++ b/bazel/ray_deps_setup.bzl @@ -270,6 +270,7 @@ def ray_deps_setup(): patches = [ "@com_github_ray_project_ray//thirdparty/patches:grpc-cython-copts.patch", "@com_github_ray_project_ray//thirdparty/patches:grpc-zlib-fdopen.patch", + "@com_github_ray_project_ray//thirdparty/patches:grpc-avoid-goaway-messages.patch", ], ) diff --git a/thirdparty/patches/grpc-avoid-goaway-messages.patch b/thirdparty/patches/grpc-avoid-goaway-messages.patch new file mode 100644 index 000000000000..0cd558aa0a0e --- /dev/null +++ b/thirdparty/patches/grpc-avoid-goaway-messages.patch @@ -0,0 +1,19 @@ +diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +index d3c5d994c1..1edc7ae29d 100644 +--- src/core/ext/transport/chttp2/transport/chttp2_transport.cc ++++ src/core/ext/transport/chttp2/transport/chttp2_transport.cc +@@ -1176,13 +1176,6 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t, + GRPC_TRACE_LOG(http, INFO) + << "transport " << t << " got goaway with last stream id " + << last_stream_id; +- // We want to log this irrespective of whether http tracing is enabled if we +- // received a GOAWAY with a non NO_ERROR code. +- if (goaway_error != GRPC_HTTP2_NO_ERROR) { +- LOG(INFO) << t->peer_string.as_string_view() << ": Got goaway [" +- << goaway_error +- << "] err=" << grpc_core::StatusToString(t->goaway_error); +- } + if (t->is_client) { + cancel_unstarted_streams(t, t->goaway_error, false); + // Cancel all unseen streams + From 57c4d610872416af543a624890b01b64a93939e0 Mon Sep 17 00:00:00 2001 From: mattip Date: Tue, 8 Apr 2025 20:31:30 +0300 Subject: [PATCH 06/33] remove zlib patch via grpc, the newer grpc uses a later zlib that is fixed Signed-off-by: mattip --- bazel/ray_deps_setup.bzl | 1 - thirdparty/patches/grpc-zlib-fdopen.patch | 13 ------------- 2 files changed, 14 deletions(-) delete mode 100644 thirdparty/patches/grpc-zlib-fdopen.patch diff --git a/bazel/ray_deps_setup.bzl b/bazel/ray_deps_setup.bzl index 2509e9e44626..7b4ef03de1ce 100644 --- a/bazel/ray_deps_setup.bzl +++ b/bazel/ray_deps_setup.bzl @@ -269,7 +269,6 @@ def ray_deps_setup(): sha256 = "d74f8e99a433982a12d7899f6773e285c9824e1d9a173ea1d1fb26c9bd089299", patches = [ "@com_github_ray_project_ray//thirdparty/patches:grpc-cython-copts.patch", - "@com_github_ray_project_ray//thirdparty/patches:grpc-zlib-fdopen.patch", "@com_github_ray_project_ray//thirdparty/patches:grpc-avoid-goaway-messages.patch", ], ) diff --git a/thirdparty/patches/grpc-zlib-fdopen.patch b/thirdparty/patches/grpc-zlib-fdopen.patch deleted file mode 100644 index c48a35bc4ec5..000000000000 --- a/thirdparty/patches/grpc-zlib-fdopen.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -u bazel/grpc_deps.bzl ---- bazel/grpc_deps.bzl -+++ bazel/grpc_deps.bzl -@@ -238,6 +238,9 @@ - "https://storage.googleapis.com/grpc-bazel-mirror/github.com/madler/zlib/archive/04f42ceca40f73e2978b50e93806c2a18c1281fc.tar.gz", - "https://github.com/madler/zlib/archive/04f42ceca40f73e2978b50e93806c2a18c1281fc.tar.gz", - ], -+ patches = [ -+ "@com_github_ray_project_ray//thirdparty/patches:zlib-fdopen.patch", -+ ] - ) - - if "com_google_protobuf" not in native.existing_rules(): \ No newline at end of file From 16d1672398576eb14de088763ce58a8060b4ad27 Mon Sep 17 00:00:00 2001 From: mattip Date: Wed, 9 Apr 2025 09:24:21 +0300 Subject: [PATCH 07/33] use large machine for debug build Signed-off-by: mattip --- .buildkite/core.rayci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/core.rayci.yml b/.buildkite/core.rayci.yml index c820567a46ec..b8d1c7bd1545 100644 --- a/.buildkite/core.rayci.yml +++ b/.buildkite/core.rayci.yml @@ -216,7 +216,7 @@ steps: tags: - python - skip-on-premerge - instance_type: medium + instance_type: large commands: - bazel run //ci/ray_ci:test_in_docker -- //python/ray/tests/... core --install-mask all-ray-libraries From 9aad6b41cd6228a4f51e606ec20d13d8616d05e6 Mon Sep 17 00:00:00 2001 From: Matti Picus Date: Fri, 18 Apr 2025 10:16:36 +0300 Subject: [PATCH 08/33] remove iwyu from build, revert ignoring cpp warnings Signed-off-by: Matti Picus --- .bazelrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.bazelrc b/.bazelrc index 30880a4eaca5..910cf7d44de1 100644 --- a/.bazelrc +++ b/.bazelrc @@ -53,9 +53,9 @@ build:windows --enable_runfiles # for compiling assembly files is fixed on Windows: # https://github.com/bazelbuild/bazel/issues/8924 # Warnings should be errors, except for deprecated protobuf CreateMessage use -build:linux --per_file_copt="-\\.(asm|S)$@-Werror,-Wno-deprecated-declarations" -build:macos --per_file_copt="-\\.(asm|S)$@-Werror,-Wno-deprecated-declarations" -build:clang-cl --per_file_copt="-\\.(asm|S)$@-Werror,-Wno-deprecated-declarations" +build:linux --per_file_copt="-\\.(asm|S)$@-Werror +build:macos --per_file_copt="-\\.(asm|S)$@-Werror +build:clang-cl --per_file_copt="-\\.(asm|S)$@-Werror build:msvc-cl --per_file_copt="-\\.(asm|S)$@-WX" # Ignore warnings for protobuf generated files and external projects. build --per_file_copt="\\.pb\\.cc$@-w" From b2340e62e1c986e3f2a01524e153600bdc4c9d98 Mon Sep 17 00:00:00 2001 From: mattip Date: Sun, 20 Apr 2025 11:40:20 +0300 Subject: [PATCH 09/33] update rules-proto-grpc from before 1.0 to 4.6.0 Signed-off-by: mattip --- bazel/ray_deps_setup.bzl | 4 +- java/BUILD.bazel | 8 +- src/ray/protobuf/BUILD | 155 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 159 insertions(+), 8 deletions(-) diff --git a/bazel/ray_deps_setup.bzl b/bazel/ray_deps_setup.bzl index 7b4ef03de1ce..5b4735dd54ae 100644 --- a/bazel/ray_deps_setup.bzl +++ b/bazel/ray_deps_setup.bzl @@ -333,8 +333,8 @@ def ray_deps_setup(): ) auto_http_archive( name = "rules_proto_grpc", - url = "https://github.com/rules-proto-grpc/rules_proto_grpc/archive/a74fef39c5fe636580083545f76d1eab74f6450d.tar.gz", - sha256 = "2f6606151ec042e23396f07de9e7dcf6ca9a5db1d2b09f0cc93a7fc7f4008d1b", + url = "https://github.com/rules-proto-grpc/rules_proto_grpc/archive/refs/tags/4.6.0.tar.gz", + sha256 = "c0d718f4d892c524025504e67a5bfe83360b3a982e654bc71fed7514eb8ac8ad", repo_mapping = { "@com_google_protobuf": "@com_google_protobuf_rules_proto_grpc", }, diff --git a/java/BUILD.bazel b/java/BUILD.bazel index 8081972d40c7..4da033972afe 100644 --- a/java/BUILD.bazel +++ b/java/BUILD.bazel @@ -236,22 +236,22 @@ java_test( # More detail please see https://github.com/ray-project/ray/pull/21641. java_proto_compile( name = "common_java_proto", - deps = ["@com_github_ray_project_ray//src/ray/protobuf:common_proto"], + protos = ["@com_github_ray_project_ray//src/ray/protobuf:common_proto"], ) java_proto_compile( name = "runtime_env_common_java_proto", - deps = ["@com_github_ray_project_ray//src/ray/protobuf:runtime_env_common_proto"], + protos = ["@com_github_ray_project_ray//src/ray/protobuf:runtime_env_common_proto"], ) java_proto_compile( name = "gcs_java_proto", - deps = ["@com_github_ray_project_ray//src/ray/protobuf:gcs_proto"], + protos = ["@com_github_ray_project_ray//src/ray/protobuf:gcs_proto"], ) java_proto_compile( name = "serve_java_proto", - deps = ["@com_github_ray_project_ray//src/ray/protobuf:serve_proto"], + protos = ["@com_github_ray_project_ray//src/ray/protobuf:serve_proto"], ) filegroup( diff --git a/src/ray/protobuf/BUILD b/src/ray/protobuf/BUILD index d45cb48fd04d..a81f087c7d11 100644 --- a/src/ray/protobuf/BUILD +++ b/src/ray/protobuf/BUILD @@ -18,6 +18,11 @@ cc_proto_library( deps = [":common_proto"], ) +python_grpc_compile( + name = "common_py_proto", + protos = [":common_proto"], +) + proto_library( name = "gcs_proto", srcs = ["gcs.proto"], @@ -33,6 +38,11 @@ proto_library( srcs = ["instance_manager.proto"], ) +python_grpc_compile( + name = "instance_manager_py_proto", + protos = [":instance_manager_proto"], +) + cc_proto_library( name = "instance_manager_cc_proto", deps = [":instance_manager_proto"], @@ -59,17 +69,32 @@ cc_proto_library( deps = [":runtime_env_common_proto"], ) +python_grpc_compile( + name = "runtime_env_common_py_proto", + protos = [":runtime_env_common_proto"], +) + cc_proto_library( name = "gcs_cc_proto", deps = [":gcs_proto"], ) +python_grpc_compile( + name = "gcs_py_proto", + protos = [":gcs_proto"], +) + # Function and class dependencies. proto_library( name = "dependency_proto", srcs = ["dependency.proto"], ) +python_grpc_compile( + name = "dependency_py_proto", + protos = [":dependency_proto"], +) + # Text logging. proto_library( name = "logging_proto", @@ -81,6 +106,11 @@ cc_proto_library( deps = [":logging_proto"], ) +python_grpc_compile( + name = "logging_py_proto", + protos = [":logging_proto"], +) + proto_library( name = "node_manager_proto", srcs = ["node_manager.proto"], @@ -97,6 +127,11 @@ cc_proto_library( deps = [":node_manager_proto"], ) +python_grpc_compile( + name = "node_manager_py_proto", + protos = [":node_manager_proto"], +) + proto_library( name = "reporter_proto", srcs = ["reporter.proto"], @@ -111,6 +146,11 @@ cc_proto_library( deps = [":reporter_proto"], ) +python_grpc_compile( + name = "reporter_py_proto", + protos = [":reporter_proto"], +) + proto_library( name = "gcs_service_proto", srcs = ["gcs_service.proto"], @@ -127,6 +167,11 @@ cc_proto_library( deps = [":gcs_service_proto"], ) +python_grpc_compile( + name = "gcs_service_py_proto", + protos = [":gcs_service_proto"], +) + proto_library( name = "test_service_proto", srcs = ["test_service.proto"], @@ -141,6 +186,11 @@ cc_proto_library( deps = [":test_service_proto"], ) +python_grpc_compile( + name = "test_service_py_proto", + protos = [":test_service_proto"], +) + proto_library( name = "object_manager_proto", srcs = ["object_manager.proto"], @@ -162,6 +212,11 @@ proto_library( ], ) +python_grpc_compile( + name = "core_worker_py_proto", + protos = [":core_worker_proto"], +) + cc_proto_library( name = "worker_cc_proto", deps = ["core_worker_proto"], @@ -187,6 +242,11 @@ cc_proto_library( deps = [":event_proto"], ) +python_grpc_compile( + name = "event_py_proto", + protos = [":event_proto"], +) + proto_library( name = "export_event_proto", srcs = ["export_event.proto"], @@ -206,6 +266,11 @@ cc_proto_library( deps = [":export_event_proto"], ) +python_grpc_compile( + name = "export_event_py_proto", + protos = [":export_event_proto"], +) + proto_library( name = "export_task_event_proto", srcs = ["export_task_event.proto"], @@ -220,6 +285,11 @@ cc_proto_library( deps = [":export_task_event_proto"], ) +python_grpc_compile( + name = "export_task_event_py_proto", + protos = [":export_task_event_proto"], +) + proto_library( name = "export_runtime_env_proto", srcs = ["export_runtime_env.proto"], @@ -230,6 +300,11 @@ cc_proto_library( deps = [":export_runtime_env_proto"], ) +python_grpc_compile( + name = "export_runtime_env_py_proto", + protos = [":export_runtime_env_proto"], +) + proto_library( name = "export_node_event_proto", srcs = ["export_node_data.proto"], @@ -240,6 +315,11 @@ cc_proto_library( deps = [":export_node_event_proto"], ) +python_grpc_compile( + name = "export_node_event_py_proto", + protos = [":export_node_event_proto"], +) + proto_library( name = "export_actor_event_proto", srcs = ["export_actor_data.proto"], @@ -251,6 +331,11 @@ cc_proto_library( deps = [":export_actor_event_proto"], ) +python_grpc_compile( + name = "export_actor_event_py_proto", + protos = [":export_actor_event_proto"], +) + proto_library( name = "export_driver_job_event_proto", srcs = ["export_driver_job_event.proto"], @@ -265,6 +350,11 @@ cc_proto_library( deps = [":export_driver_job_event_proto"], ) +python_grpc_compile( + name = "export_driver_job_event_py_proto", + protos = [":export_driver_job_event_proto"], +) + proto_library( name = "export_submission_job_event_proto", srcs = ["export_submission_job_event.proto"], @@ -275,6 +365,11 @@ cc_proto_library( deps = [":export_submission_job_event_proto"], ) +python_grpc_compile( + name = "export_submission_job_event_py_proto", + protos = [":export_submission_job_event_proto"], +) + proto_library( name = "export_train_state_proto", srcs = ["export_train_state.proto"], @@ -285,6 +380,11 @@ cc_proto_library( deps = [":export_train_state_proto"], ) +python_grpc_compile( + name = "export_train_state_py_proto", + protos = [":export_train_state_proto"], +) + proto_library( name = "export_dataset_metadata_proto", srcs = ["export_dataset_metadata.proto"], @@ -298,6 +398,28 @@ cc_proto_library( deps = [":export_dataset_metadata_proto"], ) +python_grpc_compile( + name = "export_dataset_metadata_py_proto", + deps = [":export_dataset_metadata_proto"], +) + +# Agent manager gRPC lib. +proto_library( + name = "agent_manager_proto", + srcs = ["agent_manager.proto"], + deps = [], +) + +python_grpc_compile( + name = "agent_manager_py_proto", + protos = [":agent_manager_proto"], +) + +cc_proto_library( + name = "agent_manager_cc_proto", + deps = [":agent_manager_proto"], +) + # Ray Client gRPC lib proto_library( name = "ray_client_proto", @@ -305,6 +427,11 @@ proto_library( deps = [":common_proto"], ) +python_grpc_compile( + name = "ray_client_py_proto", + protos = [":ray_client_proto"], +) + # Pubsub proto_library( name = "pubsub_proto", @@ -333,16 +460,37 @@ proto_library( ], ) +python_grpc_compile( + name = "runtime_env_agent_py_proto", + protos = [":runtime_env_agent_proto"], +) + cc_proto_library( name = "runtime_env_agent_cc_proto", deps = [":runtime_env_agent_proto"], ) +proto_library( + name = "serve_proto", + srcs = ["serve.proto"], + visibility = ["//java:__subpackages__"], +) + +python_grpc_compile( + name = "serve_py_proto", + protos = [":serve_proto"], +) + proto_library( name = "usage_proto", srcs = ["usage.proto"], ) +python_grpc_compile( + name = "usage_py_proto", + protos = [":usage_proto"], +) + cc_proto_library( name = "usage_cc_proto", deps = [":usage_proto"], @@ -353,6 +501,11 @@ proto_library( srcs = ["autoscaler.proto"], ) +python_grpc_compile( + name = "autoscaler_py_proto", + protos = [":autoscaler_proto"], +) + cc_proto_library( name = "autoscaler_cc_proto", deps = [":autoscaler_proto"], @@ -418,8 +571,6 @@ proto_library( name = "events_base_event_proto", srcs = ["events_base_event.proto"], deps = [ - ":events_actor_task_definition_event_proto", - ":events_actor_task_execution_event_proto", ":events_task_definition_event_proto", ":events_task_execution_event_proto", "@com_google_protobuf//:timestamp_proto", From 60f7ff38e27519ddb051bb354722eacd705ecc79 Mon Sep 17 00:00:00 2001 From: mattip Date: Mon, 21 Apr 2025 20:21:52 +0300 Subject: [PATCH 10/33] use protobuf 28.2 for java, python Signed-off-by: mattip --- bazel/ray_deps_setup.bzl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bazel/ray_deps_setup.bzl b/bazel/ray_deps_setup.bzl index 5b4735dd54ae..0b7082621c5d 100644 --- a/bazel/ray_deps_setup.bzl +++ b/bazel/ray_deps_setup.bzl @@ -327,10 +327,16 @@ def ray_deps_setup(): # protobuf library that Ray supports. http_archive( name = "com_google_protobuf_rules_proto_grpc", - strip_prefix = "protobuf-3.19.4", - urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.19.4.tar.gz"], - sha256 = "3bd7828aa5af4b13b99c191e8b1e884ebfa9ad371b0ce264605d347f135d2568", + sha256 = "b2340aa47faf7ef10a0328190319d3f3bee1b24f426d4ce8f4253b6f27ce16db", + strip_prefix = "protobuf-28.2", + urls = [ + "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v28.2.tar.gz", + ], + patches = [ + "@com_github_ray_project_ray//thirdparty/patches:protobuf-windows-const-nan.patch", + ], ) + auto_http_archive( name = "rules_proto_grpc", url = "https://github.com/rules-proto-grpc/rules_proto_grpc/archive/refs/tags/4.6.0.tar.gz", From 92d351bf24f4c954cef93d945da9f854e4cf41f8 Mon Sep 17 00:00:00 2001 From: mattip Date: Thu, 22 May 2025 09:23:01 +0300 Subject: [PATCH 11/33] restore global '-Wno-deprecated-declarations', selectively apply patch (from review) Signed-off-by: mattip --- .bazelrc | 6 +++--- bazel/ray_deps_setup.bzl | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.bazelrc b/.bazelrc index 910cf7d44de1..30880a4eaca5 100644 --- a/.bazelrc +++ b/.bazelrc @@ -53,9 +53,9 @@ build:windows --enable_runfiles # for compiling assembly files is fixed on Windows: # https://github.com/bazelbuild/bazel/issues/8924 # Warnings should be errors, except for deprecated protobuf CreateMessage use -build:linux --per_file_copt="-\\.(asm|S)$@-Werror -build:macos --per_file_copt="-\\.(asm|S)$@-Werror -build:clang-cl --per_file_copt="-\\.(asm|S)$@-Werror +build:linux --per_file_copt="-\\.(asm|S)$@-Werror,-Wno-deprecated-declarations" +build:macos --per_file_copt="-\\.(asm|S)$@-Werror,-Wno-deprecated-declarations" +build:clang-cl --per_file_copt="-\\.(asm|S)$@-Werror,-Wno-deprecated-declarations" build:msvc-cl --per_file_copt="-\\.(asm|S)$@-WX" # Ignore warnings for protobuf generated files and external projects. build --per_file_copt="\\.pb\\.cc$@-w" diff --git a/bazel/ray_deps_setup.bzl b/bazel/ray_deps_setup.bzl index 0b7082621c5d..74ff418242ea 100644 --- a/bazel/ray_deps_setup.bzl +++ b/bazel/ray_deps_setup.bzl @@ -93,9 +93,10 @@ def ray_deps_setup(): urls = [ "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v28.2.tar.gz", ], - patches = [ - "@com_github_ray_project_ray//thirdparty/patches:protobuf-windows-const-nan.patch", - ], + patches = select({ + "@platforms//os:windows": ["@com_github_ray_project_ray//thirdparty/patches:protobuf-windows-const-nan.patch"], + "//conditions:default": [], + }), ) # NOTE(lingxuan.zlx): 3rd party dependencies could be accessed, so it suggests From 2c85402e13fd1af96d05fe9014331753a6a1d560 Mon Sep 17 00:00:00 2001 From: mattip Date: Thu, 22 May 2025 23:01:29 +0300 Subject: [PATCH 12/33] patch unconditionally Signed-off-by: mattip --- bazel/ray_deps_setup.bzl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bazel/ray_deps_setup.bzl b/bazel/ray_deps_setup.bzl index 74ff418242ea..0b7082621c5d 100644 --- a/bazel/ray_deps_setup.bzl +++ b/bazel/ray_deps_setup.bzl @@ -93,10 +93,9 @@ def ray_deps_setup(): urls = [ "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v28.2.tar.gz", ], - patches = select({ - "@platforms//os:windows": ["@com_github_ray_project_ray//thirdparty/patches:protobuf-windows-const-nan.patch"], - "//conditions:default": [], - }), + patches = [ + "@com_github_ray_project_ray//thirdparty/patches:protobuf-windows-const-nan.patch", + ], ) # NOTE(lingxuan.zlx): 3rd party dependencies could be accessed, so it suggests From 3a9f3a312b0ae5f4dfdfaedefc65506fef9d1f72 Mon Sep 17 00:00:00 2001 From: mattip Date: Thu, 22 May 2025 23:31:56 +0300 Subject: [PATCH 13/33] update protobuf compile rule update for python Signed-off-by: mattip --- src/ray/protobuf/BUILD | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/ray/protobuf/BUILD b/src/ray/protobuf/BUILD index a81f087c7d11..28fa46e8a6ab 100644 --- a/src/ray/protobuf/BUILD +++ b/src/ray/protobuf/BUILD @@ -400,7 +400,7 @@ cc_proto_library( python_grpc_compile( name = "export_dataset_metadata_py_proto", - deps = [":export_dataset_metadata_proto"], + protos = [":export_dataset_metadata_proto"], ) # Agent manager gRPC lib. @@ -525,6 +525,11 @@ cc_proto_library( deps = [":events_actor_task_definition_event_proto"], ) +python_grpc_compile( + name = "events_actor_task_definition_event_py_proto", + protos = [":events_actor_task_definition_event_proto"], +) + proto_library( name = "events_actor_task_execution_event_proto", srcs = ["events_actor_task_execution_event.proto"], @@ -539,6 +544,11 @@ cc_proto_library( deps = [":events_actor_task_execution_event_proto"], ) +python_grpc_compile( + name = "events_actor_task_execution_event_py_proto", + protos = [":events_actor_task_execution_event_proto"], +) + proto_library( name = "events_task_definition_event_proto", srcs = ["events_task_definition_event.proto"], @@ -553,6 +563,11 @@ cc_proto_library( deps = [":events_task_definition_event_proto"], ) +python_grpc_compile( + name = "events_task_definition_event_py_proto", + protos = [":events_task_definition_event_proto"], +) + proto_library( name = "events_task_execution_event_proto", srcs = ["events_task_execution_event.proto"], @@ -567,6 +582,11 @@ cc_proto_library( deps = [":events_task_execution_event_proto"], ) +python_grpc_compile( + name = "events_task_execution_event_py_proto", + protos = [":events_task_execution_event_proto"], +) + proto_library( name = "events_base_event_proto", srcs = ["events_base_event.proto"], @@ -582,6 +602,11 @@ cc_proto_library( deps = [":events_base_event_proto"], ) +python_grpc_compile( + name = "events_base_event_py_proto", + protos = [":events_base_event_proto"], +) + proto_library( name = "events_event_aggregator_service_proto", srcs = ["events_event_aggregator_service.proto"], @@ -633,4 +658,6 @@ proto_library( python_grpc_compile( name = "serve_py_proto", deps = [":serve_proto"], + name = "events_event_aggregator_service_py_proto", + protos = [":events_event_aggregator_service_proto"], ) From 3b6ca0a4b1752ba13e1838082fc45d44d4923ee7 Mon Sep 17 00:00:00 2001 From: mattip Date: Fri, 23 May 2025 10:13:28 +0300 Subject: [PATCH 14/33] update java protobuf version, fix 'cannot be null' errors Signed-off-by: mattip --- java/dependencies.bzl | 4 ++-- .../ray/runtime/task/LocalModeTaskSubmitter.java | 1 - .../io/ray/serve/config/DeploymentConfig.java | 2 +- .../java/io/ray/serve/poll/LongPollResult.java | 16 +++++++--------- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/java/dependencies.bzl b/java/dependencies.bzl index 21c621af9b07..3324ebda8e80 100644 --- a/java/dependencies.bzl +++ b/java/dependencies.bzl @@ -8,8 +8,8 @@ def gen_java_deps(): "com.github.java-json-tools:json-schema-validator:2.2.14", "com.google.code.gson:gson:2.9.1", "com.google.guava:guava:32.0.1-jre", - "com.google.protobuf:protobuf-java:3.23.4", - "com.google.protobuf:protobuf-java-util:3.23.4", + "com.google.protobuf:protobuf-java:4.28.2", + "com.google.protobuf:protobuf-java-util:4.28.2", "com.puppycrawl.tools:checkstyle:8.15", "com.sun.xml.bind:jaxb-core:2.3.0", "com.sun.xml.bind:jaxb-impl:2.3.0", diff --git a/java/runtime/src/main/java/io/ray/runtime/task/LocalModeTaskSubmitter.java b/java/runtime/src/main/java/io/ray/runtime/task/LocalModeTaskSubmitter.java index 6390e4dd2e08..1d2142b9905f 100644 --- a/java/runtime/src/main/java/io/ray/runtime/task/LocalModeTaskSubmitter.java +++ b/java/runtime/src/main/java/io/ray/runtime/task/LocalModeTaskSubmitter.java @@ -90,7 +90,6 @@ private static final class ActorExecutorService { public ActorExecutorService(TaskSpec taskSpec) { ActorCreationTaskSpec actorCreationTaskSpec = taskSpec.getActorCreationTaskSpec(); - Preconditions.checkNotNull(actorCreationTaskSpec); final List concurrencyGroups = actorCreationTaskSpec.getConcurrencyGroupsList(); concurrencyGroups.forEach( diff --git a/java/serve/src/main/java/io/ray/serve/config/DeploymentConfig.java b/java/serve/src/main/java/io/ray/serve/config/DeploymentConfig.java index 50e5fa5297f3..d09481123229 100644 --- a/java/serve/src/main/java/io/ray/serve/config/DeploymentConfig.java +++ b/java/serve/src/main/java/io/ray/serve/config/DeploymentConfig.java @@ -289,7 +289,7 @@ public static DeploymentConfig fromProto(io.ray.serve.generated.DeploymentConfig Lists.newArrayList(DeploymentLanguage.values()))); } deploymentConfig.setDeploymentLanguage(proto.getDeploymentLanguage()); - if (proto.getUserConfig() != null && proto.getUserConfig().size() != 0) { + if (proto.getUserConfig().size() != 0) { deploymentConfig.setUserConfig( MessagePackSerializer.decode( proto.getUserConfig().toByteArray(), Object.class)); // TODO-xlang diff --git a/java/serve/src/main/java/io/ray/serve/poll/LongPollResult.java b/java/serve/src/main/java/io/ray/serve/poll/LongPollResult.java index ca6d3c4ce5c8..a7e6fc997144 100644 --- a/java/serve/src/main/java/io/ray/serve/poll/LongPollResult.java +++ b/java/serve/src/main/java/io/ray/serve/poll/LongPollResult.java @@ -34,16 +34,14 @@ public static LongPollResult parseFrom(byte[] longPollResultBytes) { return null; } LongPollResult longPollResult = new LongPollResult(); - if (pbLongPollResult.getUpdatedObjectsMap() != null) { - Map updatedObjects = - new HashMap<>(pbLongPollResult.getUpdatedObjectsMap().size()); - for (Map.Entry entry : - pbLongPollResult.getUpdatedObjectsMap().entrySet()) { - KeyType keyType = KeyType.parseFrom(entry.getKey()); - updatedObjects.put(keyType, UpdatedObject.parseFrom(keyType, entry.getValue())); - } - longPollResult.setUpdatedObjects(updatedObjects); + Map updatedObjects = + new HashMap<>(pbLongPollResult.getUpdatedObjectsMap().size()); + for (Map.Entry entry : + pbLongPollResult.getUpdatedObjectsMap().entrySet()) { + KeyType keyType = KeyType.parseFrom(entry.getKey()); + updatedObjects.put(keyType, UpdatedObject.parseFrom(keyType, entry.getValue())); } + longPollResult.setUpdatedObjects(updatedObjects); return longPollResult; } } From 1854875e620a4f74d3516e9af4fbe0238329914f Mon Sep 17 00:00:00 2001 From: mattip Date: Fri, 23 May 2025 14:57:19 +0300 Subject: [PATCH 15/33] update python protobuf package to >=4.25.7 Signed-off-by: mattip --- python/setup.py | 2 +- release/requirements.txt | 2 +- release/requirements_buildkite.in | 2 +- release/setup.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python/setup.py b/python/setup.py index 18eb95a7c0db..cff8ae0ea5be 100644 --- a/python/setup.py +++ b/python/setup.py @@ -383,7 +383,7 @@ def get_packages(self): "jsonschema", "msgpack >= 1.0.0, < 2.0.0", "packaging", - "protobuf >= 3.15.3, != 3.19.5", + "protobuf >= 4.25.7,<6.0.0", "pyyaml", "requests", ] diff --git a/release/requirements.txt b/release/requirements.txt index b78f157c77f9..383024ce4442 100644 --- a/release/requirements.txt +++ b/release/requirements.txt @@ -16,7 +16,7 @@ python-dotenv PyGithub expiringdict requests -protobuf >= 3.15.3, != 3.19.5 +protobuf >= 4.25.7,<6.0.0 pytz retry kubernetes diff --git a/release/requirements_buildkite.in b/release/requirements_buildkite.in index 891e5d511167..bf4b648d3146 100644 --- a/release/requirements_buildkite.in +++ b/release/requirements_buildkite.in @@ -8,7 +8,7 @@ click freezegun google-cloud-storage jinja2 -protobuf >= 3.15.3, != 3.19.5 +protobuf >= 4.25.7,<6.0.0 pytest pyyaml pybuildkite diff --git a/release/setup.py b/release/setup.py index 3e2c5144027e..d87de459e941 100644 --- a/release/setup.py +++ b/release/setup.py @@ -23,7 +23,7 @@ "freezegun", "google-cloud-storage", "jinja2", - "protobuf >= 3.15.3, != 3.19.5", + "protobuf >= 4.25.7,<6.0.0", "pytest", "pyyaml", "pybuildkite", From 4576ae253b045e0fc8692e130d8acc1f99268dbc Mon Sep 17 00:00:00 2001 From: mattip Date: Fri, 23 May 2025 18:13:21 +0300 Subject: [PATCH 16/33] add missing pubsub_proto python module Signed-off-by: mattip --- BUILD.bazel | 19 +++++++++++++++++++ src/ray/protobuf/BUILD | 5 +++++ 2 files changed, 24 insertions(+) diff --git a/BUILD.bazel b/BUILD.bazel index 078eda8c97a4..6d71e7b6d6ff 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1016,6 +1016,25 @@ filegroup( name = "core_py_proto", srcs = ["//src/ray/protobuf:core_py_proto"], visibility = ["//visibility:private"], + srcs = [ + "//src/ray/protobuf:agent_manager_py_proto", + "//src/ray/protobuf:autoscaler_py_proto", + "//src/ray/protobuf:common_py_proto", + "//src/ray/protobuf:core_worker_py_proto", + "//src/ray/protobuf:event_py_proto", + "//src/ray/protobuf:events_event_aggregator_service_py_proto", + "//src/ray/protobuf:export_event_py_proto", + "//src/ray/protobuf:gcs_py_proto", + "//src/ray/protobuf:gcs_service_py_proto", + "//src/ray/protobuf:instance_manager_py_proto", + "//src/ray/protobuf:node_manager_py_proto", + "//src/ray/protobuf:pubsub_py_proto", + "//src/ray/protobuf:ray_client_py_proto", + "//src/ray/protobuf:reporter_py_proto", + "//src/ray/protobuf:runtime_env_agent_py_proto", + "//src/ray/protobuf:runtime_env_common_py_proto", + "//src/ray/protobuf:usage_py_proto", + ], ) filegroup( diff --git a/src/ray/protobuf/BUILD b/src/ray/protobuf/BUILD index 28fa46e8a6ab..82c006c128b4 100644 --- a/src/ray/protobuf/BUILD +++ b/src/ray/protobuf/BUILD @@ -450,6 +450,11 @@ cc_proto_library( deps = [":pubsub_proto"], ) +python_grpc_compile( + name = "pubsub_py_proto", + protos = [":pubsub_proto"], +) + # runtime env agent gRPC lib. proto_library( name = "runtime_env_agent_proto", From cefa898b72a2819b232ea06e63c9c0840ae2af45 Mon Sep 17 00:00:00 2001 From: mattip Date: Sat, 24 May 2025 10:30:34 +0300 Subject: [PATCH 17/33] limit cpu use in build Signed-off-by: mattip --- .bazelrc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.bazelrc b/.bazelrc index 30880a4eaca5..c3ef2ea57bff 100644 --- a/.bazelrc +++ b/.bazelrc @@ -52,10 +52,10 @@ build:windows --enable_runfiles # TODO(mehrdadn): Revert the "-\\.(asm|S)$" exclusion when this Bazel bug # for compiling assembly files is fixed on Windows: # https://github.com/bazelbuild/bazel/issues/8924 -# Warnings should be errors, except for deprecated protobuf CreateMessage use -build:linux --per_file_copt="-\\.(asm|S)$@-Werror,-Wno-deprecated-declarations" -build:macos --per_file_copt="-\\.(asm|S)$@-Werror,-Wno-deprecated-declarations" -build:clang-cl --per_file_copt="-\\.(asm|S)$@-Werror,-Wno-deprecated-declarations" +# Warnings should be errors +build:linux --per_file_copt="-\\.(asm|S)$@-Werror" +build:macos --per_file_copt="-\\.(asm|S)$@-Werror" +build:clang-cl --per_file_copt="-\\.(asm|S)$@-Werror" build:msvc-cl --per_file_copt="-\\.(asm|S)$@-WX" # Ignore warnings for protobuf generated files and external projects. build --per_file_copt="\\.pb\\.cc$@-w" @@ -227,3 +227,4 @@ build:macos --sandbox_block_path=/usr/local/ # This option controls whether javac checks for missing direct dependencies. build --experimental_strict_java_deps=off build:clang-cl --per_file_copt="-external/com_github_redis_hiredis/ssl.c$@-Wno-parenthesis,-Wno-int-conversion" +build --local_cpu_resources=HOST_CPUS*0.75 From 4b9a295498bba711e550c5b5553c4d77d82ff97b Mon Sep 17 00:00:00 2001 From: mattip Date: Sat, 24 May 2025 23:17:36 +0300 Subject: [PATCH 18/33] add more protobuf to all_py_proto for lint tests Signed-off-by: mattip --- .bazelrc | 8 ++++---- BUILD.bazel | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.bazelrc b/.bazelrc index c3ef2ea57bff..fb72dc7c79cf 100644 --- a/.bazelrc +++ b/.bazelrc @@ -52,10 +52,10 @@ build:windows --enable_runfiles # TODO(mehrdadn): Revert the "-\\.(asm|S)$" exclusion when this Bazel bug # for compiling assembly files is fixed on Windows: # https://github.com/bazelbuild/bazel/issues/8924 -# Warnings should be errors -build:linux --per_file_copt="-\\.(asm|S)$@-Werror" -build:macos --per_file_copt="-\\.(asm|S)$@-Werror" -build:clang-cl --per_file_copt="-\\.(asm|S)$@-Werror" +# Warnings should be errors, except for deprecated protobuf CreateMessage use +build:linux --per_file_copt="-\\.(asm|S)$@-Werror,-Wno-deprecated-declarations" +build:macos --per_file_copt="-\\.(asm|S)$@-Werror,-Wno-deprecated-declarations" +build:clang-cl --per_file_copt="-\\.(asm|S)$@-Werror,-Wno-deprecated-declarations" build:msvc-cl --per_file_copt="-\\.(asm|S)$@-WX" # Ignore warnings for protobuf generated files and external projects. build --per_file_copt="\\.pb\\.cc$@-w" diff --git a/BUILD.bazel b/BUILD.bazel index 6d71e7b6d6ff..5b82bf657fb0 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1021,18 +1021,35 @@ filegroup( "//src/ray/protobuf:autoscaler_py_proto", "//src/ray/protobuf:common_py_proto", "//src/ray/protobuf:core_worker_py_proto", + "//src/ray/protobuf:dependency_py_proto", "//src/ray/protobuf:event_py_proto", + "//src/ray/protobuf:events_actor_task_definition_event_py_proto", + "//src/ray/protobuf:events_actor_task_execution_event_py_proto", + "//src/ray/protobuf:events_base_event_py_proto", "//src/ray/protobuf:events_event_aggregator_service_py_proto", + "//src/ray/protobuf:events_task_definition_event_py_proto", + "//src/ray/protobuf:events_task_execution_event_py_proto", + "//src/ray/protobuf:export_actor_event_py_proto", + "//src/ray/protobuf:export_dataset_metadata_py_proto", + "//src/ray/protobuf:export_driver_job_event_py_proto", "//src/ray/protobuf:export_event_py_proto", + "//src/ray/protobuf:export_node_event_py_proto", + "//src/ray/protobuf:export_runtime_env_py_proto", + "//src/ray/protobuf:export_submission_job_event_py_proto", + "//src/ray/protobuf:export_task_event_py_proto", + "//src/ray/protobuf:export_train_state_py_proto", "//src/ray/protobuf:gcs_py_proto", "//src/ray/protobuf:gcs_service_py_proto", "//src/ray/protobuf:instance_manager_py_proto", + "//src/ray/protobuf:logging_py_proto", "//src/ray/protobuf:node_manager_py_proto", "//src/ray/protobuf:pubsub_py_proto", "//src/ray/protobuf:ray_client_py_proto", "//src/ray/protobuf:reporter_py_proto", "//src/ray/protobuf:runtime_env_agent_py_proto", "//src/ray/protobuf:runtime_env_common_py_proto", + "//src/ray/protobuf:serve_py_proto", + "//src/ray/protobuf:test_service_py_proto", "//src/ray/protobuf:usage_py_proto", ], ) From 599e32a471600060c1ca528afdf7aaa37faa6d7f Mon Sep 17 00:00:00 2001 From: mattip Date: Sun, 25 May 2025 09:57:11 +0300 Subject: [PATCH 19/33] update python protobuf to >=5.28.0 Signed-off-by: mattip --- python/setup.py | 2 +- release/requirements.txt | 2 +- release/requirements_buildkite.in | 2 +- release/setup.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python/setup.py b/python/setup.py index cff8ae0ea5be..31ce2c8650c6 100644 --- a/python/setup.py +++ b/python/setup.py @@ -383,7 +383,7 @@ def get_packages(self): "jsonschema", "msgpack >= 1.0.0, < 2.0.0", "packaging", - "protobuf >= 4.25.7,<6.0.0", + "protobuf >= 5.28.0,<6.0.0", "pyyaml", "requests", ] diff --git a/release/requirements.txt b/release/requirements.txt index 383024ce4442..703b5db587c9 100644 --- a/release/requirements.txt +++ b/release/requirements.txt @@ -16,7 +16,7 @@ python-dotenv PyGithub expiringdict requests -protobuf >= 4.25.7,<6.0.0 +protobuf >= 5.28.0,<6.0.0 pytz retry kubernetes diff --git a/release/requirements_buildkite.in b/release/requirements_buildkite.in index bf4b648d3146..528c427f559e 100644 --- a/release/requirements_buildkite.in +++ b/release/requirements_buildkite.in @@ -8,7 +8,7 @@ click freezegun google-cloud-storage jinja2 -protobuf >= 4.25.7,<6.0.0 +protobuf >= 5.28.0,<6.0.0 pytest pyyaml pybuildkite diff --git a/release/setup.py b/release/setup.py index d87de459e941..5868fed3d5ce 100644 --- a/release/setup.py +++ b/release/setup.py @@ -23,7 +23,7 @@ "freezegun", "google-cloud-storage", "jinja2", - "protobuf >= 4.25.7,<6.0.0", + "protobuf >= 5.28.0,<6.0.0", "pytest", "pyyaml", "pybuildkite", From 78668700899e2ffc885689b58f2f0c028071d453 Mon Sep 17 00:00:00 2001 From: mattip Date: Fri, 30 May 2025 09:03:56 +0300 Subject: [PATCH 20/33] do not change the base protobuf version (from review) Signed-off-by: mattip --- bazel/ray_deps_setup.bzl | 15 +++---- java/BUILD.bazel | 8 ++-- python/setup.py | 2 +- release/requirements.txt | 2 +- release/requirements_buildkite.in | 2 +- release/setup.py | 2 +- src/ray/protobuf/BUILD | 68 +++++++++++++++---------------- 7 files changed, 47 insertions(+), 52 deletions(-) diff --git a/bazel/ray_deps_setup.bzl b/bazel/ray_deps_setup.bzl index 0b7082621c5d..66871ba016b4 100644 --- a/bazel/ray_deps_setup.bzl +++ b/bazel/ray_deps_setup.bzl @@ -327,20 +327,15 @@ def ray_deps_setup(): # protobuf library that Ray supports. http_archive( name = "com_google_protobuf_rules_proto_grpc", - sha256 = "b2340aa47faf7ef10a0328190319d3f3bee1b24f426d4ce8f4253b6f27ce16db", - strip_prefix = "protobuf-28.2", - urls = [ - "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v28.2.tar.gz", - ], - patches = [ - "@com_github_ray_project_ray//thirdparty/patches:protobuf-windows-const-nan.patch", - ], + strip_prefix = "protobuf-3.19.4", + urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.19.4.tar.gz"], + sha256 = "3bd7828aa5af4b13b99c191e8b1e884ebfa9ad371b0ce264605d347f135d2568", ) auto_http_archive( name = "rules_proto_grpc", - url = "https://github.com/rules-proto-grpc/rules_proto_grpc/archive/refs/tags/4.6.0.tar.gz", - sha256 = "c0d718f4d892c524025504e67a5bfe83360b3a982e654bc71fed7514eb8ac8ad", + url = "https://github.com/rules-proto-grpc/rules_proto_grpc/archive/a74fef39c5fe636580083545f76d1eab74f6450d.tar.gz", + sha256 = "2f6606151ec042e23396f07de9e7dcf6ca9a5db1d2b09f0cc93a7fc7f4008d1b", repo_mapping = { "@com_google_protobuf": "@com_google_protobuf_rules_proto_grpc", }, diff --git a/java/BUILD.bazel b/java/BUILD.bazel index 4da033972afe..8081972d40c7 100644 --- a/java/BUILD.bazel +++ b/java/BUILD.bazel @@ -236,22 +236,22 @@ java_test( # More detail please see https://github.com/ray-project/ray/pull/21641. java_proto_compile( name = "common_java_proto", - protos = ["@com_github_ray_project_ray//src/ray/protobuf:common_proto"], + deps = ["@com_github_ray_project_ray//src/ray/protobuf:common_proto"], ) java_proto_compile( name = "runtime_env_common_java_proto", - protos = ["@com_github_ray_project_ray//src/ray/protobuf:runtime_env_common_proto"], + deps = ["@com_github_ray_project_ray//src/ray/protobuf:runtime_env_common_proto"], ) java_proto_compile( name = "gcs_java_proto", - protos = ["@com_github_ray_project_ray//src/ray/protobuf:gcs_proto"], + deps = ["@com_github_ray_project_ray//src/ray/protobuf:gcs_proto"], ) java_proto_compile( name = "serve_java_proto", - protos = ["@com_github_ray_project_ray//src/ray/protobuf:serve_proto"], + deps = ["@com_github_ray_project_ray//src/ray/protobuf:serve_proto"], ) filegroup( diff --git a/python/setup.py b/python/setup.py index 31ce2c8650c6..18eb95a7c0db 100644 --- a/python/setup.py +++ b/python/setup.py @@ -383,7 +383,7 @@ def get_packages(self): "jsonschema", "msgpack >= 1.0.0, < 2.0.0", "packaging", - "protobuf >= 5.28.0,<6.0.0", + "protobuf >= 3.15.3, != 3.19.5", "pyyaml", "requests", ] diff --git a/release/requirements.txt b/release/requirements.txt index 703b5db587c9..b78f157c77f9 100644 --- a/release/requirements.txt +++ b/release/requirements.txt @@ -16,7 +16,7 @@ python-dotenv PyGithub expiringdict requests -protobuf >= 5.28.0,<6.0.0 +protobuf >= 3.15.3, != 3.19.5 pytz retry kubernetes diff --git a/release/requirements_buildkite.in b/release/requirements_buildkite.in index 528c427f559e..891e5d511167 100644 --- a/release/requirements_buildkite.in +++ b/release/requirements_buildkite.in @@ -8,7 +8,7 @@ click freezegun google-cloud-storage jinja2 -protobuf >= 5.28.0,<6.0.0 +protobuf >= 3.15.3, != 3.19.5 pytest pyyaml pybuildkite diff --git a/release/setup.py b/release/setup.py index 5868fed3d5ce..3e2c5144027e 100644 --- a/release/setup.py +++ b/release/setup.py @@ -23,7 +23,7 @@ "freezegun", "google-cloud-storage", "jinja2", - "protobuf >= 5.28.0,<6.0.0", + "protobuf >= 3.15.3, != 3.19.5", "pytest", "pyyaml", "pybuildkite", diff --git a/src/ray/protobuf/BUILD b/src/ray/protobuf/BUILD index 82c006c128b4..aff2318a2434 100644 --- a/src/ray/protobuf/BUILD +++ b/src/ray/protobuf/BUILD @@ -20,7 +20,7 @@ cc_proto_library( python_grpc_compile( name = "common_py_proto", - protos = [":common_proto"], + deps = [":common_proto"], ) proto_library( @@ -40,7 +40,7 @@ proto_library( python_grpc_compile( name = "instance_manager_py_proto", - protos = [":instance_manager_proto"], + deps = [":instance_manager_proto"], ) cc_proto_library( @@ -71,7 +71,7 @@ cc_proto_library( python_grpc_compile( name = "runtime_env_common_py_proto", - protos = [":runtime_env_common_proto"], + deps = [":runtime_env_common_proto"], ) cc_proto_library( @@ -81,7 +81,7 @@ cc_proto_library( python_grpc_compile( name = "gcs_py_proto", - protos = [":gcs_proto"], + deps = [":gcs_proto"], ) # Function and class dependencies. @@ -92,7 +92,7 @@ proto_library( python_grpc_compile( name = "dependency_py_proto", - protos = [":dependency_proto"], + deps = [":dependency_proto"], ) # Text logging. @@ -108,7 +108,7 @@ cc_proto_library( python_grpc_compile( name = "logging_py_proto", - protos = [":logging_proto"], + deps = [":logging_proto"], ) proto_library( @@ -129,7 +129,7 @@ cc_proto_library( python_grpc_compile( name = "node_manager_py_proto", - protos = [":node_manager_proto"], + deps = [":node_manager_proto"], ) proto_library( @@ -148,7 +148,7 @@ cc_proto_library( python_grpc_compile( name = "reporter_py_proto", - protos = [":reporter_proto"], + deps = [":reporter_proto"], ) proto_library( @@ -169,7 +169,7 @@ cc_proto_library( python_grpc_compile( name = "gcs_service_py_proto", - protos = [":gcs_service_proto"], + deps = [":gcs_service_proto"], ) proto_library( @@ -188,7 +188,7 @@ cc_proto_library( python_grpc_compile( name = "test_service_py_proto", - protos = [":test_service_proto"], + deps = [":test_service_proto"], ) proto_library( @@ -214,7 +214,7 @@ proto_library( python_grpc_compile( name = "core_worker_py_proto", - protos = [":core_worker_proto"], + deps = [":core_worker_proto"], ) cc_proto_library( @@ -244,7 +244,7 @@ cc_proto_library( python_grpc_compile( name = "event_py_proto", - protos = [":event_proto"], + deps = [":event_proto"], ) proto_library( @@ -268,7 +268,7 @@ cc_proto_library( python_grpc_compile( name = "export_event_py_proto", - protos = [":export_event_proto"], + deps = [":export_event_proto"], ) proto_library( @@ -287,7 +287,7 @@ cc_proto_library( python_grpc_compile( name = "export_task_event_py_proto", - protos = [":export_task_event_proto"], + deps = [":export_task_event_proto"], ) proto_library( @@ -302,7 +302,7 @@ cc_proto_library( python_grpc_compile( name = "export_runtime_env_py_proto", - protos = [":export_runtime_env_proto"], + deps = [":export_runtime_env_proto"], ) proto_library( @@ -317,7 +317,7 @@ cc_proto_library( python_grpc_compile( name = "export_node_event_py_proto", - protos = [":export_node_event_proto"], + deps = [":export_node_event_proto"], ) proto_library( @@ -333,7 +333,7 @@ cc_proto_library( python_grpc_compile( name = "export_actor_event_py_proto", - protos = [":export_actor_event_proto"], + deps = [":export_actor_event_proto"], ) proto_library( @@ -352,7 +352,7 @@ cc_proto_library( python_grpc_compile( name = "export_driver_job_event_py_proto", - protos = [":export_driver_job_event_proto"], + deps = [":export_driver_job_event_proto"], ) proto_library( @@ -367,7 +367,7 @@ cc_proto_library( python_grpc_compile( name = "export_submission_job_event_py_proto", - protos = [":export_submission_job_event_proto"], + deps = [":export_submission_job_event_proto"], ) proto_library( @@ -382,7 +382,7 @@ cc_proto_library( python_grpc_compile( name = "export_train_state_py_proto", - protos = [":export_train_state_proto"], + deps = [":export_train_state_proto"], ) proto_library( @@ -400,7 +400,7 @@ cc_proto_library( python_grpc_compile( name = "export_dataset_metadata_py_proto", - protos = [":export_dataset_metadata_proto"], + deps = [":export_dataset_metadata_proto"], ) # Agent manager gRPC lib. @@ -412,7 +412,7 @@ proto_library( python_grpc_compile( name = "agent_manager_py_proto", - protos = [":agent_manager_proto"], + deps = [":agent_manager_proto"], ) cc_proto_library( @@ -429,7 +429,7 @@ proto_library( python_grpc_compile( name = "ray_client_py_proto", - protos = [":ray_client_proto"], + deps = [":ray_client_proto"], ) # Pubsub @@ -452,7 +452,7 @@ cc_proto_library( python_grpc_compile( name = "pubsub_py_proto", - protos = [":pubsub_proto"], + deps = [":pubsub_proto"], ) # runtime env agent gRPC lib. @@ -467,7 +467,7 @@ proto_library( python_grpc_compile( name = "runtime_env_agent_py_proto", - protos = [":runtime_env_agent_proto"], + deps = [":runtime_env_agent_proto"], ) cc_proto_library( @@ -483,7 +483,7 @@ proto_library( python_grpc_compile( name = "serve_py_proto", - protos = [":serve_proto"], + deps = [":serve_proto"], ) proto_library( @@ -493,7 +493,7 @@ proto_library( python_grpc_compile( name = "usage_py_proto", - protos = [":usage_proto"], + deps = [":usage_proto"], ) cc_proto_library( @@ -508,7 +508,7 @@ proto_library( python_grpc_compile( name = "autoscaler_py_proto", - protos = [":autoscaler_proto"], + deps = [":autoscaler_proto"], ) cc_proto_library( @@ -532,7 +532,7 @@ cc_proto_library( python_grpc_compile( name = "events_actor_task_definition_event_py_proto", - protos = [":events_actor_task_definition_event_proto"], + deps = [":events_actor_task_definition_event_proto"], ) proto_library( @@ -551,7 +551,7 @@ cc_proto_library( python_grpc_compile( name = "events_actor_task_execution_event_py_proto", - protos = [":events_actor_task_execution_event_proto"], + deps = [":events_actor_task_execution_event_proto"], ) proto_library( @@ -570,7 +570,7 @@ cc_proto_library( python_grpc_compile( name = "events_task_definition_event_py_proto", - protos = [":events_task_definition_event_proto"], + deps = [":events_task_definition_event_proto"], ) proto_library( @@ -589,7 +589,7 @@ cc_proto_library( python_grpc_compile( name = "events_task_execution_event_py_proto", - protos = [":events_task_execution_event_proto"], + deps = [":events_task_execution_event_proto"], ) proto_library( @@ -609,7 +609,7 @@ cc_proto_library( python_grpc_compile( name = "events_base_event_py_proto", - protos = [":events_base_event_proto"], + deps = [":events_base_event_proto"], ) proto_library( @@ -664,5 +664,5 @@ python_grpc_compile( name = "serve_py_proto", deps = [":serve_proto"], name = "events_event_aggregator_service_py_proto", - protos = [":events_event_aggregator_service_proto"], + deps = [":events_event_aggregator_service_proto"], ) From 163b84292d5c735cb100f70a4c03558111d90ac5 Mon Sep 17 00:00:00 2001 From: mattip Date: Sat, 31 May 2025 23:31:52 +0300 Subject: [PATCH 21/33] revert updating java protobuf version Signed-off-by: mattip --- java/dependencies.bzl | 4 ++-- .../ray/runtime/task/LocalModeTaskSubmitter.java | 1 + .../io/ray/serve/config/DeploymentConfig.java | 2 +- .../java/io/ray/serve/poll/LongPollResult.java | 16 +++++++++------- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/java/dependencies.bzl b/java/dependencies.bzl index 3324ebda8e80..21c621af9b07 100644 --- a/java/dependencies.bzl +++ b/java/dependencies.bzl @@ -8,8 +8,8 @@ def gen_java_deps(): "com.github.java-json-tools:json-schema-validator:2.2.14", "com.google.code.gson:gson:2.9.1", "com.google.guava:guava:32.0.1-jre", - "com.google.protobuf:protobuf-java:4.28.2", - "com.google.protobuf:protobuf-java-util:4.28.2", + "com.google.protobuf:protobuf-java:3.23.4", + "com.google.protobuf:protobuf-java-util:3.23.4", "com.puppycrawl.tools:checkstyle:8.15", "com.sun.xml.bind:jaxb-core:2.3.0", "com.sun.xml.bind:jaxb-impl:2.3.0", diff --git a/java/runtime/src/main/java/io/ray/runtime/task/LocalModeTaskSubmitter.java b/java/runtime/src/main/java/io/ray/runtime/task/LocalModeTaskSubmitter.java index 1d2142b9905f..6390e4dd2e08 100644 --- a/java/runtime/src/main/java/io/ray/runtime/task/LocalModeTaskSubmitter.java +++ b/java/runtime/src/main/java/io/ray/runtime/task/LocalModeTaskSubmitter.java @@ -90,6 +90,7 @@ private static final class ActorExecutorService { public ActorExecutorService(TaskSpec taskSpec) { ActorCreationTaskSpec actorCreationTaskSpec = taskSpec.getActorCreationTaskSpec(); + Preconditions.checkNotNull(actorCreationTaskSpec); final List concurrencyGroups = actorCreationTaskSpec.getConcurrencyGroupsList(); concurrencyGroups.forEach( diff --git a/java/serve/src/main/java/io/ray/serve/config/DeploymentConfig.java b/java/serve/src/main/java/io/ray/serve/config/DeploymentConfig.java index d09481123229..50e5fa5297f3 100644 --- a/java/serve/src/main/java/io/ray/serve/config/DeploymentConfig.java +++ b/java/serve/src/main/java/io/ray/serve/config/DeploymentConfig.java @@ -289,7 +289,7 @@ public static DeploymentConfig fromProto(io.ray.serve.generated.DeploymentConfig Lists.newArrayList(DeploymentLanguage.values()))); } deploymentConfig.setDeploymentLanguage(proto.getDeploymentLanguage()); - if (proto.getUserConfig().size() != 0) { + if (proto.getUserConfig() != null && proto.getUserConfig().size() != 0) { deploymentConfig.setUserConfig( MessagePackSerializer.decode( proto.getUserConfig().toByteArray(), Object.class)); // TODO-xlang diff --git a/java/serve/src/main/java/io/ray/serve/poll/LongPollResult.java b/java/serve/src/main/java/io/ray/serve/poll/LongPollResult.java index a7e6fc997144..ca6d3c4ce5c8 100644 --- a/java/serve/src/main/java/io/ray/serve/poll/LongPollResult.java +++ b/java/serve/src/main/java/io/ray/serve/poll/LongPollResult.java @@ -34,14 +34,16 @@ public static LongPollResult parseFrom(byte[] longPollResultBytes) { return null; } LongPollResult longPollResult = new LongPollResult(); - Map updatedObjects = - new HashMap<>(pbLongPollResult.getUpdatedObjectsMap().size()); - for (Map.Entry entry : - pbLongPollResult.getUpdatedObjectsMap().entrySet()) { - KeyType keyType = KeyType.parseFrom(entry.getKey()); - updatedObjects.put(keyType, UpdatedObject.parseFrom(keyType, entry.getValue())); + if (pbLongPollResult.getUpdatedObjectsMap() != null) { + Map updatedObjects = + new HashMap<>(pbLongPollResult.getUpdatedObjectsMap().size()); + for (Map.Entry entry : + pbLongPollResult.getUpdatedObjectsMap().entrySet()) { + KeyType keyType = KeyType.parseFrom(entry.getKey()); + updatedObjects.put(keyType, UpdatedObject.parseFrom(keyType, entry.getValue())); + } + longPollResult.setUpdatedObjects(updatedObjects); } - longPollResult.setUpdatedObjects(updatedObjects); return longPollResult; } } From 9922eeaa7add41abb864b76ed18a1b1f27c5dd20 Mon Sep 17 00:00:00 2001 From: mattip Date: Fri, 20 Jun 2025 10:30:50 +0300 Subject: [PATCH 22/33] add fix from PR 53960 Signed-off-by: mattip --- src/ray/rpc/grpc_server.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ray/rpc/grpc_server.cc b/src/ray/rpc/grpc_server.cc index 2450c6850695..4f5fe2246988 100644 --- a/src/ray/rpc/grpc_server.cc +++ b/src/ray/rpc/grpc_server.cc @@ -28,6 +28,10 @@ #include "ray/rpc/common.h" #include "ray/util/thread_utils.h" +#ifndef GRPC_ARG_ALLOW_REUSEADDR +#define GRPC_ARG_ALLOW_REUSEADDR "grpc.so_reuseaddr" +#endif + namespace ray { namespace rpc { @@ -64,10 +68,12 @@ void GrpcServer::Run() { std::string server_address((listen_to_localhost_only_ ? "127.0.0.1:" : "0.0.0.0:") + std::to_string(port_)); grpc::ServerBuilder builder; - // Disable the SO_REUSEPORT option. We don't need it in ray. If the option is enabled - // (default behavior in grpc), we may see multiple workers listen on the same port and - // the requests sent to this port may be handled by any of the workers. + // Disable the SO_REUSEPORT and SO_REUSEADDR option. We don't need it in ray. + // If the option is enabled (default behavior in grpc), we may see multiple workers + // listen on the same port and the requests sent to this port may be handled by any + // of the workers. builder.AddChannelArgument(GRPC_ARG_ALLOW_REUSEPORT, 0); + builder.AddChannelArgument(GRPC_ARG_ALLOW_REUSEADDR, 0); builder.AddChannelArgument(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH, RayConfig::instance().max_grpc_message_size()); builder.AddChannelArgument(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, From 548b06521d81b6dde527c3d8c597ad091834ee5a Mon Sep 17 00:00:00 2001 From: mattip Date: Fri, 4 Jul 2025 01:05:15 +0300 Subject: [PATCH 23/33] Revert "add fix from PR 53960" This reverts commit 850107932234c7a24aa2a82c2c3227a1200238fa. Signed-off-by: mattip --- src/ray/rpc/grpc_server.cc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/ray/rpc/grpc_server.cc b/src/ray/rpc/grpc_server.cc index 4f5fe2246988..2450c6850695 100644 --- a/src/ray/rpc/grpc_server.cc +++ b/src/ray/rpc/grpc_server.cc @@ -28,10 +28,6 @@ #include "ray/rpc/common.h" #include "ray/util/thread_utils.h" -#ifndef GRPC_ARG_ALLOW_REUSEADDR -#define GRPC_ARG_ALLOW_REUSEADDR "grpc.so_reuseaddr" -#endif - namespace ray { namespace rpc { @@ -68,12 +64,10 @@ void GrpcServer::Run() { std::string server_address((listen_to_localhost_only_ ? "127.0.0.1:" : "0.0.0.0:") + std::to_string(port_)); grpc::ServerBuilder builder; - // Disable the SO_REUSEPORT and SO_REUSEADDR option. We don't need it in ray. - // If the option is enabled (default behavior in grpc), we may see multiple workers - // listen on the same port and the requests sent to this port may be handled by any - // of the workers. + // Disable the SO_REUSEPORT option. We don't need it in ray. If the option is enabled + // (default behavior in grpc), we may see multiple workers listen on the same port and + // the requests sent to this port may be handled by any of the workers. builder.AddChannelArgument(GRPC_ARG_ALLOW_REUSEPORT, 0); - builder.AddChannelArgument(GRPC_ARG_ALLOW_REUSEADDR, 0); builder.AddChannelArgument(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH, RayConfig::instance().max_grpc_message_size()); builder.AddChannelArgument(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, From c53cbda961c965052da89d2beea51a7c357c755c Mon Sep 17 00:00:00 2001 From: mattip Date: Fri, 4 Jul 2025 01:08:24 +0300 Subject: [PATCH 24/33] fix from grpc maintainers Signed-off-by: mattip --- src/ray/rpc/grpc_server.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ray/rpc/grpc_server.cc b/src/ray/rpc/grpc_server.cc index 2450c6850695..6b90309600d7 100644 --- a/src/ray/rpc/grpc_server.cc +++ b/src/ray/rpc/grpc_server.cc @@ -64,10 +64,12 @@ void GrpcServer::Run() { std::string server_address((listen_to_localhost_only_ ? "127.0.0.1:" : "0.0.0.0:") + std::to_string(port_)); grpc::ServerBuilder builder; - // Disable the SO_REUSEPORT option. We don't need it in ray. If the option is enabled + // If the GRPC_ARG_ALLOW_REUSEPORT option is enabled // (default behavior in grpc), we may see multiple workers listen on the same port and // the requests sent to this port may be handled by any of the workers. - builder.AddChannelArgument(GRPC_ARG_ALLOW_REUSEPORT, 0); + // However we need it to allow restarting a server quickly after shutting it down + // https://github.com/grpc/grpc/issues/39910 + builder.AddChannelArgument(GRPC_ARG_ALLOW_REUSEPORT, 1); builder.AddChannelArgument(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH, RayConfig::instance().max_grpc_message_size()); builder.AddChannelArgument(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, From 74f4fa253ce44292846d4ea3af68911ec8caf83a Mon Sep 17 00:00:00 2001 From: Matti Picus Date: Mon, 28 Jul 2025 09:42:04 +1000 Subject: [PATCH 25/33] fix merge Signed-off-by: Matti Picus --- BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD.bazel b/BUILD.bazel index 5b82bf657fb0..feaeea9d02b1 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1014,9 +1014,9 @@ alias( filegroup( name = "core_py_proto", - srcs = ["//src/ray/protobuf:core_py_proto"], visibility = ["//visibility:private"], srcs = [ + "//src/ray/protobuf:core_py_proto", "//src/ray/protobuf:agent_manager_py_proto", "//src/ray/protobuf:autoscaler_py_proto", "//src/ray/protobuf:common_py_proto", From 886c36958f0c95d3b75a957c47b6c2dd3761027b Mon Sep 17 00:00:00 2001 From: Matti Picus Date: Mon, 28 Jul 2025 19:51:34 +1000 Subject: [PATCH 26/33] resync with master Signed-off-by: Matti Picus --- BUILD.bazel | 38 +-------- src/ray/protobuf/BUILD | 187 +---------------------------------------- 2 files changed, 3 insertions(+), 222 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index feaeea9d02b1..078eda8c97a4 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1014,44 +1014,8 @@ alias( filegroup( name = "core_py_proto", + srcs = ["//src/ray/protobuf:core_py_proto"], visibility = ["//visibility:private"], - srcs = [ - "//src/ray/protobuf:core_py_proto", - "//src/ray/protobuf:agent_manager_py_proto", - "//src/ray/protobuf:autoscaler_py_proto", - "//src/ray/protobuf:common_py_proto", - "//src/ray/protobuf:core_worker_py_proto", - "//src/ray/protobuf:dependency_py_proto", - "//src/ray/protobuf:event_py_proto", - "//src/ray/protobuf:events_actor_task_definition_event_py_proto", - "//src/ray/protobuf:events_actor_task_execution_event_py_proto", - "//src/ray/protobuf:events_base_event_py_proto", - "//src/ray/protobuf:events_event_aggregator_service_py_proto", - "//src/ray/protobuf:events_task_definition_event_py_proto", - "//src/ray/protobuf:events_task_execution_event_py_proto", - "//src/ray/protobuf:export_actor_event_py_proto", - "//src/ray/protobuf:export_dataset_metadata_py_proto", - "//src/ray/protobuf:export_driver_job_event_py_proto", - "//src/ray/protobuf:export_event_py_proto", - "//src/ray/protobuf:export_node_event_py_proto", - "//src/ray/protobuf:export_runtime_env_py_proto", - "//src/ray/protobuf:export_submission_job_event_py_proto", - "//src/ray/protobuf:export_task_event_py_proto", - "//src/ray/protobuf:export_train_state_py_proto", - "//src/ray/protobuf:gcs_py_proto", - "//src/ray/protobuf:gcs_service_py_proto", - "//src/ray/protobuf:instance_manager_py_proto", - "//src/ray/protobuf:logging_py_proto", - "//src/ray/protobuf:node_manager_py_proto", - "//src/ray/protobuf:pubsub_py_proto", - "//src/ray/protobuf:ray_client_py_proto", - "//src/ray/protobuf:reporter_py_proto", - "//src/ray/protobuf:runtime_env_agent_py_proto", - "//src/ray/protobuf:runtime_env_common_py_proto", - "//src/ray/protobuf:serve_py_proto", - "//src/ray/protobuf:test_service_py_proto", - "//src/ray/protobuf:usage_py_proto", - ], ) filegroup( diff --git a/src/ray/protobuf/BUILD b/src/ray/protobuf/BUILD index aff2318a2434..d45cb48fd04d 100644 --- a/src/ray/protobuf/BUILD +++ b/src/ray/protobuf/BUILD @@ -18,11 +18,6 @@ cc_proto_library( deps = [":common_proto"], ) -python_grpc_compile( - name = "common_py_proto", - deps = [":common_proto"], -) - proto_library( name = "gcs_proto", srcs = ["gcs.proto"], @@ -38,11 +33,6 @@ proto_library( srcs = ["instance_manager.proto"], ) -python_grpc_compile( - name = "instance_manager_py_proto", - deps = [":instance_manager_proto"], -) - cc_proto_library( name = "instance_manager_cc_proto", deps = [":instance_manager_proto"], @@ -69,32 +59,17 @@ cc_proto_library( deps = [":runtime_env_common_proto"], ) -python_grpc_compile( - name = "runtime_env_common_py_proto", - deps = [":runtime_env_common_proto"], -) - cc_proto_library( name = "gcs_cc_proto", deps = [":gcs_proto"], ) -python_grpc_compile( - name = "gcs_py_proto", - deps = [":gcs_proto"], -) - # Function and class dependencies. proto_library( name = "dependency_proto", srcs = ["dependency.proto"], ) -python_grpc_compile( - name = "dependency_py_proto", - deps = [":dependency_proto"], -) - # Text logging. proto_library( name = "logging_proto", @@ -106,11 +81,6 @@ cc_proto_library( deps = [":logging_proto"], ) -python_grpc_compile( - name = "logging_py_proto", - deps = [":logging_proto"], -) - proto_library( name = "node_manager_proto", srcs = ["node_manager.proto"], @@ -127,11 +97,6 @@ cc_proto_library( deps = [":node_manager_proto"], ) -python_grpc_compile( - name = "node_manager_py_proto", - deps = [":node_manager_proto"], -) - proto_library( name = "reporter_proto", srcs = ["reporter.proto"], @@ -146,11 +111,6 @@ cc_proto_library( deps = [":reporter_proto"], ) -python_grpc_compile( - name = "reporter_py_proto", - deps = [":reporter_proto"], -) - proto_library( name = "gcs_service_proto", srcs = ["gcs_service.proto"], @@ -167,11 +127,6 @@ cc_proto_library( deps = [":gcs_service_proto"], ) -python_grpc_compile( - name = "gcs_service_py_proto", - deps = [":gcs_service_proto"], -) - proto_library( name = "test_service_proto", srcs = ["test_service.proto"], @@ -186,11 +141,6 @@ cc_proto_library( deps = [":test_service_proto"], ) -python_grpc_compile( - name = "test_service_py_proto", - deps = [":test_service_proto"], -) - proto_library( name = "object_manager_proto", srcs = ["object_manager.proto"], @@ -212,11 +162,6 @@ proto_library( ], ) -python_grpc_compile( - name = "core_worker_py_proto", - deps = [":core_worker_proto"], -) - cc_proto_library( name = "worker_cc_proto", deps = ["core_worker_proto"], @@ -242,11 +187,6 @@ cc_proto_library( deps = [":event_proto"], ) -python_grpc_compile( - name = "event_py_proto", - deps = [":event_proto"], -) - proto_library( name = "export_event_proto", srcs = ["export_event.proto"], @@ -266,11 +206,6 @@ cc_proto_library( deps = [":export_event_proto"], ) -python_grpc_compile( - name = "export_event_py_proto", - deps = [":export_event_proto"], -) - proto_library( name = "export_task_event_proto", srcs = ["export_task_event.proto"], @@ -285,11 +220,6 @@ cc_proto_library( deps = [":export_task_event_proto"], ) -python_grpc_compile( - name = "export_task_event_py_proto", - deps = [":export_task_event_proto"], -) - proto_library( name = "export_runtime_env_proto", srcs = ["export_runtime_env.proto"], @@ -300,11 +230,6 @@ cc_proto_library( deps = [":export_runtime_env_proto"], ) -python_grpc_compile( - name = "export_runtime_env_py_proto", - deps = [":export_runtime_env_proto"], -) - proto_library( name = "export_node_event_proto", srcs = ["export_node_data.proto"], @@ -315,11 +240,6 @@ cc_proto_library( deps = [":export_node_event_proto"], ) -python_grpc_compile( - name = "export_node_event_py_proto", - deps = [":export_node_event_proto"], -) - proto_library( name = "export_actor_event_proto", srcs = ["export_actor_data.proto"], @@ -331,11 +251,6 @@ cc_proto_library( deps = [":export_actor_event_proto"], ) -python_grpc_compile( - name = "export_actor_event_py_proto", - deps = [":export_actor_event_proto"], -) - proto_library( name = "export_driver_job_event_proto", srcs = ["export_driver_job_event.proto"], @@ -350,11 +265,6 @@ cc_proto_library( deps = [":export_driver_job_event_proto"], ) -python_grpc_compile( - name = "export_driver_job_event_py_proto", - deps = [":export_driver_job_event_proto"], -) - proto_library( name = "export_submission_job_event_proto", srcs = ["export_submission_job_event.proto"], @@ -365,11 +275,6 @@ cc_proto_library( deps = [":export_submission_job_event_proto"], ) -python_grpc_compile( - name = "export_submission_job_event_py_proto", - deps = [":export_submission_job_event_proto"], -) - proto_library( name = "export_train_state_proto", srcs = ["export_train_state.proto"], @@ -380,11 +285,6 @@ cc_proto_library( deps = [":export_train_state_proto"], ) -python_grpc_compile( - name = "export_train_state_py_proto", - deps = [":export_train_state_proto"], -) - proto_library( name = "export_dataset_metadata_proto", srcs = ["export_dataset_metadata.proto"], @@ -398,28 +298,6 @@ cc_proto_library( deps = [":export_dataset_metadata_proto"], ) -python_grpc_compile( - name = "export_dataset_metadata_py_proto", - deps = [":export_dataset_metadata_proto"], -) - -# Agent manager gRPC lib. -proto_library( - name = "agent_manager_proto", - srcs = ["agent_manager.proto"], - deps = [], -) - -python_grpc_compile( - name = "agent_manager_py_proto", - deps = [":agent_manager_proto"], -) - -cc_proto_library( - name = "agent_manager_cc_proto", - deps = [":agent_manager_proto"], -) - # Ray Client gRPC lib proto_library( name = "ray_client_proto", @@ -427,11 +305,6 @@ proto_library( deps = [":common_proto"], ) -python_grpc_compile( - name = "ray_client_py_proto", - deps = [":ray_client_proto"], -) - # Pubsub proto_library( name = "pubsub_proto", @@ -450,11 +323,6 @@ cc_proto_library( deps = [":pubsub_proto"], ) -python_grpc_compile( - name = "pubsub_py_proto", - deps = [":pubsub_proto"], -) - # runtime env agent gRPC lib. proto_library( name = "runtime_env_agent_proto", @@ -465,37 +333,16 @@ proto_library( ], ) -python_grpc_compile( - name = "runtime_env_agent_py_proto", - deps = [":runtime_env_agent_proto"], -) - cc_proto_library( name = "runtime_env_agent_cc_proto", deps = [":runtime_env_agent_proto"], ) -proto_library( - name = "serve_proto", - srcs = ["serve.proto"], - visibility = ["//java:__subpackages__"], -) - -python_grpc_compile( - name = "serve_py_proto", - deps = [":serve_proto"], -) - proto_library( name = "usage_proto", srcs = ["usage.proto"], ) -python_grpc_compile( - name = "usage_py_proto", - deps = [":usage_proto"], -) - cc_proto_library( name = "usage_cc_proto", deps = [":usage_proto"], @@ -506,11 +353,6 @@ proto_library( srcs = ["autoscaler.proto"], ) -python_grpc_compile( - name = "autoscaler_py_proto", - deps = [":autoscaler_proto"], -) - cc_proto_library( name = "autoscaler_cc_proto", deps = [":autoscaler_proto"], @@ -530,11 +372,6 @@ cc_proto_library( deps = [":events_actor_task_definition_event_proto"], ) -python_grpc_compile( - name = "events_actor_task_definition_event_py_proto", - deps = [":events_actor_task_definition_event_proto"], -) - proto_library( name = "events_actor_task_execution_event_proto", srcs = ["events_actor_task_execution_event.proto"], @@ -549,11 +386,6 @@ cc_proto_library( deps = [":events_actor_task_execution_event_proto"], ) -python_grpc_compile( - name = "events_actor_task_execution_event_py_proto", - deps = [":events_actor_task_execution_event_proto"], -) - proto_library( name = "events_task_definition_event_proto", srcs = ["events_task_definition_event.proto"], @@ -568,11 +400,6 @@ cc_proto_library( deps = [":events_task_definition_event_proto"], ) -python_grpc_compile( - name = "events_task_definition_event_py_proto", - deps = [":events_task_definition_event_proto"], -) - proto_library( name = "events_task_execution_event_proto", srcs = ["events_task_execution_event.proto"], @@ -587,15 +414,12 @@ cc_proto_library( deps = [":events_task_execution_event_proto"], ) -python_grpc_compile( - name = "events_task_execution_event_py_proto", - deps = [":events_task_execution_event_proto"], -) - proto_library( name = "events_base_event_proto", srcs = ["events_base_event.proto"], deps = [ + ":events_actor_task_definition_event_proto", + ":events_actor_task_execution_event_proto", ":events_task_definition_event_proto", ":events_task_execution_event_proto", "@com_google_protobuf//:timestamp_proto", @@ -607,11 +431,6 @@ cc_proto_library( deps = [":events_base_event_proto"], ) -python_grpc_compile( - name = "events_base_event_py_proto", - deps = [":events_base_event_proto"], -) - proto_library( name = "events_event_aggregator_service_proto", srcs = ["events_event_aggregator_service.proto"], @@ -663,6 +482,4 @@ proto_library( python_grpc_compile( name = "serve_py_proto", deps = [":serve_proto"], - name = "events_event_aggregator_service_py_proto", - deps = [":events_event_aggregator_service_proto"], ) From e447a5850aac4282fb16309d93cc66f3023a20d0 Mon Sep 17 00:00:00 2001 From: Matti Picus Date: Tue, 29 Jul 2025 08:25:30 +1000 Subject: [PATCH 27/33] revert unneeded change Signed-off-by: Matti Picus --- src/ray/rpc/grpc_server.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ray/rpc/grpc_server.cc b/src/ray/rpc/grpc_server.cc index 6b90309600d7..2450c6850695 100644 --- a/src/ray/rpc/grpc_server.cc +++ b/src/ray/rpc/grpc_server.cc @@ -64,12 +64,10 @@ void GrpcServer::Run() { std::string server_address((listen_to_localhost_only_ ? "127.0.0.1:" : "0.0.0.0:") + std::to_string(port_)); grpc::ServerBuilder builder; - // If the GRPC_ARG_ALLOW_REUSEPORT option is enabled + // Disable the SO_REUSEPORT option. We don't need it in ray. If the option is enabled // (default behavior in grpc), we may see multiple workers listen on the same port and // the requests sent to this port may be handled by any of the workers. - // However we need it to allow restarting a server quickly after shutting it down - // https://github.com/grpc/grpc/issues/39910 - builder.AddChannelArgument(GRPC_ARG_ALLOW_REUSEPORT, 1); + builder.AddChannelArgument(GRPC_ARG_ALLOW_REUSEPORT, 0); builder.AddChannelArgument(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH, RayConfig::instance().max_grpc_message_size()); builder.AddChannelArgument(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, From 518f441e1ee00056df23bee2f5a2915d49995991 Mon Sep 17 00:00:00 2001 From: Matti Picus Date: Tue, 12 Aug 2025 18:43:15 +0300 Subject: [PATCH 28/33] add blank patch to make merge from master happy Signed-off-by: Matti Picus --- thirdparty/patches/grpc-zlib-fdopen.patch | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 thirdparty/patches/grpc-zlib-fdopen.patch diff --git a/thirdparty/patches/grpc-zlib-fdopen.patch b/thirdparty/patches/grpc-zlib-fdopen.patch new file mode 100644 index 000000000000..e69de29bb2d1 From 366f32f909037cf29c4de629dd20570baecbeaaf Mon Sep 17 00:00:00 2001 From: mattip Date: Tue, 12 Aug 2025 21:45:21 +0300 Subject: [PATCH 29/33] fix patch for newer grpc Signed-off-by: mattip --- .../patches/grpc-configurable-thread-count.patch | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/thirdparty/patches/grpc-configurable-thread-count.patch b/thirdparty/patches/grpc-configurable-thread-count.patch index 26387f51a5be..f1ae73ec4a1d 100644 --- a/thirdparty/patches/grpc-configurable-thread-count.patch +++ b/thirdparty/patches/grpc-configurable-thread-count.patch @@ -1,7 +1,6 @@ -diff --git src/core/lib/gpr/linux/cpu.cc b/src/core/lib/gpr/linux/cpu.cc -index 670ca6551c..043021dc4a 100644 ---- src/core/lib/gpr/linux/cpu.cc -+++ src/core/lib/gpr/linux/cpu.cc +diff --git src/core/util/linux/cpu.cc src/core/util/linux/cpu.cc +--- src/core/util/linux/cpu.cc ++++ src/core/util/linux/cpu.cc @@ -24,6 +24,7 @@ #ifdef GPR_CPU_LINUX @@ -10,7 +9,7 @@ index 670ca6551c..043021dc4a 100644 #include #include #include -@@ -49,7 +50,17 @@ static void init_num_cpus() { +@@ -50,7 +51,17 @@ static void init_num_cpus() { #endif // This must be signed. sysconf returns -1 when the number cannot be // determined @@ -27,5 +26,5 @@ index 670ca6551c..043021dc4a 100644 + ncpus = static_cast(sysconf(_SC_NPROCESSORS_CONF)); + } if (ncpus < 1) { - gpr_log(GPR_ERROR, "Cannot determine number of CPUs: assuming 1"); + LOG(ERROR) << "Cannot determine number of CPUs: assuming 1"; ncpus = 1; From 4b20efef33e193011856ce78e30c981cfdfdc1c0 Mon Sep 17 00:00:00 2001 From: mattip Date: Thu, 14 Aug 2025 10:43:26 +0300 Subject: [PATCH 30/33] raise thread count in test, maybe reporting is now more correct? Signed-off-by: mattip --- python/ray/tests/test_basic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/ray/tests/test_basic.py b/python/ray/tests/test_basic.py index 68d1773adff0..8eb0d35a2d03 100644 --- a/python/ray/tests/test_basic.py +++ b/python/ray/tests/test_basic.py @@ -266,7 +266,7 @@ def get_thread_count(self): ray.get(actor.get_thread_count.remote()) # Lowering these numbers in this assert should be celebrated, # increasing these numbers should be scrutinized - assert ray.get(actor.get_thread_count.remote()) in {24, 25} + assert ray.get(actor.get_thread_count.remote()) in {24, 25,, 26} # https://github.com/ray-project/ray/issues/7287 From 3e926c4b0f1e2e5847fdaa234a0a301f39807bd3 Mon Sep 17 00:00:00 2001 From: mattip Date: Thu, 14 Aug 2025 11:11:06 +0300 Subject: [PATCH 31/33] typo Signed-off-by: mattip --- python/ray/tests/test_basic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/ray/tests/test_basic.py b/python/ray/tests/test_basic.py index 8eb0d35a2d03..31655c8ab024 100644 --- a/python/ray/tests/test_basic.py +++ b/python/ray/tests/test_basic.py @@ -266,7 +266,7 @@ def get_thread_count(self): ray.get(actor.get_thread_count.remote()) # Lowering these numbers in this assert should be celebrated, # increasing these numbers should be scrutinized - assert ray.get(actor.get_thread_count.remote()) in {24, 25,, 26} + assert ray.get(actor.get_thread_count.remote()) in {24, 25, 26} # https://github.com/ray-project/ray/issues/7287 From 5066b4e82b345d0da366b810fbdee8645d026312 Mon Sep 17 00:00:00 2001 From: mattip Date: Mon, 18 Aug 2025 23:12:33 +0300 Subject: [PATCH 32/33] remove unneeded change Signed-off-by: mattip --- WORKSPACE | 1 - 1 file changed, 1 deletion(-) diff --git a/WORKSPACE b/WORKSPACE index 037d68fac7d9..73158be8e560 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -64,7 +64,6 @@ python_register_toolchains( name = "python3_9", python_version = "3.9", register_toolchains = False, - ignore_root_user_error = True, ) load("@python3_9//:defs.bzl", python39 = "interpreter") From fd36dfbac0c87d446b12e69cf3ba0a22476ef749 Mon Sep 17 00:00:00 2001 From: mattip Date: Tue, 19 Aug 2025 07:51:04 +0300 Subject: [PATCH 33/33] Revert "remove unneeded change" This reverts commit 5066b4e82b345d0da366b810fbdee8645d026312. Signed-off-by: mattip --- WORKSPACE | 1 + 1 file changed, 1 insertion(+) diff --git a/WORKSPACE b/WORKSPACE index e56c6a109b05..a4686274b8e3 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -64,6 +64,7 @@ python_register_toolchains( name = "python3_9", python_version = "3.9", register_toolchains = False, + ignore_root_user_error = True, ) load("@python3_9//:defs.bzl", python39 = "interpreter")