update grpc version to 1.31.0

This commit is contained in:
l30006821 2020-08-28 17:37:57 +08:00
parent 2a4e5fb651
commit 04d6fce839
14 changed files with 764 additions and 0 deletions

View File

@ -0,0 +1,91 @@
From bf87ec9e442d554bf1bc5874c1db9607e59899e3 Mon Sep 17 00:00:00 2001
From: Esun Kim <veblush@google.com>
Date: Wed, 19 Aug 2020 18:17:39 -0700
Subject: [PATCH] Add ABSL_RANDOM_HWAES_FLAGS
diff --git a/Makefile b/Makefile
index 9fc06b0edf..d22d4bab72 100644
--- a/Makefile
+++ b/Makefile
@@ -34,6 +34,13 @@ ifeq ($(SYSTEM),MINGW64)
SYSTEM = MINGW32
endif
+# Basic machine detection
+HOST_MACHINE = $(shell uname -m)
+ifeq ($(HOST_MACHINE),x86_64)
+HOST_IS_X86_64 = true
+else
+HOST_IS_X86_64 = false
+endif
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
ifndef BUILDDIR
@@ -696,6 +703,11 @@ CPPFLAGS := -Ithird_party/address_sorting/include $(CPPFLAGS)
GRPC_ABSEIL_DEP = $(LIBDIR)/$(CONFIG)/libgrpc_abseil.a
GRPC_ABSEIL_MERGE_LIBS = $(LIBDIR)/$(CONFIG)/libgrpc_abseil.a
+ifeq ($(HOST_IS_X86_64),true)
+ABSL_RANDOM_HWAES_FLAGS = -maes -msse4
+else
+ABSL_RANDOM_HWAES_FLAGS =
+endif
RE2_DEP = $(LIBDIR)/$(CONFIG)/libre2.a
RE2_MERGE_OBJS = $(LIBRE2_OBJS)
@@ -4508,7 +4520,7 @@ LIBGRPC_ABSEIL_SRC = \
LIBGRPC_ABSEIL_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC_ABSEIL_SRC))))
-$(LIBGRPC_ABSEIL_OBJS): CPPFLAGS += -g -maes -msse4 -Ithird_party/abseil-cpp
+$(LIBGRPC_ABSEIL_OBJS): CPPFLAGS += -g $(ABSL_RANDOM_HWAES_FLAGS) -Ithird_party/abseil-cpp
$(LIBDIR)/$(CONFIG)/libgrpc_abseil.a: $(LIBGRPC_ABSEIL_OBJS)
$(E) "[AR] Creating $@"
diff --git a/build_handwritten.yaml b/build_handwritten.yaml
index 26e1af3360..63451d14c3 100644
--- a/build_handwritten.yaml
+++ b/build_handwritten.yaml
@@ -196,7 +196,7 @@ configs:
UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1:suppressions=test/core/util/ubsan_suppressions.txt
defaults:
abseil:
- CPPFLAGS: -g -maes -msse4 -Ithird_party/abseil-cpp
+ CPPFLAGS: -g $(ABSL_RANDOM_HWAES_FLAGS) -Ithird_party/abseil-cpp
ares:
CFLAGS: -g
CPPFLAGS: -Ithird_party/cares -Ithird_party/cares/cares -fvisibility=hidden -D_GNU_SOURCE
diff --git a/templates/Makefile.template b/templates/Makefile.template
index 897291ba14..581367e0a6 100644
--- a/templates/Makefile.template
+++ b/templates/Makefile.template
@@ -82,6 +82,13 @@
SYSTEM = MINGW32
endif
+ # Basic machine detection
+ HOST_MACHINE = $(shell uname -m)
+ ifeq ($(HOST_MACHINE),x86_64)
+ HOST_IS_X86_64 = true
+ else
+ HOST_IS_X86_64 = false
+ endif
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
ifndef BUILDDIR
@@ -567,6 +574,11 @@
GRPC_ABSEIL_DEP = $(LIBDIR)/$(CONFIG)/libgrpc_abseil.a
GRPC_ABSEIL_MERGE_LIBS = $(LIBDIR)/$(CONFIG)/libgrpc_abseil.a
+ ifeq ($(HOST_IS_X86_64),true)
+ ABSL_RANDOM_HWAES_FLAGS = -maes -msse4
+ else
+ ABSL_RANDOM_HWAES_FLAGS =
+ endif
RE2_DEP = $(LIBDIR)/$(CONFIG)/libre2.a
RE2_MERGE_OBJS = $(LIBRE2_OBJS)
--
2.23.0

View File

@ -0,0 +1,107 @@
From b65daaa52d2e24dadff465a2a84c0e8220282047 Mon Sep 17 00:00:00 2001
From: Alexander Polcyn <apolcyn@google.com>
Date: Thu, 13 Aug 2020 00:12:55 -0700
Subject: [PATCH] Copy channel args hash before appending ruby user agent
---
src/ruby/lib/grpc/generic/client_stub.rb | 2 +-
src/ruby/spec/user_agent_spec.rb | 74 ++++++++++++++++++++++++
2 files changed, 75 insertions(+), 1 deletion(-)
create mode 100644 src/ruby/spec/user_agent_spec.rb
diff --git a/src/ruby/lib/grpc/generic/client_stub.rb b/src/ruby/lib/grpc/generic/client_stub.rb
index b193f5c4e1..1884dcba24 100644
--- a/src/ruby/lib/grpc/generic/client_stub.rb
+++ b/src/ruby/lib/grpc/generic/client_stub.rb
@@ -100,7 +100,7 @@ module GRPC
channel_args: {},
interceptors: [])
@ch = ClientStub.setup_channel(channel_override, host, creds,
- channel_args)
+ channel_args.dup)
alt_host = channel_args[Core::Channel::SSL_TARGET]
@host = alt_host.nil? ? host : alt_host
@propagate_mask = propagate_mask
diff --git a/src/ruby/spec/user_agent_spec.rb b/src/ruby/spec/user_agent_spec.rb
new file mode 100644
index 0000000000..a5aa2066db
--- /dev/null
+++ b/src/ruby/spec/user_agent_spec.rb
@@ -0,0 +1,74 @@
+# Copyright 2020 gRPC authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+require 'spec_helper'
+
+# a test service that checks the cert of its peer
+class UserAgentEchoService
+ include GRPC::GenericService
+ rpc :an_rpc, EchoMsg, EchoMsg
+
+ def an_rpc(_req, call)
+ EchoMsg.new(msg: call.metadata['user-agent'])
+ end
+end
+
+UserAgentEchoServiceStub = UserAgentEchoService.rpc_stub_class
+
+describe 'user agent' do
+ RpcServer = GRPC::RpcServer
+
+ before(:all) do
+ server_opts = {
+ poll_period: 1
+ }
+ @srv = new_rpc_server_for_testing(**server_opts)
+ @port = @srv.add_http2_port('0.0.0.0:0', :this_port_is_insecure)
+ @srv.handle(UserAgentEchoService)
+ @srv_thd = Thread.new { @srv.run }
+ @srv.wait_till_running
+ end
+
+ after(:all) do
+ expect(@srv.stopped?).to be(false)
+ @srv.stop
+ @srv_thd.join
+ end
+
+ it 'client sends expected user agent' do
+ stub = UserAgentEchoServiceStub.new("localhost:#{@port}",
+ :this_channel_is_insecure,
+ {})
+ response = stub.an_rpc(EchoMsg.new)
+ expected_user_agent_prefix = "grpc-ruby/#{GRPC::VERSION}"
+ expect(response.msg.start_with?(expected_user_agent_prefix)).to be true
+ # check that the expected user agent prefix occurs in the real user agent exactly once
+ expect(response.msg.split(expected_user_agent_prefix).size).to eq 2
+ end
+
+ it 'user agent header does not grow when the same channel args hash is used across multiple stubs' do
+ shared_channel_args_hash = {}
+ 10.times do
+ stub = UserAgentEchoServiceStub.new("localhost:#{@port}",
+ :this_channel_is_insecure,
+ channel_args: shared_channel_args_hash)
+ response = stub.an_rpc(EchoMsg.new)
+ puts "got echo response: #{response.msg}"
+ expected_user_agent_prefix = "grpc-ruby/#{GRPC::VERSION}"
+ expect(response.msg.start_with?(expected_user_agent_prefix)).to be true
+ # check that the expected user agent prefix occurs in the real user agent exactly once
+ expect(response.msg.split(expected_user_agent_prefix).size).to eq 2
+ end
+ end
+end
--
2.23.0

View File

@ -0,0 +1,34 @@
From 590dfe7db024bea1e39b2c0e367e52b631936f7a Mon Sep 17 00:00:00 2001
From: Vijay Pai <vpai@google.com>
Date: Tue, 18 Aug 2020 00:53:09 -0700
Subject: [PATCH] Fix destruction race between subchannel and client_channel
diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc
index 15a39b2388..1b8f2cb1df 100644
--- a/src/core/ext/filters/client_channel/client_channel.cc
+++ b/src/core/ext/filters/client_channel/client_channel.cc
@@ -2176,13 +2176,14 @@ void CallData::Destroy(grpc_call_element* elem,
const grpc_call_final_info* /*final_info*/,
grpc_closure* then_schedule_closure) {
CallData* calld = static_cast<CallData*>(elem->call_data);
- if (GPR_LIKELY(calld->subchannel_call_ != nullptr)) {
- calld->subchannel_call_->SetAfterCallStackDestroy(then_schedule_closure);
- then_schedule_closure = nullptr;
- }
+ RefCountedPtr<SubchannelCall> subchannel_call = calld->subchannel_call_;
calld->~CallData();
- // TODO(yashkt) : This can potentially be a Closure::Run
- ExecCtx::Run(DEBUG_LOCATION, then_schedule_closure, GRPC_ERROR_NONE);
+ if (GPR_LIKELY(subchannel_call != nullptr)) {
+ subchannel_call->SetAfterCallStackDestroy(then_schedule_closure);
+ } else {
+ // TODO(yashkt) : This can potentially be a Closure::Run
+ ExecCtx::Run(DEBUG_LOCATION, then_schedule_closure, GRPC_ERROR_NONE);
+ }
}
void CallData::StartTransportStreamOpBatch(
--
2.23.0

View File

@ -0,0 +1,54 @@
From dc9c5ce77feab8ae01e16d7a3c13cd071c46926a Mon Sep 17 00:00:00 2001
From: Vijay Pai <vpai@google.com>
Date: Tue, 18 Aug 2020 00:56:48 -0700
Subject: [PATCH] Fix use-after-free by removing stream from transport list on
destroy_stream
diff --git a/src/core/ext/transport/inproc/inproc_transport.cc b/src/core/ext/transport/inproc/inproc_transport.cc
index 4cf9e900a4..db9a0aff18 100644
--- a/src/core/ext/transport/inproc/inproc_transport.cc
+++ b/src/core/ext/transport/inproc/inproc_transport.cc
@@ -202,11 +202,6 @@ struct inproc_stream {
}
t->unref();
-
- if (closure_at_destroy) {
- grpc_core::ExecCtx::Run(DEBUG_LOCATION, closure_at_destroy,
- GRPC_ERROR_NONE);
- }
}
#ifndef NDEBUG
@@ -249,7 +244,6 @@ struct inproc_stream {
bool other_side_closed = false; // won't talk anymore
bool write_buffer_other_side_closed = false; // on hold
grpc_stream_refcount* refs;
- grpc_closure* closure_at_destroy = nullptr;
grpc_core::Arena* arena;
@@ -1183,12 +1177,17 @@ void perform_transport_op(grpc_transport* gt, grpc_transport_op* op) {
gpr_mu_unlock(&t->mu->mu);
}
-void destroy_stream(grpc_transport* /*gt*/, grpc_stream* gs,
+void destroy_stream(grpc_transport* gt, grpc_stream* gs,
grpc_closure* then_schedule_closure) {
INPROC_LOG(GPR_INFO, "destroy_stream %p %p", gs, then_schedule_closure);
+ inproc_transport* t = reinterpret_cast<inproc_transport*>(gt);
inproc_stream* s = reinterpret_cast<inproc_stream*>(gs);
- s->closure_at_destroy = then_schedule_closure;
+ gpr_mu_lock(&t->mu->mu);
+ close_stream_locked(s);
+ gpr_mu_unlock(&t->mu->mu);
s->~inproc_stream();
+ grpc_core::ExecCtx::Run(DEBUG_LOCATION, then_schedule_closure,
+ GRPC_ERROR_NONE);
}
void destroy_transport(grpc_transport* gt) {
--
2.23.0

View File

@ -0,0 +1,274 @@
From 0894f21c2fa7cc281bc584c0e08cbbbad1d04b28 Mon Sep 17 00:00:00 2001
From: Stanley Cheung <stanleycheung@google.com>
Date: Thu, 13 Aug 2020 23:00:32 -0700
Subject: [PATCH] Ran generate_proto_ruby.sh to update generated files
---
src/ruby/bin/math_services_pb.rb | 8 ++--
.../pb/grpc/health/v1/health_services_pb.rb | 4 +-
.../pb/src/proto/grpc/testing/messages_pb.rb | 5 +++
.../proto/grpc/testing/test_services_pb.rb | 40 +++++++++++++------
.../testing/benchmark_service_services_pb.rb | 10 ++---
.../qps/src/proto/grpc/testing/messages_pb.rb | 5 +++
...report_qps_scenario_service_services_pb.rb | 2 +-
.../testing/worker_service_services_pb.rb | 8 ++--
8 files changed, 54 insertions(+), 28 deletions(-)
diff --git a/src/ruby/bin/math_services_pb.rb b/src/ruby/bin/math_services_pb.rb
index e6f32e3d01..961117ccfa 100644
--- a/src/ruby/bin/math_services_pb.rb
+++ b/src/ruby/bin/math_services_pb.rb
@@ -31,19 +31,19 @@ module Math
# Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
# and remainder.
- rpc :Div, DivArgs, DivReply
+ rpc :Div, ::Math::DivArgs, ::Math::DivReply
# DivMany accepts an arbitrary number of division args from the client stream
# and sends back the results in the reply stream. The stream continues until
# the client closes its end; the server does the same after sending all the
# replies. The stream ends immediately if either end aborts.
- rpc :DivMany, stream(DivArgs), stream(DivReply)
+ rpc :DivMany, stream(::Math::DivArgs), stream(::Math::DivReply)
# Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib
# generates up to limit numbers; otherwise it continues until the call is
# canceled. Unlike Fib above, Fib has no final FibReply.
- rpc :Fib, FibArgs, stream(Num)
+ rpc :Fib, ::Math::FibArgs, stream(::Math::Num)
# Sum sums a stream of numbers, returning the final result once the stream
# is closed.
- rpc :Sum, stream(Num), Num
+ rpc :Sum, stream(::Math::Num), ::Math::Num
end
Stub = Service.rpc_stub_class
diff --git a/src/ruby/pb/grpc/health/v1/health_services_pb.rb b/src/ruby/pb/grpc/health/v1/health_services_pb.rb
index 5992f1c403..351e7e150a 100644
--- a/src/ruby/pb/grpc/health/v1/health_services_pb.rb
+++ b/src/ruby/pb/grpc/health/v1/health_services_pb.rb
@@ -36,7 +36,7 @@ module Grpc
# If the requested service is unknown, the call will fail with status
# NOT_FOUND.
- rpc :Check, HealthCheckRequest, HealthCheckResponse
+ rpc :Check, ::Grpc::Health::V1::HealthCheckRequest, ::Grpc::Health::V1::HealthCheckResponse
# Performs a watch for the serving status of the requested service.
# The server will immediately send back a message indicating the current
# serving status. It will then subsequently send a new message whenever
@@ -52,7 +52,7 @@ module Grpc
# should assume this method is not supported and should not retry the
# call. If the call terminates with any other status (including OK),
# clients should retry the call with appropriate exponential backoff.
- rpc :Watch, HealthCheckRequest, stream(HealthCheckResponse)
+ rpc :Watch, ::Grpc::Health::V1::HealthCheckRequest, stream(::Grpc::Health::V1::HealthCheckResponse)
end
Stub = Service.rpc_stub_class
diff --git a/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb b/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb
index f492ccfa67..d902ae0e73 100644
--- a/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb
+++ b/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb
@@ -71,6 +71,10 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "grpc.testing.LoadBalancerStatsResponse" do
map :rpcs_by_peer, :string, :int32, 1
optional :num_failures, :int32, 2
+ map :rpcs_by_method, :string, :message, 3, "grpc.testing.LoadBalancerStatsResponse.RpcsByPeer"
+ end
+ add_message "grpc.testing.LoadBalancerStatsResponse.RpcsByPeer" do
+ map :rpcs_by_peer, :string, :int32, 1
end
add_enum "grpc.testing.PayloadType" do
value :COMPRESSABLE, 0
@@ -99,6 +103,7 @@ module Grpc
ReconnectInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.ReconnectInfo").msgclass
LoadBalancerStatsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.LoadBalancerStatsRequest").msgclass
LoadBalancerStatsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.LoadBalancerStatsResponse").msgclass
+ LoadBalancerStatsResponse::RpcsByPeer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.LoadBalancerStatsResponse.RpcsByPeer").msgclass
PayloadType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.PayloadType").enummodule
GrpclbRouteType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.GrpclbRouteType").enummodule
end
diff --git a/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb b/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb
index 8138bd0114..115acd0dca 100644
--- a/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb
+++ b/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb
@@ -36,31 +36,31 @@ module Grpc
self.service_name = 'grpc.testing.TestService'
# One empty request followed by one empty response.
- rpc :EmptyCall, Empty, Empty
+ rpc :EmptyCall, ::Grpc::Testing::Empty, ::Grpc::Testing::Empty
# One request followed by one response.
- rpc :UnaryCall, SimpleRequest, SimpleResponse
+ rpc :UnaryCall, ::Grpc::Testing::SimpleRequest, ::Grpc::Testing::SimpleResponse
# One request followed by one response. Response has cache control
# headers set such that a caching HTTP proxy (such as GFE) can
# satisfy subsequent requests.
- rpc :CacheableUnaryCall, SimpleRequest, SimpleResponse
+ rpc :CacheableUnaryCall, ::Grpc::Testing::SimpleRequest, ::Grpc::Testing::SimpleResponse
# One request followed by a sequence of responses (streamed download).
# The server returns the payload with client desired type and sizes.
- rpc :StreamingOutputCall, StreamingOutputCallRequest, stream(StreamingOutputCallResponse)
+ rpc :StreamingOutputCall, ::Grpc::Testing::StreamingOutputCallRequest, stream(::Grpc::Testing::StreamingOutputCallResponse)
# A sequence of requests followed by one response (streamed upload).
# The server returns the aggregated size of client payload as the result.
- rpc :StreamingInputCall, stream(StreamingInputCallRequest), StreamingInputCallResponse
+ rpc :StreamingInputCall, stream(::Grpc::Testing::StreamingInputCallRequest), ::Grpc::Testing::StreamingInputCallResponse
# A sequence of requests with each request served by the server immediately.
# As one request could lead to multiple responses, this interface
# demonstrates the idea of full duplexing.
- rpc :FullDuplexCall, stream(StreamingOutputCallRequest), stream(StreamingOutputCallResponse)
+ rpc :FullDuplexCall, stream(::Grpc::Testing::StreamingOutputCallRequest), stream(::Grpc::Testing::StreamingOutputCallResponse)
# A sequence of requests followed by a sequence of responses.
# The server buffers all the client requests and then serves them in order. A
# stream of responses are returned to the client when the server starts with
# first request.
- rpc :HalfDuplexCall, stream(StreamingOutputCallRequest), stream(StreamingOutputCallResponse)
+ rpc :HalfDuplexCall, stream(::Grpc::Testing::StreamingOutputCallRequest), stream(::Grpc::Testing::StreamingOutputCallResponse)
# The test server will not implement this method. It will be used
# to test the behavior when clients call unimplemented methods.
- rpc :UnimplementedCall, Empty, Empty
+ rpc :UnimplementedCall, ::Grpc::Testing::Empty, ::Grpc::Testing::Empty
end
Stub = Service.rpc_stub_class
@@ -77,7 +77,7 @@ module Grpc
self.service_name = 'grpc.testing.UnimplementedService'
# A call that no server should implement
- rpc :UnimplementedCall, Empty, Empty
+ rpc :UnimplementedCall, ::Grpc::Testing::Empty, ::Grpc::Testing::Empty
end
Stub = Service.rpc_stub_class
@@ -92,8 +92,8 @@ module Grpc
self.unmarshal_class_method = :decode
self.service_name = 'grpc.testing.ReconnectService'
- rpc :Start, ReconnectParams, Empty
- rpc :Stop, Empty, ReconnectInfo
+ rpc :Start, ::Grpc::Testing::ReconnectParams, ::Grpc::Testing::Empty
+ rpc :Stop, ::Grpc::Testing::Empty, ::Grpc::Testing::ReconnectInfo
end
Stub = Service.rpc_stub_class
@@ -109,7 +109,23 @@ module Grpc
self.service_name = 'grpc.testing.LoadBalancerStatsService'
# Gets the backend distribution for RPCs sent by a test client.
- rpc :GetClientStats, LoadBalancerStatsRequest, LoadBalancerStatsResponse
+ rpc :GetClientStats, ::Grpc::Testing::LoadBalancerStatsRequest, ::Grpc::Testing::LoadBalancerStatsResponse
+ end
+
+ Stub = Service.rpc_stub_class
+ end
+ module XdsUpdateHealthService
+ # A service to remotely control health status of an xDS test server.
+ class Service
+
+ include GRPC::GenericService
+
+ self.marshal_class_method = :encode
+ self.unmarshal_class_method = :decode
+ self.service_name = 'grpc.testing.XdsUpdateHealthService'
+
+ rpc :SetServing, ::Grpc::Testing::Empty, ::Grpc::Testing::Empty
+ rpc :SetNotServing, ::Grpc::Testing::Empty, ::Grpc::Testing::Empty
end
Stub = Service.rpc_stub_class
diff --git a/src/ruby/qps/src/proto/grpc/testing/benchmark_service_services_pb.rb b/src/ruby/qps/src/proto/grpc/testing/benchmark_service_services_pb.rb
index 65e5a75c4d..63e2d5d20f 100644
--- a/src/ruby/qps/src/proto/grpc/testing/benchmark_service_services_pb.rb
+++ b/src/ruby/qps/src/proto/grpc/testing/benchmark_service_services_pb.rb
@@ -34,20 +34,20 @@ module Grpc
# One request followed by one response.
# The server returns the client payload as-is.
- rpc :UnaryCall, SimpleRequest, SimpleResponse
+ rpc :UnaryCall, ::Grpc::Testing::SimpleRequest, ::Grpc::Testing::SimpleResponse
# Repeated sequence of one request followed by one response.
# Should be called streaming ping-pong
# The server returns the client payload as-is on each response
- rpc :StreamingCall, stream(SimpleRequest), stream(SimpleResponse)
+ rpc :StreamingCall, stream(::Grpc::Testing::SimpleRequest), stream(::Grpc::Testing::SimpleResponse)
# Single-sided unbounded streaming from client to server
# The server returns the client payload as-is once the client does WritesDone
- rpc :StreamingFromClient, stream(SimpleRequest), SimpleResponse
+ rpc :StreamingFromClient, stream(::Grpc::Testing::SimpleRequest), ::Grpc::Testing::SimpleResponse
# Single-sided unbounded streaming from server to client
# The server repeatedly returns the client payload as-is
- rpc :StreamingFromServer, SimpleRequest, stream(SimpleResponse)
+ rpc :StreamingFromServer, ::Grpc::Testing::SimpleRequest, stream(::Grpc::Testing::SimpleResponse)
# Two-sided unbounded streaming between server to client
# Both sides send the content of their own choice to the other
- rpc :StreamingBothWays, stream(SimpleRequest), stream(SimpleResponse)
+ rpc :StreamingBothWays, stream(::Grpc::Testing::SimpleRequest), stream(::Grpc::Testing::SimpleResponse)
end
Stub = Service.rpc_stub_class
diff --git a/src/ruby/qps/src/proto/grpc/testing/messages_pb.rb b/src/ruby/qps/src/proto/grpc/testing/messages_pb.rb
index f492ccfa67..d902ae0e73 100644
--- a/src/ruby/qps/src/proto/grpc/testing/messages_pb.rb
+++ b/src/ruby/qps/src/proto/grpc/testing/messages_pb.rb
@@ -71,6 +71,10 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "grpc.testing.LoadBalancerStatsResponse" do
map :rpcs_by_peer, :string, :int32, 1
optional :num_failures, :int32, 2
+ map :rpcs_by_method, :string, :message, 3, "grpc.testing.LoadBalancerStatsResponse.RpcsByPeer"
+ end
+ add_message "grpc.testing.LoadBalancerStatsResponse.RpcsByPeer" do
+ map :rpcs_by_peer, :string, :int32, 1
end
add_enum "grpc.testing.PayloadType" do
value :COMPRESSABLE, 0
@@ -99,6 +103,7 @@ module Grpc
ReconnectInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.ReconnectInfo").msgclass
LoadBalancerStatsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.LoadBalancerStatsRequest").msgclass
LoadBalancerStatsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.LoadBalancerStatsResponse").msgclass
+ LoadBalancerStatsResponse::RpcsByPeer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.LoadBalancerStatsResponse.RpcsByPeer").msgclass
PayloadType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.PayloadType").enummodule
GrpclbRouteType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.GrpclbRouteType").enummodule
end
diff --git a/src/ruby/qps/src/proto/grpc/testing/report_qps_scenario_service_services_pb.rb b/src/ruby/qps/src/proto/grpc/testing/report_qps_scenario_service_services_pb.rb
index ddc81bed3d..5e41cfeead 100644
--- a/src/ruby/qps/src/proto/grpc/testing/report_qps_scenario_service_services_pb.rb
+++ b/src/ruby/qps/src/proto/grpc/testing/report_qps_scenario_service_services_pb.rb
@@ -33,7 +33,7 @@ module Grpc
self.service_name = 'grpc.testing.ReportQpsScenarioService'
# Report results of a QPS test benchmark scenario.
- rpc :ReportScenario, ScenarioResult, Void
+ rpc :ReportScenario, ::Grpc::Testing::ScenarioResult, ::Grpc::Testing::Void
end
Stub = Service.rpc_stub_class
diff --git a/src/ruby/qps/src/proto/grpc/testing/worker_service_services_pb.rb b/src/ruby/qps/src/proto/grpc/testing/worker_service_services_pb.rb
index a7ecc95757..049db47778 100644
--- a/src/ruby/qps/src/proto/grpc/testing/worker_service_services_pb.rb
+++ b/src/ruby/qps/src/proto/grpc/testing/worker_service_services_pb.rb
@@ -38,18 +38,18 @@ module Grpc
# stats. Closing the stream will initiate shutdown of the test server
# and once the shutdown has finished, the OK status is sent to terminate
# this RPC.
- rpc :RunServer, stream(ServerArgs), stream(ServerStatus)
+ rpc :RunServer, stream(::Grpc::Testing::ServerArgs), stream(::Grpc::Testing::ServerStatus)
# Start client with specified workload.
# First request sent specifies the ClientConfig followed by ClientStatus
# response. After that, a "Mark" can be sent anytime to request the latest
# stats. Closing the stream will initiate shutdown of the test client
# and once the shutdown has finished, the OK status is sent to terminate
# this RPC.
- rpc :RunClient, stream(ClientArgs), stream(ClientStatus)
+ rpc :RunClient, stream(::Grpc::Testing::ClientArgs), stream(::Grpc::Testing::ClientStatus)
# Just return the core count - unary call
- rpc :CoreCount, CoreRequest, CoreResponse
+ rpc :CoreCount, ::Grpc::Testing::CoreRequest, ::Grpc::Testing::CoreResponse
# Quit this worker
- rpc :QuitWorker, Void, Void
+ rpc :QuitWorker, ::Grpc::Testing::Void, ::Grpc::Testing::Void
end
Stub = Service.rpc_stub_class
--
2.23.0

View File

@ -0,0 +1,16 @@
From:bitcoffee<854182924@qq.com>
Reason:add-secure-compile-option-in-Makefile
base on author:zhuchunyi commit:b00721fa
diff -urN grpc/CMakeLists.txt grpc_new/CMakeLists.txt
--- grpc/CMakeLists.txt 2020-08-24 09:14:14.361862041 +0800
+++ grpc_new/CMakeLists.txt 2020-08-27 15:36:51.498277936 +0800
@@ -225,6 +226,9 @@
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_gRPC_C_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_gRPC_C_CXX_FLAGS}")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-z,now -fPIE -fPIC")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-z,now -fstack-protector-strong")
+set(_gRPC_ALLTARGETS_LIBRARYIES "${_gRPC_ALLTARGETS_LIBRARYIES} -Wl,-z,now -pie")
if(gRPC_USE_PROTO_LITE)
set(_gRPC_PROTOBUF_LIBRARY_NAME "libprotobuf-lite")

BIN
benchmark-v1.5.1.tar.gz Normal file

Binary file not shown.

Binary file not shown.

BIN
grpc-1.31.0.tar.gz Normal file

Binary file not shown.

133
grpc.spec_bak Normal file
View File

@ -0,0 +1,133 @@
Name: grpc
Version: 1.31.0
Release: 1
Summary: A modern, open source high performance RPC framework that can run in any environment
License: ASL 2.0
URL: https://www.grpc.io
Source0: https://github.com/grpc/grpc/archive/v%{version}/%{name}-%{version}.tar.gz
Source1: abseil-cpp-b832dce8489ef7b6231384909fd9b68d5a5ff2b7.tar.gz
Source2: benchmark-v1.5.1.tar.gz
Source3: re2-2020-08-01.tar.gz
Source4: googletest-release-1.10.0.tar.gz
Patch0000: Copy-channel-args-hash-before-appending-ruby-user-ag.patch
Patch0001: Ran-generate_proto_ruby.sh-to-update-generated-files.patch
Patch0002: Add-ABSL_RANDOM_HWAES_FLAGS.patch
Patch0003: Fix-destruction-race-between-subchannel-and-client_c.patch
Patch0004: Fix-use-after-free-by-removing-stream-from-transport.patch
Patch0005: repair-gflags-compile-error-with-cmake.patch
Patch0006: repair-pkgconfig-path.patch
Patch0007: add-secure-compile-option-in-Makefile.patch
BuildRequires: gcc-c++ pkgconfig protobuf-devel protobuf-compiler gdb
BuildRequires: openssl-devel c-ares-devel gflags-devel gtest-devel zlib-devel gperftools-devel re2-devel
BuildRequires: python3-devel python3-setuptools python3-Cython
BuildRequires: cmake >= 3.13.0
Requires: protobuf-compiler glfags
Provides: %{name}-plugins = %{version}-%{release}
Provides: %{name}-cli = %{version}-%{release}
Obsoletes: %{name}-plugins < %{version}-%{release}
Obsoletes: %{name}-cli < %{version}-%{release}
%description
gRPC is a modern open source high performance RPC framework that can run in any environment.
It can efficiently connect services in and across data centers with pluggable support for
load balancing, tracing, health checking and authentication. It is also applicable in last
mile of distributed computing to connect devices, mobile applications and browsers to backend services.
%package devel
Summary: gRPC library development files
Requires: %{name} = %{version}-%{release}
%description devel
Development headers and files for gRPC libraries.
%package -n python3-grpcio
Summary: Python3 language bindings for gRPC
Requires: %{name} = %{version}-%{release}
%description -n python3-grpcio
Python3 bindings for gRPC.
%prep
%autosetup -p1 -n %{name}-%{version}
tar -zxf %{SOURCE1} --strip-components 1 -C %{_builddir}/%{name}-%{version}/third_party/abseil-cpp/
tar -zxf %{SOURCE2} --strip-components 1 -C %{_builddir}/%{name}-%{version}/third_party/benchmark/
tar -zxf %{SOURCE3} --strip-components 1 -C %{_builddir}/%{name}-%{version}/third_party/re2/
tar -zxf %{SOURCE4} --strip-components 1 -C %{_builddir}/%{name}-%{version}/third_party/googletest/
%build
mkdir -p cmake/build
cd cmake/build
cmake ../../ -DgRPC_INSTALL=ON\
-DgRPC_CARES_PROVIDER=package \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
-DgRPC_GFLAGS_PROVIDER=package \
-DgRPC_INSTALL_LIBDIR=%{buildroot}%{_libdir} \
-DgRPC_INSTALL_BINDIR=%{buildroot}%{_bindir} \
-DgRPC_INSTALL_INCLUDEDIR=%{buildroot}%{_includedir} \
-DgRPC_INSTALL_CMAKEDIR=%{buildroot}%{_prefix}/lib/cmake/%{name} \
-DgRPC_INSTALL_SHAREDIR=%{buildroot}%{_datadir}/%{name} \
-DgRPC_INSTALL_PKGCONFIGDIR=%{buildroot}%{_libdir}/pkgconfig \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DBUILD_SHARED_LIBS=ON
make %{_smp_mflags}
cd ../..
make grpc_cli
# build python module
export GRPC_PYTHON_BUILD_WITH_CYTHON=True
export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=True
export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=True
export GRPC_PYTHON_BUILD_SYSTEM_CARES=True
export CFLAGS="%optflags"
%py3_build
%install
cd cmake/build
make install/local
cd ../..
cp bins/opt/grpc_cli %{buildroot}%{_bindir}
rm -rf %{buildroot}%{_prefix}/lib
%ldconfig_scriptlets
%delete_la_and_a
%py3_install
%files
%defattr(-,root,root)
%doc README.md
%license LICENSE
%{_bindir}/grpc_cli
%{_bindir}/grpc_*_plugin
%{_libdir}/*.so.1*
%{_libdir}/*.so.11*
%{_libdir}/*absl*
%{_libdir}/*re2*
%{_datadir}/%{name}
%files devel
%defattr(-,root,root)
%{_libdir}/*.so
%{_libdir}/pkgconfig/*
%{_includedir}/grpc
%{_includedir}/grpc++
%{_includedir}/grpcpp
%files -n python3-grpcio
%defattr(-,root,root)
%{python3_sitearch}/grpc
%{python3_sitearch}/grpcio-%{version}-py?.?.egg-info
%changelog
* Sat Jan 11 2020 openEuler Buildteam <buildteam@openeuler.org> - 1.22.0-2
- Delete unused patch
* Sat Dec 21 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.22.0-1
- Package init

4
grpc.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: github
src_repo: grpc/grpc
tag_prefix: ^v
seperator: .

BIN
re2-2020-08-01.tar.gz Normal file

Binary file not shown.

View File

@ -0,0 +1,17 @@
From: bitcoffee<854182924@qq.com>
Reason: repair libgrpc++_test_config.so lost dependence on glfags
diff -urN grpc/cmake/gflags.cmake grpc_new/cmake/gflags.cmake
--- grpc/cmake/gflags.cmake 2020-08-25 10:00:46.356802187 +0800
+++ grpc_new/cmake/gflags.cmake 2020-08-25 20:00:19.296009625 +0800
@@ -25,8 +25,8 @@
elseif(gRPC_GFLAGS_PROVIDER STREQUAL "package")
# Use "CONFIG" as there is no built-in cmake module for gflags.
find_package(gflags REQUIRED CONFIG)
- if(TARGET gflags::gflags)
- set(_gRPC_GFLAGS_LIBRARIES gflags::gflags)
+ if(TARGET gflags)
+ set(_gRPC_GFLAGS_LIBRARIES gflags)
endif()
set(_gRPC_FIND_GFLAGS "if(NOT gflags_FOUND)\n find_package(gflags CONFIG)\nendif()")
elseif(gRPC_GFLAGS_PROVIDER STREQUAL "none")

View File

@ -0,0 +1,34 @@
From: bitcoffee<854182924@qq.com>
Reason: pkgconfig install path write dead in the file, modify it
diff -urN grpc/cmake/pkg-config-template.pc.in grpc_new/cmake/pkg-config-template.pc.in
--- grpc/cmake/pkg-config-template.pc.in 2020-08-21 14:34:20.512037605 +0800
+++ grpc_new/cmake/pkg-config-template.pc.in 2020-08-27 20:47:46.372035834 +0800
@@ -1,7 +1,7 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
includedir=${prefix}/include
-libdir=${exec_prefix}/lib
+libdir=${exec_prefix}/lib64
Name: @PC_NAME@
Description: @PC_DESCRIPTION@
diff -urN grpc/CMakeLists.txt grpc_new/CMakeLists.txt
--- grpc/CMakeLists.txt 2020-08-24 09:14:14.361862041 +0800
+++ grpc_new/CMakeLists.txt 2020-08-27 14:50:00.371507303 +0800
@@ -42,6 +42,7 @@
set(gRPC_INSTALL_INCLUDEDIR "include" CACHE STRING "Installation directory for headers")
set(gRPC_INSTALL_CMAKEDIR "lib/cmake/${PACKAGE_NAME}" CACHE STRING "Installation directory for cmake config files")
set(gRPC_INSTALL_SHAREDIR "share/grpc" CACHE STRING "Installation directory for root certificates")
+set(gRPC_INSTALL_PKGCONFIGDIR "lib/pkgconfig" CACHE STRING "Installation directory for pkgconfig")
# Options
option(gRPC_BUILD_TESTS "Build tests" OFF)
@@ -15666,7 +15667,7 @@
"${output_filepath}"
@ONLY)
install(FILES "${output_filepath}"
- DESTINATION "lib/pkgconfig/")
+ DESTINATION ${gRPC_INSTALL_PKGCONFIGDIR})
endfunction()
# gpr .pc file