From f5d86cfda3619602437023b382fac4b9279bf6b7 Mon Sep 17 00:00:00 2001 From: Yi Cheng <74173148+iycheng@users.noreply.github.com> Date: Wed, 8 Feb 2023 18:52:30 +0000 Subject: [PATCH 1/2] fix some --- src/ray/rpc/grpc_server.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ray/rpc/grpc_server.cc b/src/ray/rpc/grpc_server.cc index 208950652a713..f5a735b10f352 100644 --- a/src/ray/rpc/grpc_server.cc +++ b/src/ray/rpc/grpc_server.cc @@ -40,6 +40,7 @@ GrpcServer::GrpcServer(std::string name, is_closed_(true), num_threads_(num_threads), keepalive_time_ms_(keepalive_time_ms) { + RAY_CHECK(num_threads_ > 0) << "Num of threads in gRPC must be greater than 0"; cqs_.resize(num_threads_); // Enable built in health check implemented by gRPC: // https://github.com/grpc/grpc/blob/master/doc/health-checking.md @@ -148,7 +149,7 @@ void GrpcServer::Run() { if (entry->GetMaxActiveRPCs() != -1) { buffer_size = entry->GetMaxActiveRPCs(); } - for (int j = 0; j < (buffer_size / num_threads_); j++) { + for (int j = 0; j < std::min(1, buffer_size / num_threads_); j++) { entry->CreateCall(); } } From 2a57da6681b3f58d9f3777d7f2d2a4fe2a846083 Mon Sep 17 00:00:00 2001 From: Yi Cheng <74173148+iycheng@users.noreply.github.com> Date: Wed, 8 Feb 2023 19:16:57 +0000 Subject: [PATCH 2/2] fix --- src/ray/rpc/grpc_server.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ray/rpc/grpc_server.cc b/src/ray/rpc/grpc_server.cc index f5a735b10f352..09556cc7ac5d7 100644 --- a/src/ray/rpc/grpc_server.cc +++ b/src/ray/rpc/grpc_server.cc @@ -149,7 +149,7 @@ void GrpcServer::Run() { if (entry->GetMaxActiveRPCs() != -1) { buffer_size = entry->GetMaxActiveRPCs(); } - for (int j = 0; j < std::min(1, buffer_size / num_threads_); j++) { + for (int j = 0; j < std::max(1, buffer_size / num_threads_); j++) { entry->CreateCall(); } }