From 83d6d96c86196cb64b762b07dbdc419f73ee52c8 Mon Sep 17 00:00:00 2001 From: Donna Dionne Date: Fri, 15 Jan 2021 17:50:29 -0800 Subject: [PATCH 01/21] Add Missing test case: present match Interop reported an error for a present match and it is discovered this case is missing from unit test. We have test for present (false) and we have special case test but we don't have the normal present (true) test. We also had a bug in a our code: if (!value.has_value()) { if (header_matcher.type == XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::PRESENT) { return !header_matcher.present_match; } else { // For all other header matcher types, we need the header value to // exist to consider matches. return false; } } switch (header_matcher.type) { case XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::EXACT: return value.value() == header_matcher.string_matcher; case XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::REGEX: return RE2::FullMatch(value.value().data(), *header_matcher.regex_match); case XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::RANGE: int64_t int_value; if (!absl::SimpleAtoi(value.value(), &int_value)) { return false; } return int_value >= header_matcher.range_start && int_value < header_matcher.range_end; case XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::PREFIX: return absl::StartsWith(value.value(), header_matcher.string_matcher); case XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::SUFFIX: return absl::EndsWith(value.value(), header_matcher.string_matcher); default: return false; } Note if header has value, we will go into the swtich but there is no case XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::PRESENT, which means we would have gone into default and decleared not a match. The same day this bug was discovered by interop test, https://github.com/grpc/grpc/pull/25122 was submitted and the refactoring fixed the bug. Nevertheless, I added the test case for the future. --- test/cpp/end2end/xds_end2end_test.cc | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/test/cpp/end2end/xds_end2end_test.cc b/test/cpp/end2end/xds_end2end_test.cc index 3109e3824d9..0796b223d0b 100644 --- a/test/cpp/end2end/xds_end2end_test.cc +++ b/test/cpp/end2end/xds_end2end_test.cc @@ -4905,20 +4905,27 @@ TEST_P(LdsRdsTest, XdsRoutingHeadersMatching) { header_matcher4->set_present_match(false); auto* header_matcher5 = route1->mutable_match()->add_headers(); header_matcher5->set_name("header5"); - header_matcher5->set_prefix_match("/grpc"); + header_matcher5->set_present_match(true); auto* header_matcher6 = route1->mutable_match()->add_headers(); header_matcher6->set_name("header6"); - header_matcher6->set_suffix_match(".cc"); - header_matcher6->set_invert_match(true); + header_matcher6->set_prefix_match("/grpc"); + auto* header_matcher7 = route1->mutable_match()->add_headers(); + header_matcher7->set_name("header7"); + header_matcher7->set_suffix_match(".cc"); + header_matcher7->set_invert_match(true); route1->mutable_route()->set_cluster(kNewClusterName); auto* default_route = route_config.mutable_virtual_hosts(0)->add_routes(); default_route->mutable_match()->set_prefix(""); default_route->mutable_route()->set_cluster(kDefaultClusterName); SetRouteConfiguration(0, route_config); std::vector> metadata = { - {"header1", "POST"}, {"header2", "blah"}, - {"header3", "1"}, {"header5", "/grpc.testing.EchoTest1Service/"}, - {"header1", "PUT"}, {"header6", "grpc.java"}, + {"header1", "POST"}, + {"header2", "blah"}, + {"header3", "1"}, + {"header5", "anything"}, + {"header6", "/grpc.testing.EchoTest1Service/"}, + {"header1", "PUT"}, + {"header7", "grpc.java"}, {"header1", "GET"}, }; const auto header_match_rpc_options = RpcOptions() From e9e3412d9f1e925c202b17b78eeea6f687d16eb5 Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Tue, 19 Jan 2021 14:53:17 -0800 Subject: [PATCH 02/21] xds testing: increase path and header matching timeout --- tools/run_tests/run_xds_tests.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/run_tests/run_xds_tests.py b/tools/run_tests/run_xds_tests.py index 9ffcb261342..a964bfcc6d7 100755 --- a/tools/run_tests/run_xds_tests.py +++ b/tools/run_tests/run_xds_tests.py @@ -1061,8 +1061,8 @@ def test_path_matching(gcp, original_backend_service, instance_group, original_backend_instances + alternate_backend_instances, _WAIT_FOR_STATS_SEC) - retry_count = 40 - # Each attempt takes about 10 seconds, 40 retries is equivalent to 400 + retry_count = 80 + # Each attempt takes about 5 seconds, 80 retries is equivalent to 400 # seconds timeout. for i in range(retry_count): stats = get_client_stats(_NUM_TEST_RPCS, _WAIT_FOR_STATS_SEC) @@ -1195,8 +1195,8 @@ def test_header_matching(gcp, original_backend_service, instance_group, original_backend_instances + alternate_backend_instances, _WAIT_FOR_STATS_SEC) - retry_count = 40 - # Each attempt takes about 10 seconds, 40 retries is equivalent to 400 + retry_count = 80 + # Each attempt takes about 5 seconds, 80 retries is equivalent to 400 # seconds timeout. for i in range(retry_count): stats = get_client_stats(_NUM_TEST_RPCS, _WAIT_FOR_STATS_SEC) From fdbf32f057600de5ad752e75b1b4491cad0b85f0 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 19 Jan 2021 15:41:57 -0800 Subject: [PATCH 03/21] Upgrade Abseil to 20200923.3 --- bazel/grpc_deps.bzl | 8 ++++---- third_party/abseil-cpp | 2 +- tools/run_tests/sanity/check_submodules.sh | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index 7c49bfd6f6b..43249cd813c 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -245,11 +245,11 @@ def grpc_deps(): if "com_google_absl" not in native.existing_rules(): http_archive( name = "com_google_absl", - sha256 = "3d74cdc98b42fd4257d91f652575206de195e2c824fcd8d6e6d227f85cb143ef", - strip_prefix = "abseil-cpp-0f3bb466b868b523cf1dc9b2aaaed65c77b28862", + sha256 = "62c27e7a633e965a2f40ff16b487c3b778eae440bab64cad83b34ef1cbe3aa93", + strip_prefix = "abseil-cpp-6f9d96a1f41439ac172ee2ef7ccd8edf0e5d068c", urls = [ - "https://storage.googleapis.com/grpc-bazel-mirror/github.com/abseil/abseil-cpp/archive/0f3bb466b868b523cf1dc9b2aaaed65c77b28862.tar.gz", - "https://github.com/abseil/abseil-cpp/archive/0f3bb466b868b523cf1dc9b2aaaed65c77b28862.tar.gz", + "https://storage.googleapis.com/grpc-bazel-mirror/github.com/abseil/abseil-cpp/archive/6f9d96a1f41439ac172ee2ef7ccd8edf0e5d068c.tar.gz", + "https://github.com/abseil/abseil-cpp/archive/6f9d96a1f41439ac172ee2ef7ccd8edf0e5d068c.tar.gz", ], ) diff --git a/third_party/abseil-cpp b/third_party/abseil-cpp index 0f3bb466b86..6f9d96a1f41 160000 --- a/third_party/abseil-cpp +++ b/third_party/abseil-cpp @@ -1 +1 @@ -Subproject commit 0f3bb466b868b523cf1dc9b2aaaed65c77b28862 +Subproject commit 6f9d96a1f41439ac172ee2ef7ccd8edf0e5d068c diff --git a/tools/run_tests/sanity/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh index 363e6f1a5f7..f4687c80f59 100755 --- a/tools/run_tests/sanity/check_submodules.sh +++ b/tools/run_tests/sanity/check_submodules.sh @@ -26,7 +26,7 @@ want_submodules=$(mktemp /tmp/submXXXXXX) git submodule | awk '{ print $1 }' | sort > "$submodules" cat << EOF | awk '{ print $1 }' | sort > "$want_submodules" - 0f3bb466b868b523cf1dc9b2aaaed65c77b28862 third_party/abseil-cpp (heads/master) + 6f9d96a1f41439ac172ee2ef7ccd8edf0e5d068c third_party/abseil-cpp (heads/master) 090faecb454fbd6e6e17a75ef8146acb037118d4 third_party/benchmark (v1.5.0) 73594cde8c9a52a102c4341c244c833aa61b9c06 third_party/bloaty (remotes/origin/wide-14-g73594cd) 29c6e0e27268f5a43e039cd2ed4e849d6b736fc1 third_party/boringssl-with-bazel (remotes/origin/master-with-bazel) From 631bf76de62112059ad6b198a71bd690d58c2db8 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 19 Jan 2021 15:43:33 -0800 Subject: [PATCH 04/21] Update Abseil in podspecs --- gRPC-C++.podspec | 2 +- gRPC-Core.podspec | 2 +- templates/gRPC-C++.podspec.template | 2 +- templates/gRPC-Core.podspec.template | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 3b65e4d429b..1dac4dc6b4c 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -185,7 +185,7 @@ Pod::Spec.new do |s| ss.header_mappings_dir = '.' ss.dependency "#{s.name}/Interface", version ss.dependency 'gRPC-Core', version - abseil_version = '1.20200923.2' + abseil_version = '1.20200923.3' ss.dependency 'abseil/base/base', abseil_version ss.dependency 'abseil/container/flat_hash_map', abseil_version ss.dependency 'abseil/container/flat_hash_set', abseil_version diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index d10a315a398..1e30802508d 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -46,7 +46,7 @@ Pod::Spec.new do |s| s.requires_arc = false name = 'grpc' - abseil_version = '1.20200923.2' + abseil_version = '1.20200923.3' # When creating a dynamic framework, name it grpc.framework instead of gRPC-Core.framework. # This lets users write their includes like `#include ` as opposed to `#include diff --git a/templates/gRPC-C++.podspec.template b/templates/gRPC-C++.podspec.template index da3df694ad9..057a6d4a7bf 100644 --- a/templates/gRPC-C++.podspec.template +++ b/templates/gRPC-C++.podspec.template @@ -165,7 +165,7 @@ ss.header_mappings_dir = '.' ss.dependency "#{s.name}/Interface", version ss.dependency 'gRPC-Core', version - abseil_version = '1.20200923.2' + abseil_version = '1.20200923.3' % for abseil_spec in grpcpp_abseil_specs: ss.dependency '${abseil_spec}', abseil_version % endfor diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index 81fe0e9caa0..f79d2008bc3 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -123,7 +123,7 @@ s.requires_arc = false name = 'grpc' - abseil_version = '1.20200923.2' + abseil_version = '1.20200923.3' # When creating a dynamic framework, name it grpc.framework instead of gRPC-Core.framework. # This lets users write their includes like `#include ` as opposed to `#include From f5b1557e59f716a99216360f9a2a2628e786be36 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 19 Jan 2021 16:42:11 -0800 Subject: [PATCH 05/21] Add docs for Abseil --- third_party/ABSEIL_MANUAL.md | 30 ++++++++++++++++++++++++++++++ third_party/README.md | 8 ++++++++ 2 files changed, 38 insertions(+) create mode 100644 third_party/ABSEIL_MANUAL.md diff --git a/third_party/ABSEIL_MANUAL.md b/third_party/ABSEIL_MANUAL.md new file mode 100644 index 00000000000..71e941dd248 --- /dev/null +++ b/third_party/ABSEIL_MANUAL.md @@ -0,0 +1,30 @@ +# Abseil in gRPC + +This document explains how to use Abseil throughout gRPC. Note that this isn't +supposed to explain general usage of Abseil. + +## The version of Abseil + +gRPC is inteded to use the LTS versions of Abseil only because it simplfies +dependency management. Abseil is being distributed via package distribution +systems such as vcpkg and cocoapods. If gRPC depends on the certain version +that aren't registered, gRPC in that system wouldn't build or work. +Therefore, gRPC will use the LTS version only, preferably the latest one. + +## Libraries that are not ready to use + +Most of Abseil libraries are okay to use but there are some exceptions +because they're not going well yet on some of our test machinaries or +platforms it supports. Following is targets that are NOT ready to use. + +- `absl/synchronization:*`: This will be ready from the LTS version in 2021. +- `absl/random`: [WIP](https://github.com/grpc/grpc/pull/23346). +- `absl/types:variant`: [WIP](https://github.com/grpc/grpc/pull/22961). + +## Implemetation only + +You can use Abseil in gRPC Core and gRPC C++. But you cannot use it in +the public interface of gRPC C++ because i) it doesn't gurantee no breaking +API changes like gRPC C++ does and ii) it may make users change their build +system to address Abseil. + \ No newline at end of file diff --git a/third_party/README.md b/third_party/README.md index 9bf04831bcb..473b5426449 100644 --- a/third_party/README.md +++ b/third_party/README.md @@ -48,6 +48,14 @@ Usually the process is Updating some dependencies requires extra care. +### Updating third_party/abseil-cpp + +- Two additional steps should be done before running `generate_projects.sh` above. + - Running `src/abseil-cpp/preprocessed_builds.yaml.gen.py`. + - Updating `abseil_version =` scripts in `templates/gRPC-C++.podspec.template` and + `templates/gRPC-Core.podspec.template`. +- You can see an example of previous [upgrade](https://github.com/grpc/grpc/pull/24270). + ### Updating third_party/boringssl-with-bazel - Update the `third_party/boringssl-with-bazel` submodule to the latest [`master-with-bazel`](https://github.com/google/boringssl/tree/master-with-bazel) branch From b94f09aaf4560a00dc6e446d61a7eac501d052f8 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Tue, 19 Jan 2021 17:25:47 -0800 Subject: [PATCH 06/21] Drop support for ruby 2.3 --- Rakefile | 2 +- grpc.gemspec | 2 +- tools/run_tests/artifacts/distribtest_targets.py | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Rakefile b/Rakefile index c4cb31438b0..faae2106764 100755 --- a/Rakefile +++ b/Rakefile @@ -121,7 +121,7 @@ task 'gem:native' do verbose = ENV['V'] || '0' grpc_config = ENV['GRPC_CONFIG'] || 'opt' - ruby_cc_versions = ['3.0.0', '2.7.0', '2.6.0', '2.5.0', '2.4.0', '2.3.0'].join(':') + ruby_cc_versions = ['3.0.0', '2.7.0', '2.6.0', '2.5.0', '2.4.0'].join(':') if RUBY_PLATFORM =~ /darwin/ FileUtils.touch 'grpc_c.32.ruby' diff --git a/grpc.gemspec b/grpc.gemspec index a045dcab671..922d91ce5f2 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.description = 'Send RPCs from Ruby using GRPC' s.license = 'Apache-2.0' - s.required_ruby_version = '>= 2.3.0' + s.required_ruby_version = '>= 2.4.0' s.files = %w( Makefile .yardopts ) s.files += %w( etc/roots.pem ) diff --git a/tools/run_tests/artifacts/distribtest_targets.py b/tools/run_tests/artifacts/distribtest_targets.py index 1ffec4a711e..484835ba630 100644 --- a/tools/run_tests/artifacts/distribtest_targets.py +++ b/tools/run_tests/artifacts/distribtest_targets.py @@ -361,7 +361,6 @@ def targets(): PythonDistribTest('linux', 'x64', 'ubuntu1604', source=True), PythonDistribTest('linux', 'x64', 'ubuntu1804', source=True), # Ruby - RubyDistribTest('linux', 'x64', 'jessie', ruby_version='ruby_2_3'), RubyDistribTest('linux', 'x64', 'jessie', ruby_version='ruby_2_4'), RubyDistribTest('linux', 'x64', 'jessie', ruby_version='ruby_2_5'), RubyDistribTest('linux', 'x64', 'jessie', ruby_version='ruby_2_6'), @@ -370,7 +369,7 @@ def targets(): RubyDistribTest('linux', 'x64', 'jessie', - ruby_version='ruby_2_3', + ruby_version='ruby_2_4', source=True), RubyDistribTest('linux', 'x64', 'centos7'), RubyDistribTest('linux', 'x64', 'fedora23'), From 0633043a70c072d786d407c55c56d6b28ac02930 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Tue, 19 Jan 2021 17:29:36 -0800 Subject: [PATCH 07/21] update dockerfiles --- .../distribtest/ruby_centos7_x64/Dockerfile | 6 +-- .../distribtest/ruby_fedora23_x64/Dockerfile | 6 +-- .../ruby_jessie_x64_ruby_2_3/Dockerfile | 41 ------------------- 3 files changed, 6 insertions(+), 47 deletions(-) delete mode 100644 tools/dockerfile/distribtest/ruby_jessie_x64_ruby_2_3/Dockerfile diff --git a/tools/dockerfile/distribtest/ruby_centos7_x64/Dockerfile b/tools/dockerfile/distribtest/ruby_centos7_x64/Dockerfile index fc4eabbbb15..baf5e066cae 100644 --- a/tools/dockerfile/distribtest/ruby_centos7_x64/Dockerfile +++ b/tools/dockerfile/distribtest/ruby_centos7_x64/Dockerfile @@ -21,11 +21,11 @@ RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A170311380 RUN curl -sSL https://get.rvm.io | bash -s stable # Install Ruby 2.3 -RUN /bin/bash -l -c "rvm install ruby-2.3.8" -RUN /bin/bash -l -c "rvm use --default ruby-2.3.8" +RUN /bin/bash -l -c "rvm install ruby-2.4.9" +RUN /bin/bash -l -c "rvm use --default ruby-2.4.9" RUN /bin/bash -l -c "echo 'gem: --no-document' > ~/.gemrc" RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc" -RUN /bin/bash -l -c "echo 'rvm --default use ruby-2.3.8' >> ~/.bashrc" +RUN /bin/bash -l -c "echo 'rvm --default use ruby-2.4.9' >> ~/.bashrc" RUN /bin/bash -l -c "gem install bundler -v 1.17.3 --no-document" RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/distribtest/ruby_fedora23_x64/Dockerfile b/tools/dockerfile/distribtest/ruby_fedora23_x64/Dockerfile index f586ae377a3..56c564f5886 100644 --- a/tools/dockerfile/distribtest/ruby_fedora23_x64/Dockerfile +++ b/tools/dockerfile/distribtest/ruby_fedora23_x64/Dockerfile @@ -27,11 +27,11 @@ RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A170311380 RUN curl -sSL https://get.rvm.io | bash -s stable # Install Ruby 2.3 -RUN /bin/bash -l -c "rvm install ruby-2.3.8" -RUN /bin/bash -l -c "rvm use --default ruby-2.3.8" +RUN /bin/bash -l -c "rvm install ruby-2.4.9" +RUN /bin/bash -l -c "rvm use --default ruby-2.4.9" RUN /bin/bash -l -c "echo 'gem: --no-document' > ~/.gemrc" RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc" -RUN /bin/bash -l -c "echo 'rvm --default use ruby-2.3.8' >> ~/.bashrc" +RUN /bin/bash -l -c "echo 'rvm --default use ruby-2.4.9' >> ~/.bashrc" RUN /bin/bash -l -c "gem install bundler -v 1.17.3 --no-document" RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/distribtest/ruby_jessie_x64_ruby_2_3/Dockerfile b/tools/dockerfile/distribtest/ruby_jessie_x64_ruby_2_3/Dockerfile deleted file mode 100644 index 9deff0661b7..00000000000 --- a/tools/dockerfile/distribtest/ruby_jessie_x64_ruby_2_3/Dockerfile +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright 2015 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. - -FROM debian:jessie - -# Install Git and basic packages. -RUN apt-get update && apt-get install -y \ - curl \ - gcc && apt-get clean - -#================== -# Ruby dependencies - -# Install rvm -RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB -RUN \curl -sSL https://get.rvm.io | bash -s stable - -# Install Ruby 2.3 -RUN /bin/bash -l -c "rvm install ruby-2.3.8" -RUN /bin/bash -l -c "rvm use --default ruby-2.3.8" -RUN /bin/bash -l -c "echo 'gem: --no-document' > ~/.gemrc" -RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc" -RUN /bin/bash -l -c "echo 'rvm --default use ruby-2.3.8' >> ~/.bashrc" -RUN /bin/bash -l -c "gem update --system" -RUN /bin/bash -l -c "gem install bundler -v 1.17.3 --no-document" - -RUN mkdir /var/local/jenkins - -# Define the default command. -CMD ["bash"] From c5a784ea83714822f606c5fdc7d4ea708f6faf0c Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Mon, 11 Jan 2021 15:59:39 -0800 Subject: [PATCH 08/21] Remove -Wno-unused-parameter --- bazel/copts.bzl | 1 - 1 file changed, 1 deletion(-) diff --git a/bazel/copts.bzl b/bazel/copts.bzl index 0d4fca7d4c8..8e9d74b36b7 100644 --- a/bazel/copts.bzl +++ b/bazel/copts.bzl @@ -47,7 +47,6 @@ GRPC_LLVM_WARNING_FLAGS = [ "-Wno-missing-field-initializers", "-Wno-sign-compare", "-Wno-unused-function", - "-Wno-unused-parameter", ] GRPC_DEFAULT_COPTS = select({ From 9bd7c4917a4b6dcf9b8bdcaf37a93918fc550dec Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 12 Jan 2021 15:26:51 -0800 Subject: [PATCH 09/21] Fix unused-parameter warning --- .../filters/client_channel/client_channel.cc | 12 +++---- .../filters/client_channel/config_selector.h | 2 +- .../lb_policy/grpclb/grpclb_channel_secure.cc | 2 +- .../lb_policy/pick_first/pick_first.cc | 2 +- .../lb_policy/xds/xds_cluster_resolver.cc | 2 +- .../resolver/sockaddr/sockaddr_resolver.cc | 2 +- .../server_load_reporting_filter.cc | 4 +-- .../chttp2/client/chttp2_connector.cc | 2 +- .../transport/chttp2/server/chttp2_server.cc | 2 +- .../cronet/transport/cronet_api_dummy.cc | 36 ++++++++++--------- .../cronet/transport/cronet_transport.cc | 25 ++++++------- ...gle_mesh_ca_certificate_provider_factory.h | 2 +- src/core/ext/xds/xds_bootstrap.cc | 6 ++-- src/core/lib/gprpp/ref_counted.h | 2 +- .../lib/iomgr/socket_utils_common_posix.cc | 1 + src/core/lib/iomgr/tcp_posix.cc | 8 ++--- .../authorization/mock_cel/activation.h | 2 +- .../authorization/mock_cel/cel_value.h | 16 +++++---- .../aws_external_account_credentials.cc | 2 +- .../file_external_account_credentials.cc | 2 +- .../url_external_account_credentials.cc | 2 +- .../insecure/insecure_security_connector.cc | 10 +++--- src/core/lib/surface/server.cc | 2 +- src/core/lib/transport/metadata.cc | 4 +++ src/core/tsi/fake_transport_security.cc | 2 +- src/cpp/ext/filters/census/channel_filter.cc | 4 +-- src/cpp/ext/filters/census/client_filter.cc | 4 +-- src/cpp/ext/filters/census/context.cc | 7 ++-- src/cpp/ext/filters/census/server_filter.cc | 4 +-- .../load_reporter_async_service_impl.cc | 2 +- ...reporting_service_server_builder_plugin.cc | 2 +- ..._reporting_service_server_builder_plugin.h | 4 +-- src/csharp/ext/grpc_csharp_ext.c | 12 +++++++ .../certificate_provider_registry_test.cc | 8 ++--- test/core/end2end/cq_verifier.cc | 2 +- .../network_benchmarks/low_level_ping_pong.cc | 2 +- test/core/security/credentials_test.cc | 26 +++++++------- .../grpc_tls_certificate_distributor_test.cc | 8 ++--- .../fake_handshaker/fake_handshaker_server.cc | 2 +- .../handshaker/alts_handshaker_client_test.cc | 8 ++--- test/core/tsi/ssl_session_cache_test.cc | 4 +-- test/core/util/eval_args_mock_endpoint.cc | 25 ++++++------- test/core/util/test_config.cc | 2 +- .../xds/certificate_provider_store_test.cc | 12 +++---- test/core/xds/xds_bootstrap_test.cc | 2 +- test/cpp/end2end/nonblocking_test.cc | 2 ++ test/cpp/end2end/xds_end2end_test.cc | 10 +++--- .../census/stats_plugin_end2end_test.cc | 2 +- test/cpp/interop/xds_interop_client.cc | 10 +++--- test/cpp/interop/xds_interop_server.cc | 6 ++-- .../microbenchmarks/bm_opencensus_plugin.cc | 2 +- test/cpp/util/channelz_sampler_test.cc | 6 ++-- test/cpp/util/grpc_tool_test.cc | 5 +-- 53 files changed, 182 insertions(+), 153 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 048cd204695..3eccbaa924f 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -1047,7 +1047,7 @@ class LoadBalancedCall { // Channel arg pointer vtable for GRPC_ARG_CLIENT_CHANNEL_DATA. void* ChannelDataArgCopy(void* p) { return p; } -void ChannelDataArgDestroy(void* p) {} +void ChannelDataArgDestroy(void* /*p*/) {} int ChannelDataArgCmp(void* p, void* q) { return GPR_ICMP(p, q); } const grpc_arg_pointer_vtable kChannelDataArgPointerVtable = { ChannelDataArgCopy, ChannelDataArgDestroy, ChannelDataArgCmp}; @@ -1079,10 +1079,10 @@ class DynamicTerminationFilterChannelData { } // Will never be called. - static void StartTransportOp(grpc_channel_element* elem, - grpc_transport_op* op) {} - static void GetChannelInfo(grpc_channel_element* elem, - const grpc_channel_info* info) {} + static void StartTransportOp(grpc_channel_element* /*elem*/, + grpc_transport_op* /*op*/) {} + static void GetChannelInfo(grpc_channel_element* /*elem*/, + const grpc_channel_info* /*info*/) {} ChannelData* chand() const { return chand_; } RefCountedPtr retry_throttle_data() const { @@ -1117,7 +1117,7 @@ class DynamicTerminationFilterCallData { } static void Destroy(grpc_call_element* elem, - const grpc_call_final_info* final_info, + const grpc_call_final_info* /*final_info*/, grpc_closure* then_schedule_closure) { auto* calld = static_cast(elem->call_data); diff --git a/src/core/ext/filters/client_channel/config_selector.h b/src/core/ext/filters/client_channel/config_selector.h index 62e4ce5a38c..6e41faaecaa 100644 --- a/src/core/ext/filters/client_channel/config_selector.h +++ b/src/core/ext/filters/client_channel/config_selector.h @@ -106,7 +106,7 @@ class DefaultConfigSelector : public ConfigSelector { // Only comparing the ConfigSelector itself, not the underlying // service config, so we always return true. - bool Equals(const ConfigSelector* other) const override { return true; } + bool Equals(const ConfigSelector* /*other*/) const override { return true; } CallConfig GetCallConfig(GetCallConfigArgs args) override { CallConfig call_config; diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc index 62fbe15b27a..70e6dec18cf 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc @@ -40,7 +40,7 @@ namespace grpc_core { grpc_channel_args* ModifyGrpclbBalancerChannelArgs( - const ServerAddressList& addresses, grpc_channel_args* args) { + const ServerAddressList& /*addresses*/, grpc_channel_args* args) { absl::InlinedVector args_to_remove; absl::InlinedVector args_to_add; // Substitute the channel credentials with a version without call diff --git a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc index 8b64f2b4e37..e7e98d97130 100644 --- a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +++ b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc @@ -497,7 +497,7 @@ class PickFirstFactory : public LoadBalancingPolicyFactory { const char* name() const override { return kPickFirst; } RefCountedPtr ParseLoadBalancingConfig( - const Json& json, grpc_error** /*error*/) const override { + const Json& /*json*/, grpc_error** /*error*/) const override { return MakeRefCounted(); } }; diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc index 0133a713ec1..7087ec2562e 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc @@ -1236,7 +1236,7 @@ class XdsClusterResolverLbFactory : public LoadBalancingPolicyFactory { } OrphanablePtr CreateLoadBalancingPolicy( - const char* name, LoadBalancingPolicy::Args args) const override { + const char* /*name*/, LoadBalancingPolicy::Args args) const override { return MakeOrphanable(xds_client_, std::move(args)); } diff --git a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc index dfa2dd9b972..1fed8e21fea 100644 --- a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +++ b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc @@ -150,7 +150,7 @@ class UnixResolverFactory : public ResolverFactory { return CreateSockaddrResolver(std::move(args), grpc_parse_unix); } - std::string GetDefaultAuthority(const URI& uri) const override { + std::string GetDefaultAuthority(const URI& /*uri*/) const override { return "localhost"; } diff --git a/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc b/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc index 5d578307a9e..b789d9b13df 100644 --- a/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc +++ b/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc @@ -72,7 +72,7 @@ grpc_error* ServerLoadReportingChannelData::Init( void ServerLoadReportingCallData::Destroy( grpc_call_element* elem, const grpc_call_final_info* final_info, - grpc_closure* then_call_closure) { + grpc_closure* /*then_call_closure*/) { ServerLoadReportingChannelData* chand = reinterpret_cast(elem->channel_data); // Only record an end if we've recorded its corresponding start, which is @@ -265,7 +265,7 @@ void ServerLoadReportingCallData::RecvInitialMetadataReady(void* arg, } grpc_error* ServerLoadReportingCallData::Init( - grpc_call_element* elem, const grpc_call_element_args* args) { + grpc_call_element* elem, const grpc_call_element_args* /*args*/) { service_method_ = grpc_empty_slice(); GRPC_CLOSURE_INIT(&recv_initial_metadata_ready_, RecvInitialMetadataReady, elem, grpc_schedule_on_exec_ctx); diff --git a/src/core/ext/transport/chttp2/client/chttp2_connector.cc b/src/core/ext/transport/chttp2/client/chttp2_connector.cc index 3408ed92675..6ab3531121a 100644 --- a/src/core/ext/transport/chttp2/client/chttp2_connector.cc +++ b/src/core/ext/transport/chttp2/client/chttp2_connector.cc @@ -220,7 +220,7 @@ void Chttp2Connector::OnReceiveSettings(void* arg, grpc_error* error) { self->Unref(); } -void Chttp2Connector::OnTimeout(void* arg, grpc_error* error) { +void Chttp2Connector::OnTimeout(void* arg, grpc_error* /*error*/) { Chttp2Connector* self = static_cast(arg); { MutexLock lock(&self->mu_); diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.cc b/src/core/ext/transport/chttp2/server/chttp2_server.cc index e930407f3f1..8b114603e82 100644 --- a/src/core/ext/transport/chttp2/server/chttp2_server.cc +++ b/src/core/ext/transport/chttp2/server/chttp2_server.cc @@ -93,7 +93,7 @@ class Chttp2ServerListener : public Server::ListenerInterface { explicit ConfigFetcherWatcher(Chttp2ServerListener* listener) : listener_(listener) {} - void UpdateConfig(grpc_channel_args* args) override { + void UpdateConfig(grpc_channel_args* /*args*/) override { { MutexLock lock(&listener_->mu_); grpc_channel_args_destroy(listener_->args_); diff --git a/src/core/ext/transport/cronet/transport/cronet_api_dummy.cc b/src/core/ext/transport/cronet/transport/cronet_api_dummy.cc index 1a6bded6afd..02825ed3c52 100644 --- a/src/core/ext/transport/cronet/transport/cronet_api_dummy.cc +++ b/src/core/ext/transport/cronet/transport/cronet_api_dummy.cc @@ -32,51 +32,55 @@ library, so we can build it in all environments */ #else /* Dummy implementation of cronet API just to test for build-ability */ bidirectional_stream* bidirectional_stream_create( - stream_engine* engine, void* annotation, - bidirectional_stream_callback* callback) { + stream_engine* /*engine*/, void* /*annotation*/, + bidirectional_stream_callback* /*callback*/) { GPR_ASSERT(0); return nullptr; } -int bidirectional_stream_destroy(bidirectional_stream* stream) { +int bidirectional_stream_destroy(bidirectional_stream* /*stream*/) { GPR_ASSERT(0); return 0; } -int bidirectional_stream_start(bidirectional_stream* stream, const char* url, - int priority, const char* method, - const bidirectional_stream_header_array* headers, - bool end_of_stream) { +int bidirectional_stream_start( + bidirectional_stream* /*stream*/, const char* /*url*/, int /*priority*/, + const char* /*method*/, + const bidirectional_stream_header_array* /*headers*/, + bool /*end_of_stream*/) { GPR_ASSERT(0); return 0; } -int bidirectional_stream_read(bidirectional_stream* stream, char* buffer, - int capacity) { +int bidirectional_stream_read(bidirectional_stream* /*stream*/, + char* /*buffer*/, int /*capacity*/) { GPR_ASSERT(0); return 0; } -int bidirectional_stream_write(bidirectional_stream* stream, const char* buffer, - int count, bool end_of_stream) { +int bidirectional_stream_write(bidirectional_stream* /*stream*/, + const char* /*buffer*/, int /*count*/, + bool /*end_of_stream*/) { GPR_ASSERT(0); return 0; } -void bidirectional_stream_cancel(bidirectional_stream* stream) { +void bidirectional_stream_cancel(bidirectional_stream* /*stream*/) { GPR_ASSERT(0); } -void bidirectional_stream_disable_auto_flush(bidirectional_stream* stream, - bool disable_auto_flush) { +void bidirectional_stream_disable_auto_flush(bidirectional_stream* /*stream*/, + bool /*disable_auto_flush*/) { GPR_ASSERT(0); } void bidirectional_stream_delay_request_headers_until_flush( - bidirectional_stream* stream, bool delay_headers_until_flush) { + bidirectional_stream* /*stream*/, bool /*delay_headers_until_flush*/) { GPR_ASSERT(0); } -void bidirectional_stream_flush(bidirectional_stream* stream) { GPR_ASSERT(0); } +void bidirectional_stream_flush(bidirectional_stream* /*stream*/) { + GPR_ASSERT(0); +} #endif /* GRPC_COMPILE_WITH_CRONET */ diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.cc b/src/core/ext/transport/cronet/transport/cronet_transport.cc index b98b6a173f3..329207f4c92 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.cc +++ b/src/core/ext/transport/cronet/transport/cronet_transport.cc @@ -1420,19 +1420,20 @@ inline stream_obj::~stream_obj() { } static int init_stream(grpc_transport* gt, grpc_stream* gs, - grpc_stream_refcount* refcount, const void* server_data, - grpc_core::Arena* arena) { + grpc_stream_refcount* refcount, + const void* /*server_data*/, grpc_core::Arena* arena) { new (gs) stream_obj(gt, gs, refcount, arena); return 0; } -static void set_pollset_do_nothing(grpc_transport* gt, grpc_stream* gs, - grpc_pollset* pollset) {} +static void set_pollset_do_nothing(grpc_transport* /*gt*/, grpc_stream* /*gs*/, + grpc_pollset* /*pollset*/) {} -static void set_pollset_set_do_nothing(grpc_transport* gt, grpc_stream* gs, - grpc_pollset_set* pollset_set) {} +static void set_pollset_set_do_nothing(grpc_transport* /*gt*/, + grpc_stream* /*gs*/, + grpc_pollset_set* /*pollset_set*/) {} -static void perform_stream_op(grpc_transport* gt, grpc_stream* gs, +static void perform_stream_op(grpc_transport* /*gt*/, grpc_stream* gs, grpc_transport_stream_op_batch* op) { CRONET_LOG(GPR_DEBUG, "perform_stream_op"); if (op->send_initial_metadata && @@ -1466,7 +1467,7 @@ static void perform_stream_op(grpc_transport* gt, grpc_stream* gs, execute_from_storage(s); } -static void destroy_stream(grpc_transport* gt, grpc_stream* gs, +static void destroy_stream(grpc_transport* /*gt*/, grpc_stream* gs, grpc_closure* then_schedule_closure) { stream_obj* s = reinterpret_cast(gs); s->~stream_obj(); @@ -1474,11 +1475,11 @@ static void destroy_stream(grpc_transport* gt, grpc_stream* gs, GRPC_ERROR_NONE); } -static void destroy_transport(grpc_transport* gt) {} +static void destroy_transport(grpc_transport* /*gt*/) {} -static grpc_endpoint* get_endpoint(grpc_transport* gt) { return nullptr; } +static grpc_endpoint* get_endpoint(grpc_transport* /*gt*/) { return nullptr; } -static void perform_op(grpc_transport* gt, grpc_transport_op* op) {} +static void perform_op(grpc_transport* /*gt*/, grpc_transport_op* /*op*/) {} static const grpc_transport_vtable grpc_cronet_vtable = { sizeof(stream_obj), @@ -1494,7 +1495,7 @@ static const grpc_transport_vtable grpc_cronet_vtable = { grpc_transport* grpc_create_cronet_transport(void* engine, const char* target, const grpc_channel_args* args, - void* reserved) { + void* /*reserved*/) { grpc_cronet_transport* ct = static_cast( gpr_malloc(sizeof(grpc_cronet_transport))); if (!ct) { diff --git a/src/core/ext/xds/google_mesh_ca_certificate_provider_factory.h b/src/core/ext/xds/google_mesh_ca_certificate_provider_factory.h index f2765d6d80b..31bf4275767 100644 --- a/src/core/ext/xds/google_mesh_ca_certificate_provider_factory.h +++ b/src/core/ext/xds/google_mesh_ca_certificate_provider_factory.h @@ -93,7 +93,7 @@ class GoogleMeshCaCertificateProviderFactory grpc_error** error) override; RefCountedPtr CreateCertificateProvider( - RefCountedPtr config) override { + RefCountedPtr /*config*/) override { // TODO(yashykt) : To be implemented return nullptr; } diff --git a/src/core/ext/xds/xds_bootstrap.cc b/src/core/ext/xds/xds_bootstrap.cc index 95f4c3de1e3..a4352d69e30 100644 --- a/src/core/ext/xds/xds_bootstrap.cc +++ b/src/core/ext/xds/xds_bootstrap.cc @@ -48,8 +48,8 @@ bool XdsChannelCredsRegistry::IsSupported(const std::string& creds_type) { creds_type == "fake"; } -bool XdsChannelCredsRegistry::IsValidConfig(const std::string& creds_type, - const Json& config) { +bool XdsChannelCredsRegistry::IsValidConfig(const std::string& /*creds_type*/, + const Json& /*config*/) { // Currently, none of the creds types actually take a config, but we // ignore whatever might be specified in the bootstrap file for // forward compatibility reasons. @@ -58,7 +58,7 @@ bool XdsChannelCredsRegistry::IsValidConfig(const std::string& creds_type, RefCountedPtr XdsChannelCredsRegistry::MakeChannelCreds(const std::string& creds_type, - const Json& config) { + const Json& /*config*/) { if (creds_type == "google_default") { return grpc_google_default_credentials_create(nullptr); } else if (creds_type == "insecure") { diff --git a/src/core/lib/gprpp/ref_counted.h b/src/core/lib/gprpp/ref_counted.h index 64f3f8fc9cf..47e2aadc374 100644 --- a/src/core/lib/gprpp/ref_counted.h +++ b/src/core/lib/gprpp/ref_counted.h @@ -226,7 +226,7 @@ class Delete { template class Delete { public: - explicit Delete(T* t) {} + explicit Delete(T* /*t*/) {} }; } // namespace internal diff --git a/src/core/lib/iomgr/socket_utils_common_posix.cc b/src/core/lib/iomgr/socket_utils_common_posix.cc index 0b94d8a3d4b..1af2cf7bbed 100644 --- a/src/core/lib/iomgr/socket_utils_common_posix.cc +++ b/src/core/lib/iomgr/socket_utils_common_posix.cc @@ -63,6 +63,7 @@ grpc_error* grpc_set_socket_zerocopy(int fd) { } return GRPC_ERROR_NONE; #else + (void)fd; return GRPC_OS_ERROR(ENOSYS, "setsockopt(SO_ZEROCOPY)"); #endif } diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc index 7813e044c50..6e1a29372cb 100644 --- a/src/core/lib/iomgr/tcp_posix.cc +++ b/src/core/lib/iomgr/tcp_posix.cc @@ -1241,11 +1241,11 @@ static void tcp_handle_error(void* arg /* grpc_tcp */, grpc_error* error) { #else /* GRPC_LINUX_ERRQUEUE */ static TcpZerocopySendRecord* tcp_get_send_zerocopy_record( - grpc_tcp* tcp, grpc_slice_buffer* buf) { + grpc_tcp* /*tcp*/, grpc_slice_buffer* /*buf*/) { return nullptr; } -static void ZerocopyDisableAndWaitForRemaining(grpc_tcp* tcp) {} +static void ZerocopyDisableAndWaitForRemaining(grpc_tcp* /*tcp*/) {} static bool tcp_write_with_timestamps(grpc_tcp* /*tcp*/, struct msghdr* /*msg*/, size_t /*sending_length*/, @@ -1391,8 +1391,8 @@ static bool do_tcp_flush_zerocopy(grpc_tcp* tcp, TcpZerocopySendRecord* record, static void UnrefMaybePutZerocopySendRecord(grpc_tcp* tcp, TcpZerocopySendRecord* record, - uint32_t seq, - const char* /* tag */) { + uint32_t /*seq*/, + const char* /*tag*/) { if (record->Unref()) { tcp->tcp_zerocopy_send_ctx.PutSendRecord(record); } diff --git a/src/core/lib/security/authorization/mock_cel/activation.h b/src/core/lib/security/authorization/mock_cel/activation.h index 693ed4d47ac..0e6eed1bca0 100644 --- a/src/core/lib/security/authorization/mock_cel/activation.h +++ b/src/core/lib/security/authorization/mock_cel/activation.h @@ -48,7 +48,7 @@ class Activation : public BaseActivation { Activation& operator=(const Activation&) = delete; // Insert value into Activation. - void InsertValue(absl::string_view name, const CelValue& value) {} + void InsertValue(absl::string_view /*name*/, const CelValue& /*value*/) {} }; } // namespace mock_cel diff --git a/src/core/lib/security/authorization/mock_cel/cel_value.h b/src/core/lib/security/authorization/mock_cel/cel_value.h index d0377279d7b..22d23243160 100644 --- a/src/core/lib/security/authorization/mock_cel/cel_value.h +++ b/src/core/lib/security/authorization/mock_cel/cel_value.h @@ -61,23 +61,25 @@ class CelValue { // We rely on copy elision to avoid extra copying. static CelValue CreateNull() { return CelValue(nullptr); } - static CelValue CreateInt64(int64_t value) { return CreateNull(); } + static CelValue CreateInt64(int64_t /*value*/) { return CreateNull(); } - static CelValue CreateUint64(uint64_t value) { return CreateNull(); } + static CelValue CreateUint64(uint64_t /*value*/) { return CreateNull(); } - static CelValue CreateStringView(absl::string_view value) { + static CelValue CreateStringView(absl::string_view /*value*/) { return CreateNull(); } - static CelValue CreateString(const std::string* str) { return CreateNull(); } + static CelValue CreateString(const std::string* /*str*/) { + return CreateNull(); + } - static CelValue CreateMap(const CelMap* value) { return CreateNull(); } + static CelValue CreateMap(const CelMap* /*value*/) { return CreateNull(); } private: // Constructs CelValue wrapping value supplied as argument. // Value type T should be supported by specification of ValueHolder. template - explicit CelValue(T value) {} + explicit CelValue(T /*value*/) {} }; // CelMap implementation that uses STL map container as backing storage. @@ -86,7 +88,7 @@ class ContainerBackedMapImpl : public CelMap { ContainerBackedMapImpl() = default; static std::unique_ptr Create( - absl::Span> key_values) { + absl::Span> /*key_values*/) { return absl::make_unique(); } }; diff --git a/src/core/lib/security/credentials/external/aws_external_account_credentials.cc b/src/core/lib/security/credentials/external/aws_external_account_credentials.cc index e9d60ead2de..3ad09d24785 100644 --- a/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +++ b/src/core/lib/security/credentials/external/aws_external_account_credentials.cc @@ -120,7 +120,7 @@ AwsExternalAccountCredentials::AwsExternalAccountCredentials( } void AwsExternalAccountCredentials::RetrieveSubjectToken( - HTTPRequestContext* ctx, const Options& options, + HTTPRequestContext* ctx, const Options& /*options*/, std::function cb) { if (ctx == nullptr) { FinishRetrieveSubjectToken( diff --git a/src/core/lib/security/credentials/external/file_external_account_credentials.cc b/src/core/lib/security/credentials/external/file_external_account_credentials.cc index 730c0951999..ec2cd6087d6 100644 --- a/src/core/lib/security/credentials/external/file_external_account_credentials.cc +++ b/src/core/lib/security/credentials/external/file_external_account_credentials.cc @@ -91,7 +91,7 @@ FileExternalAccountCredentials::FileExternalAccountCredentials( } void FileExternalAccountCredentials::RetrieveSubjectToken( - HTTPRequestContext* ctx, const Options& options, + HTTPRequestContext* /*ctx*/, const Options& /*options*/, std::function cb) { struct SliceWrapper { ~SliceWrapper() { grpc_slice_unref_internal(slice); } diff --git a/src/core/lib/security/credentials/external/url_external_account_credentials.cc b/src/core/lib/security/credentials/external/url_external_account_credentials.cc index 85d09be933d..2fa42cb465d 100644 --- a/src/core/lib/security/credentials/external/url_external_account_credentials.cc +++ b/src/core/lib/security/credentials/external/url_external_account_credentials.cc @@ -112,7 +112,7 @@ UrlExternalAccountCredentials::UrlExternalAccountCredentials( } void UrlExternalAccountCredentials::RetrieveSubjectToken( - HTTPRequestContext* ctx, const Options& options, + HTTPRequestContext* ctx, const Options& /*options*/, std::function cb) { if (ctx == nullptr) { FinishRetrieveSubjectToken( diff --git a/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc b/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc index 4cb7d21bc7d..ba0b89a94ec 100644 --- a/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc +++ b/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc @@ -51,14 +51,14 @@ RefCountedPtr TestOnlyMakeInsecureAuthContext() { // check_call_host and cancel_check_call_host are no-ops since we want to // provide an insecure channel. bool InsecureChannelSecurityConnector::check_call_host( - absl::string_view host, grpc_auth_context* auth_context, - grpc_closure* on_call_host_checked, grpc_error** error) { + absl::string_view /*host*/, grpc_auth_context* /*auth_context*/, + grpc_closure* /*on_call_host_checked*/, grpc_error** error) { *error = GRPC_ERROR_NONE; return true; } void InsecureChannelSecurityConnector::cancel_check_call_host( - grpc_closure* on_call_host_checked, grpc_error* error) { + grpc_closure* /*on_call_host_checked*/, grpc_error* error) { GRPC_ERROR_UNREF(error); } @@ -76,7 +76,7 @@ void InsecureChannelSecurityConnector::add_handshakers( } void InsecureChannelSecurityConnector::check_peer( - tsi_peer peer, grpc_endpoint* ep, + tsi_peer peer, grpc_endpoint* /*ep*/, RefCountedPtr* auth_context, grpc_closure* on_peer_checked) { *auth_context = MakeAuthContext(); @@ -104,7 +104,7 @@ void InsecureServerSecurityConnector::add_handshakers( } void InsecureServerSecurityConnector::check_peer( - tsi_peer peer, grpc_endpoint* ep, + tsi_peer peer, grpc_endpoint* /*ep*/, grpc_core::RefCountedPtr* auth_context, grpc_closure* on_peer_checked) { *auth_context = MakeAuthContext(); diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc index 852c93d088f..e380e274b66 100644 --- a/src/core/lib/surface/server.cc +++ b/src/core/lib/surface/server.cc @@ -513,7 +513,7 @@ grpc_resource_user* CreateDefaultResourceUser(const grpc_channel_args* args) { } RefCountedPtr CreateChannelzNode( - Server* server, const grpc_channel_args* args) { + Server* /*server*/, const grpc_channel_args* args) { RefCountedPtr channelz_node; if (grpc_channel_args_find_bool(args, GRPC_ARG_ENABLE_CHANNELZ, GRPC_ENABLE_CHANNELZ_DEFAULT)) { diff --git a/src/core/lib/transport/metadata.cc b/src/core/lib/transport/metadata.cc index dc719c36506..aa5e58136e5 100644 --- a/src/core/lib/transport/metadata.cc +++ b/src/core/lib/transport/metadata.cc @@ -673,6 +673,10 @@ void grpc_mdelem_do_unref(grpc_mdelem gmd DEBUG_ARGS) { void grpc_mdelem_on_final_unref(grpc_mdelem_data_storage storage, void* ptr, uint32_t hash DEBUG_ARGS) { +#ifndef NDEBUG + (void)file; + (void)line; +#endif switch (storage) { case GRPC_MDELEM_STORAGE_EXTERNAL: case GRPC_MDELEM_STORAGE_STATIC: diff --git a/src/core/tsi/fake_transport_security.cc b/src/core/tsi/fake_transport_security.cc index 0b256a1fc21..1ea43590c3f 100644 --- a/src/core/tsi/fake_transport_security.cc +++ b/src/core/tsi/fake_transport_security.cc @@ -490,7 +490,7 @@ struct fake_handshaker_result { size_t unused_bytes_size; }; static tsi_result fake_handshaker_result_extract_peer( - const tsi_handshaker_result* self, tsi_peer* peer) { + const tsi_handshaker_result* /*self*/, tsi_peer* peer) { /* Construct a tsi_peer with 1 property: certificate type, security_level. */ tsi_result result = tsi_construct_peer(2, peer); if (result != TSI_OK) return result; diff --git a/src/cpp/ext/filters/census/channel_filter.cc b/src/cpp/ext/filters/census/channel_filter.cc index 4ac684d2779..80670bf9e48 100644 --- a/src/cpp/ext/filters/census/channel_filter.cc +++ b/src/cpp/ext/filters/census/channel_filter.cc @@ -22,8 +22,8 @@ namespace grpc { -grpc_error* CensusChannelData::Init(grpc_channel_element* elem, - grpc_channel_element_args* args) { +grpc_error* CensusChannelData::Init(grpc_channel_element* /*elem*/, + grpc_channel_element_args* /*args*/) { return GRPC_ERROR_NONE; } diff --git a/src/cpp/ext/filters/census/client_filter.cc b/src/cpp/ext/filters/census/client_filter.cc index 3d909214213..c5af4d7cc11 100644 --- a/src/cpp/ext/filters/census/client_filter.cc +++ b/src/cpp/ext/filters/census/client_filter.cc @@ -152,9 +152,9 @@ grpc_error* CensusClientCallData::Init(grpc_call_element* elem, return GRPC_ERROR_NONE; } -void CensusClientCallData::Destroy(grpc_call_element* elem, +void CensusClientCallData::Destroy(grpc_call_element* /*elem*/, const grpc_call_final_info* final_info, - grpc_closure* then_call_closure) { + grpc_closure* /*then_call_closure*/) { const uint64_t request_size = GetOutgoingDataSize(final_info); const uint64_t response_size = GetIncomingDataSize(final_info); double latency_ms = absl::ToDoubleMilliseconds(absl::Now() - start_time_); diff --git a/src/cpp/ext/filters/census/context.cc b/src/cpp/ext/filters/census/context.cc index 2deeedfefc3..f2d251c1833 100644 --- a/src/cpp/ext/filters/census/context.cc +++ b/src/cpp/ext/filters/census/context.cc @@ -28,8 +28,9 @@ using ::opencensus::tags::TagMap; using ::opencensus::trace::Span; using ::opencensus::trace::SpanContext; -void GenerateServerContext(absl::string_view tracing, absl::string_view stats, - absl::string_view primary_role, +void GenerateServerContext(absl::string_view tracing, + absl::string_view /*stats*/, + absl::string_view /*primary_role*/, absl::string_view method, CensusContext* context) { // Destruct the current CensusContext to free the Span memory before // overwriting it below. @@ -77,7 +78,7 @@ size_t TraceContextSerialize(const ::opencensus::trace::SpanContext& context, tracing_buf_size); } -size_t StatsContextSerialize(size_t max_tags_len, grpc_slice* tags) { +size_t StatsContextSerialize(size_t /*max_tags_len*/, grpc_slice* /*tags*/) { // TODO(unknown): Add implementation. Waiting on stats tagging to be added. return 0; } diff --git a/src/cpp/ext/filters/census/server_filter.cc b/src/cpp/ext/filters/census/server_filter.cc index ab7fadc50ed..e01985e3fe3 100644 --- a/src/cpp/ext/filters/census/server_filter.cc +++ b/src/cpp/ext/filters/census/server_filter.cc @@ -179,9 +179,9 @@ grpc_error* CensusServerCallData::Init(grpc_call_element* elem, return GRPC_ERROR_NONE; } -void CensusServerCallData::Destroy(grpc_call_element* elem, +void CensusServerCallData::Destroy(grpc_call_element* /*elem*/, const grpc_call_final_info* final_info, - grpc_closure* then_call_closure) { + grpc_closure* /*then_call_closure*/) { const uint64_t request_size = GetOutgoingDataSize(final_info); const uint64_t response_size = GetIncomingDataSize(final_info); double elapsed_time_ms = absl::ToDoubleMilliseconds(elapsed_time_); diff --git a/src/cpp/server/load_reporter/load_reporter_async_service_impl.cc b/src/cpp/server/load_reporter/load_reporter_async_service_impl.cc index 47ef5260a96..73b8a903514 100644 --- a/src/cpp/server/load_reporter/load_reporter_async_service_impl.cc +++ b/src/cpp/server/load_reporter/load_reporter_async_service_impl.cc @@ -362,7 +362,7 @@ void LoadReporterAsyncServiceImpl::ReportLoadHandler::Shutdown( void LoadReporterAsyncServiceImpl::ReportLoadHandler::OnFinishDone( // NOLINTNEXTLINE(performance-unnecessary-value-param) - std::shared_ptr self, bool ok) { + std::shared_ptr /*self*/, bool ok) { if (ok) { gpr_log(GPR_INFO, "[LRS %p] Load reporting finished (lb_id_: %s, handler: %p).", diff --git a/src/cpp/server/load_reporter/load_reporting_service_server_builder_plugin.cc b/src/cpp/server/load_reporter/load_reporting_service_server_builder_plugin.cc index c2c5dd5ed5c..aa0ac19ff7d 100644 --- a/src/cpp/server/load_reporter/load_reporting_service_server_builder_plugin.cc +++ b/src/cpp/server/load_reporter/load_reporting_service_server_builder_plugin.cc @@ -51,7 +51,7 @@ void LoadReportingServiceServerBuilderPlugin::InitServer( } void LoadReportingServiceServerBuilderPlugin::Finish( - grpc::ServerInitializer* si) { + grpc::ServerInitializer* /*si*/) { service_->StartThread(); service_.reset(); } diff --git a/src/cpp/server/load_reporter/load_reporting_service_server_builder_plugin.h b/src/cpp/server/load_reporter/load_reporting_service_server_builder_plugin.h index 781bbe1cefa..22b8a72ff49 100644 --- a/src/cpp/server/load_reporter/load_reporting_service_server_builder_plugin.h +++ b/src/cpp/server/load_reporter/load_reporting_service_server_builder_plugin.h @@ -44,8 +44,8 @@ class LoadReportingServiceServerBuilderPlugin : public ServerBuilderPlugin { // Starts the load reporter service. void Finish(ServerInitializer* si) override; - void ChangeArguments(const std::string& name, void* value) override {} - void UpdateChannelArguments(grpc::ChannelArguments* args) override {} + void ChangeArguments(const std::string& /*name*/, void* /*value*/) override {} + void UpdateChannelArguments(grpc::ChannelArguments* /*args*/) override {} bool has_sync_methods() const override; bool has_async_methods() const override; diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index eb31ca442c9..710b59da5a6 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -573,6 +573,11 @@ static grpc_call_error grpcsharp_call_start_batch_nop(grpc_call* call, const grpc_op* ops, size_t nops, void* tag, void* reserved) { + (void)call; + (void)ops; + (void)nops; + (void)tag; + (void)reserved; return GRPC_CALL_OK; } @@ -654,6 +659,9 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_test_call_start_unary_echo( grpc_call* call, grpcsharp_batch_context* ctx, grpc_slice_buffer* send_buffer, uint32_t write_flags, grpc_metadata_array* initial_metadata, uint32_t initial_metadata_flags) { + (void)call; + (void)write_flags; + (void)initial_metadata_flags; // prepare as if we were performing a normal RPC. grpc_byte_buffer* send_message = grpcsharp_create_byte_buffer_from_stolen_slices(send_buffer); @@ -1136,6 +1144,10 @@ static int grpcsharp_get_metadata_handler( grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX], size_t* num_creds_md, grpc_status_code* status, const char** error_details) { + (void)creds_md; + (void)num_creds_md; + (void)status; + (void)error_details; // the "context" object and its contents are only guaranteed to live until // this handler returns (which could result in use-after-free for async // handling of the callback), so the C# counterpart of this handler diff --git a/test/core/client_channel/certificate_provider_registry_test.cc b/test/core/client_channel/certificate_provider_registry_test.cc index f6798477e45..0c6b6d03a5c 100644 --- a/test/core/client_channel/certificate_provider_registry_test.cc +++ b/test/core/client_channel/certificate_provider_registry_test.cc @@ -33,12 +33,12 @@ class FakeCertificateProviderFactory1 : public CertificateProviderFactory { const char* name() const override { return "fake1"; } RefCountedPtr CreateCertificateProviderConfig( - const Json& config_json, grpc_error** error) override { + const Json& /*config_json*/, grpc_error** /*error*/) override { return nullptr; } RefCountedPtr CreateCertificateProvider( - RefCountedPtr config) override { + RefCountedPtr /*config*/) override { return nullptr; } }; @@ -48,12 +48,12 @@ class FakeCertificateProviderFactory2 : public CertificateProviderFactory { const char* name() const override { return "fake2"; } RefCountedPtr CreateCertificateProviderConfig( - const Json& config_json, grpc_error** error) override { + const Json& /*config_json*/, grpc_error** /*error*/) override { return nullptr; } RefCountedPtr CreateCertificateProvider( - RefCountedPtr config) override { + RefCountedPtr /*config*/) override { return nullptr; } }; diff --git a/test/core/end2end/cq_verifier.cc b/test/core/end2end/cq_verifier.cc index da526ea9927..0d1d69d1191 100644 --- a/test/core/end2end/cq_verifier.cc +++ b/test/core/end2end/cq_verifier.cc @@ -304,7 +304,7 @@ void cq_verify_empty_timeout(cq_verifier* v, int timeout_sec) { void cq_verify_empty(cq_verifier* v) { cq_verify_empty_timeout(v, 1); } void cq_maybe_expect_completion(cq_verifier* v, const char* file, int line, - void* tag, bool success, bool* seen) { + void* tag, bool /*success*/, bool* seen) { v->maybe_expectations.emplace_back(file, line, GRPC_OP_COMPLETE, tag, true, true, seen); } diff --git a/test/core/network_benchmarks/low_level_ping_pong.cc b/test/core/network_benchmarks/low_level_ping_pong.cc index 0e0155543bb..deb3a5b9812 100644 --- a/test/core/network_benchmarks/low_level_ping_pong.cc +++ b/test/core/network_benchmarks/low_level_ping_pong.cc @@ -232,7 +232,7 @@ static int set_socket_nonblocking(thread_args* args) { return 0; } -static int do_nothing(thread_args* args) { return 0; } +static int do_nothing(thread_args* /*args*/) { return 0; } #ifdef __linux__ /* Special case for epoll, where we need to create the fd ahead of time. */ diff --git a/test/core/security/credentials_test.cc b/test/core/security/credentials_test.cc index 6106f6d4384..604ab358682 100644 --- a/test/core/security/credentials_test.cc +++ b/test/core/security/credentials_test.cc @@ -1670,17 +1670,17 @@ struct fake_call_creds : public grpc_call_credentials { ~fake_call_creds() override { GRPC_MDELEM_UNREF(dummy_md_); } - bool get_request_metadata(grpc_polling_entity* pollent, - grpc_auth_metadata_context context, + bool get_request_metadata(grpc_polling_entity* /*pollent*/, + grpc_auth_metadata_context /*context*/, grpc_credentials_mdelem_array* md_array, - grpc_closure* on_request_metadata, - grpc_error** error) override { + grpc_closure* /*on_request_metadata*/, + grpc_error** /*error*/) override { grpc_credentials_mdelem_array_add(md_array, dummy_md_); return true; } - void cancel_get_request_metadata(grpc_credentials_mdelem_array* md_array, - grpc_error* error) override {} + void cancel_get_request_metadata(grpc_credentials_mdelem_array* /*md_array*/, + grpc_error* /*error*/) override {} private: grpc_mdelem dummy_md_; @@ -1983,7 +1983,7 @@ static void test_auth_metadata_context(void) { static void validate_external_account_creds_token_exchage_request( const grpc_httpcli_request* request, const char* body, size_t body_size, - bool expect_actor_token) { + bool /*expect_actor_token*/) { // Check that the body is constructed properly. GPR_ASSERT(body != nullptr); GPR_ASSERT(body_size != 0); @@ -2021,7 +2021,7 @@ static void validate_external_account_creds_token_exchage_request( static void validate_external_account_creds_token_exchage_request_with_url_encode( const grpc_httpcli_request* request, const char* body, size_t body_size, - bool expect_actor_token) { + bool /*expect_actor_token*/) { // Check that the body is constructed properly. GPR_ASSERT(body != nullptr); GPR_ASSERT(body_size != 0); @@ -2051,7 +2051,7 @@ validate_external_account_creds_token_exchage_request_with_url_encode( static void validate_external_account_creds_service_account_impersonation_request( const grpc_httpcli_request* request, const char* body, size_t body_size, - bool expect_actor_token) { + bool /*expect_actor_token*/) { // Check that the body is constructed properly. GPR_ASSERT(body != nullptr); GPR_ASSERT(body_size != 0); @@ -2097,8 +2097,8 @@ static int external_account_creds_httpcli_post_success( static int external_account_creds_httpcli_post_failure_token_exchange_response_missing_access_token( - const grpc_httpcli_request* request, const char* body, size_t body_size, - grpc_millis /*deadline*/, grpc_closure* on_done, + const grpc_httpcli_request* request, const char* /*body*/, + size_t /*body_size*/, grpc_millis /*deadline*/, grpc_closure* on_done, grpc_httpcli_response* response) { if (strcmp(request->http.path, "/token") == 0) { *response = http_response(200, @@ -2139,7 +2139,7 @@ static int url_external_account_creds_httpcli_get_success( static void validate_aws_external_account_creds_token_exchage_request( const grpc_httpcli_request* request, const char* body, size_t body_size, - bool expect_actor_token) { + bool /*expect_actor_token*/) { // Check that the body is constructed properly. GPR_ASSERT(body != nullptr); GPR_ASSERT(body_size != 0); @@ -2212,7 +2212,7 @@ class TestExternalAccountCredentials final protected: void RetrieveSubjectToken( - HTTPRequestContext* ctx, const Options& options, + HTTPRequestContext* /*ctx*/, const Options& /*options*/, std::function cb) override { cb("test_subject_token", GRPC_ERROR_NONE); } diff --git a/test/core/security/grpc_tls_certificate_distributor_test.cc b/test/core/security/grpc_tls_certificate_distributor_test.cc index 9e8efcc4de0..b0a04451c04 100644 --- a/test/core/security/grpc_tls_certificate_distributor_test.cc +++ b/test/core/security/grpc_tls_certificate_distributor_test.cc @@ -562,8 +562,8 @@ TEST_F(GrpcTlsCertificateDistributorTest, ResetCallbackToNull) { TEST_F(GrpcTlsCertificateDistributorTest, SetKeyMaterialsInCallback) { distributor_.SetWatchStatusCallback([this](std::string cert_name, - bool root_being_watched, - bool identity_being_watched) { + bool /*root_being_watched*/, + bool /*identity_being_watched*/) { distributor_.SetKeyMaterials( cert_name, kRootCert1Contents, MakeCertKeyPairs(kIdentityCert1PrivateKey, kIdentityCert1Contents)); @@ -913,8 +913,8 @@ TEST_F(GrpcTlsCertificateDistributorTest, WatchErroredCertInfoBySetError) { TEST_F(GrpcTlsCertificateDistributorTest, SetErrorForCertInCallback) { distributor_.SetWatchStatusCallback([this](std::string cert_name, - bool root_being_watched, - bool identity_being_watched) { + bool /*root_being_watched*/, + bool /*identity_being_watched*/) { this->distributor_.SetErrorForCert( cert_name, GRPC_ERROR_CREATE_FROM_STATIC_STRING(kRootErrorMessage), GRPC_ERROR_CREATE_FROM_STATIC_STRING(kIdentityErrorMessage)); diff --git a/test/core/tsi/alts/fake_handshaker/fake_handshaker_server.cc b/test/core/tsi/alts/fake_handshaker/fake_handshaker_server.cc index c6f08afed81..7e49e68e0bc 100644 --- a/test/core/tsi/alts/fake_handshaker/fake_handshaker_server.cc +++ b/test/core/tsi/alts/fake_handshaker/fake_handshaker_server.cc @@ -59,7 +59,7 @@ class FakeHandshakerService : public HandshakerService::Service { : expected_max_concurrent_rpcs_(expected_max_concurrent_rpcs) {} Status DoHandshake( - ServerContext* server_context, + ServerContext* /*server_context*/, ServerReaderWriter* stream) override { ConcurrentRpcsCheck concurrent_rpcs_check(this); Status status; diff --git a/test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc b/test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc index c14e6bfd278..93f326d3d3e 100644 --- a/test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc +++ b/test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc @@ -440,10 +440,10 @@ static void schedule_request_success_test() { destroy_config(config); } -static void tsi_cb_assert_tsi_internal_error(tsi_result status, void* user_data, - const unsigned char* bytes_to_send, - size_t bytes_to_send_size, - tsi_handshaker_result* result) { +static void tsi_cb_assert_tsi_internal_error( + tsi_result status, void* /*user_data*/, + const unsigned char* /*bytes_to_send*/, size_t /*bytes_to_send_size*/, + tsi_handshaker_result* /*result*/) { GPR_ASSERT(status == TSI_INTERNAL_ERROR); } diff --git a/test/core/tsi/ssl_session_cache_test.cc b/test/core/tsi/ssl_session_cache_test.cc index b9c98c0b57c..33f3467c9c8 100644 --- a/test/core/tsi/ssl_session_cache_test.cc +++ b/test/core/tsi/ssl_session_cache_test.cc @@ -72,8 +72,8 @@ class SessionTracker { return tsi::SslSessionPtr(cb(ssl_context_)); } - static void DestroyExData(void* parent, void* ptr, CRYPTO_EX_DATA* ad, - int index, long argl, void* argp) { + static void DestroyExData(void* /*parent*/, void* ptr, CRYPTO_EX_DATA* /*ad*/, + int /*index*/, long /*argl*/, void* /*argp*/) { SessionExDataId* data = static_cast(ptr); data->tracker->alive_sessions_.erase(data->id); delete data; diff --git a/test/core/util/eval_args_mock_endpoint.cc b/test/core/util/eval_args_mock_endpoint.cc index bd41d4b4191..6f0de72dd3d 100644 --- a/test/core/util/eval_args_mock_endpoint.cc +++ b/test/core/util/eval_args_mock_endpoint.cc @@ -36,15 +36,16 @@ class EvalArgsMockEndpoint { base_.vtable = &vtable_; } grpc_endpoint* base() const { return const_cast(&base_); } - static void Read(grpc_endpoint* ep, grpc_slice_buffer* slices, - grpc_closure* cb, bool unused) {} - static void Write(grpc_endpoint* ep, grpc_slice_buffer* slices, - grpc_closure* cb, void* unused) {} - static void AddToPollset(grpc_endpoint* ep, grpc_pollset* unused) {} - static void AddToPollsetSet(grpc_endpoint* ep, grpc_pollset_set* unused) {} - static void DeleteFromPollsetSet(grpc_endpoint* ep, - grpc_pollset_set* unused) {} - static void Shutdown(grpc_endpoint* ep, grpc_error* why) {} + static void Read(grpc_endpoint* /*ep*/, grpc_slice_buffer* /*slices*/, + grpc_closure* /*cb*/, bool /*unused*/) {} + static void Write(grpc_endpoint* /*ep*/, grpc_slice_buffer* /*slices*/, + grpc_closure* /*cb*/, void* /*unused*/) {} + static void AddToPollset(grpc_endpoint* /*ep*/, grpc_pollset* /*unused*/) {} + static void AddToPollsetSet(grpc_endpoint* /*ep*/, + grpc_pollset_set* /*unused*/) {} + static void DeleteFromPollsetSet(grpc_endpoint* /*ep*/, + grpc_pollset_set* /*unused*/) {} + static void Shutdown(grpc_endpoint* /*ep*/, grpc_error* /*why*/) {} static void Destroy(grpc_endpoint* ep) { EvalArgsMockEndpoint* m = reinterpret_cast(ep); delete m; @@ -60,12 +61,12 @@ class EvalArgsMockEndpoint { return m->local_address_; } - static grpc_resource_user* GetResourceUser(grpc_endpoint* ep) { + static grpc_resource_user* GetResourceUser(grpc_endpoint* /*ep*/) { return nullptr; } - static int GetFd(grpc_endpoint* unused) { return -1; } - static bool CanTrackErr(grpc_endpoint* unused) { return false; } + static int GetFd(grpc_endpoint* /*unused*/) { return -1; } + static bool CanTrackErr(grpc_endpoint* /*unused*/) { return false; } private: static constexpr grpc_endpoint_vtable vtable_ = { diff --git a/test/core/util/test_config.cc b/test/core/util/test_config.cc index 9fe08bc1cd1..15166153812 100644 --- a/test/core/util/test_config.cc +++ b/test/core/util/test_config.cc @@ -153,7 +153,7 @@ gpr_timespec grpc_timeout_milliseconds_to_deadline(int64_t time_ms) { GPR_TIMESPAN)); } -void grpc_test_init(int argc, char** argv) { +void grpc_test_init(int /*argc*/, char** argv) { grpc_core::testing::InitializeStackTracer(argv[0]); absl::FailureSignalHandlerOptions options; absl::InstallFailureSignalHandler(options); diff --git a/test/core/xds/certificate_provider_store_test.cc b/test/core/xds/certificate_provider_store_test.cc index 0866ed4bc2b..6df39ff321d 100644 --- a/test/core/xds/certificate_provider_store_test.cc +++ b/test/core/xds/certificate_provider_store_test.cc @@ -57,13 +57,13 @@ class FakeCertificateProviderFactory1 : public CertificateProviderFactory { const char* name() const override { return "fake1"; } RefCountedPtr - CreateCertificateProviderConfig(const Json& config_json, - grpc_error** error) override { + CreateCertificateProviderConfig(const Json& /*config_json*/, + grpc_error** /*error*/) override { return MakeRefCounted(); } RefCountedPtr CreateCertificateProvider( - RefCountedPtr config) override { + RefCountedPtr /*config*/) override { return MakeRefCounted(); } }; @@ -80,13 +80,13 @@ class FakeCertificateProviderFactory2 : public CertificateProviderFactory { const char* name() const override { return "fake2"; } RefCountedPtr - CreateCertificateProviderConfig(const Json& config_json, - grpc_error** error) override { + CreateCertificateProviderConfig(const Json& /*config_json*/, + grpc_error** /*error*/) override { return MakeRefCounted(); } RefCountedPtr CreateCertificateProvider( - RefCountedPtr config) override { + RefCountedPtr /*config*/) override { return MakeRefCounted(); } }; diff --git a/test/core/xds/xds_bootstrap_test.cc b/test/core/xds/xds_bootstrap_test.cc index d74bbf035a6..5ff3bc8cafd 100644 --- a/test/core/xds/xds_bootstrap_test.cc +++ b/test/core/xds/xds_bootstrap_test.cc @@ -507,7 +507,7 @@ class FakeCertificateProviderFactory : public CertificateProviderFactory { } RefCountedPtr CreateCertificateProvider( - RefCountedPtr config) override { + RefCountedPtr /*config*/) override { return nullptr; } }; diff --git a/test/cpp/end2end/nonblocking_test.cc b/test/cpp/end2end/nonblocking_test.cc index f3a13a2d954..04446e50faa 100644 --- a/test/cpp/end2end/nonblocking_test.cc +++ b/test/cpp/end2end/nonblocking_test.cc @@ -212,6 +212,8 @@ int main(int argc, char** argv) { gpr_tls_destroy(&g_is_nonblocking_poll); return ret; #else // GRPC_POSIX_SOCKET + (void)argc; + (void)argv; return 0; #endif // GRPC_POSIX_SOCKET } diff --git a/test/cpp/end2end/xds_end2end_test.cc b/test/cpp/end2end/xds_end2end_test.cc index 895d7defde6..36b6c777ced 100644 --- a/test/cpp/end2end/xds_end2end_test.cc +++ b/test/cpp/end2end/xds_end2end_test.cc @@ -1050,7 +1050,7 @@ class AdsServiceImpl : public std::enable_shared_from_this { } static void CheckBuildVersion( - const ::envoy::service::discovery::v3::DiscoveryRequest& request) {} + const ::envoy::service::discovery::v3::DiscoveryRequest& /*request*/) {} AdsServiceImpl* parent_; const bool is_v2_; @@ -1061,7 +1061,7 @@ class AdsServiceImpl : public std::enable_shared_from_this { static bool ClientNeedsResourceUpdate( const ResourceTypeState& resource_type_state, const ResourceState& resource_state, int client_resource_type_version, - SubscriptionState* subscription_state) { + SubscriptionState* /*subscription_state*/) { return client_resource_type_version < resource_type_state.resource_type_version && resource_state.resource_type_version <= @@ -1449,15 +1449,15 @@ class FakeCertificateProviderFactory const char* name() const override { return name_; } grpc_core::RefCountedPtr - CreateCertificateProviderConfig(const grpc_core::Json& config_json, - grpc_error** error) override { + CreateCertificateProviderConfig(const grpc_core::Json& /*config_json*/, + grpc_error** /*error*/) override { return grpc_core::MakeRefCounted(name_); } grpc_core::RefCountedPtr CreateCertificateProvider( grpc_core::RefCountedPtr - config) override { + /*config*/) override { if (*cert_data_map_ == nullptr) return nullptr; return grpc_core::MakeRefCounted(**cert_data_map_); } diff --git a/test/cpp/ext/filters/census/stats_plugin_end2end_test.cc b/test/cpp/ext/filters/census/stats_plugin_end2end_test.cc index 3b98286cf75..8ad46dd9c34 100644 --- a/test/cpp/ext/filters/census/stats_plugin_end2end_test.cc +++ b/test/cpp/ext/filters/census/stats_plugin_end2end_test.cc @@ -51,7 +51,7 @@ static const auto TEST_TAG_KEY = TagKey::Register("my_key"); static const auto TEST_TAG_VALUE = "my_value"; class EchoServer final : public EchoTestService::Service { - ::grpc::Status Echo(::grpc::ServerContext* context, + ::grpc::Status Echo(::grpc::ServerContext* /*context*/, const EchoRequest* request, EchoResponse* response) override { if (request->param().expected_error().code() == 0) { diff --git a/test/cpp/interop/xds_interop_client.cc b/test/cpp/interop/xds_interop_client.cc index 748e9e7378c..5439046afa2 100644 --- a/test/cpp/interop/xds_interop_client.cc +++ b/test/cpp/interop/xds_interop_client.cc @@ -367,7 +367,7 @@ class LoadBalancerStatsServiceImpl : public LoadBalancerStatsService::Service { explicit LoadBalancerStatsServiceImpl(StatsWatchers* stats_watchers) : stats_watchers_(stats_watchers) {} - Status GetClientStats(ServerContext* context, + Status GetClientStats(ServerContext* /*context*/, const LoadBalancerStatsRequest* request, LoadBalancerStatsResponse* response) override { int start_id; @@ -390,8 +390,8 @@ class LoadBalancerStatsServiceImpl : public LoadBalancerStatsService::Service { } Status GetClientAccumulatedStats( - ServerContext* context, - const LoadBalancerAccumulatedStatsRequest* request, + ServerContext* /*context*/, + const LoadBalancerAccumulatedStatsRequest* /*request*/, LoadBalancerAccumulatedStatsResponse* response) override { std::lock_guard lock(stats_watchers_->mu); stats_watchers_->global_watcher->GetCurrentRpcStats(response, @@ -410,9 +410,9 @@ class XdsUpdateClientConfigureServiceImpl RpcConfigurationsQueue* rpc_configs_queue) : rpc_configs_queue_(rpc_configs_queue) {} - Status Configure(ServerContext* context, + Status Configure(ServerContext* /*context*/, const ClientConfigureRequest* request, - ClientConfigureResponse* response) override { + ClientConfigureResponse* /*response*/) override { std::map>> metadata_map; for (const auto& data : request->metadata()) { diff --git a/test/cpp/interop/xds_interop_server.cc b/test/cpp/interop/xds_interop_server.cc index 99551737d9c..1913c53964b 100644 --- a/test/cpp/interop/xds_interop_server.cc +++ b/test/cpp/interop/xds_interop_server.cc @@ -52,7 +52,7 @@ class TestServiceImpl : public TestService::Service { public: explicit TestServiceImpl(const std::string& i) : hostname_(i) {} - Status UnaryCall(ServerContext* context, const SimpleRequest* request, + Status UnaryCall(ServerContext* context, const SimpleRequest* /*request*/, SimpleResponse* response) override { response->set_server_id(absl::GetFlag(FLAGS_server_id)); response->set_hostname(hostname_); @@ -60,8 +60,8 @@ class TestServiceImpl : public TestService::Service { return Status::OK; } - Status EmptyCall(ServerContext* context, const Empty* request, - Empty* response) override { + Status EmptyCall(ServerContext* context, const Empty* /*request*/, + Empty* /*response*/) override { context->AddInitialMetadata("hostname", hostname_); return Status::OK; } diff --git a/test/cpp/microbenchmarks/bm_opencensus_plugin.cc b/test/cpp/microbenchmarks/bm_opencensus_plugin.cc index 75f5a50bc2d..1a5aa0597eb 100644 --- a/test/cpp/microbenchmarks/bm_opencensus_plugin.cc +++ b/test/cpp/microbenchmarks/bm_opencensus_plugin.cc @@ -34,7 +34,7 @@ absl::once_flag once; void RegisterOnce() { absl::call_once(once, grpc::RegisterOpenCensusPlugin); } class EchoServer final : public grpc::testing::EchoTestService::Service { - grpc::Status Echo(grpc::ServerContext* context, + grpc::Status Echo(grpc::ServerContext* /*context*/, const grpc::testing::EchoRequest* request, grpc::testing::EchoResponse* response) override { if (request->param().expected_error().code() == 0) { diff --git a/test/cpp/util/channelz_sampler_test.cc b/test/cpp/util/channelz_sampler_test.cc index 89d82c60a46..5dad0705427 100644 --- a/test/cpp/util/channelz_sampler_test.cc +++ b/test/cpp/util/channelz_sampler_test.cc @@ -64,9 +64,9 @@ std::string output_json("output.json"); // Creata an echo server class EchoServerImpl final : public grpc::testing::TestService::Service { - Status EmptyCall(::grpc::ServerContext* context, - const grpc::testing::Empty* request, - grpc::testing::Empty* response) override { + Status EmptyCall(::grpc::ServerContext* /*context*/, + const grpc::testing::Empty* /*request*/, + grpc::testing::Empty* /*response*/) override { return Status::OK; } }; diff --git a/test/cpp/util/grpc_tool_test.cc b/test/cpp/util/grpc_tool_test.cc index 7cd2751417c..bbf9cc03682 100644 --- a/test/cpp/util/grpc_tool_test.cc +++ b/test/cpp/util/grpc_tool_test.cc @@ -184,7 +184,8 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { return Status::OK; } - Status CheckDeadlineSet(ServerContext* context, const SimpleRequest* request, + Status CheckDeadlineSet(ServerContext* context, + const SimpleRequest* /*request*/, StringValue* response) override { response->set_message(context->deadline() != std::chrono::system_clock::time_point::max() @@ -196,7 +197,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { // Check if deadline - current time <= timeout // If deadline set, timeout + current time should be an upper bound for it Status CheckDeadlineUpperBound(ServerContext* context, - const SimpleRequest* request, + const SimpleRequest* /*request*/, StringValue* response) override { auto seconds = std::chrono::duration_cast( context->deadline() - std::chrono::system_clock::now()); From 126b9524d713a35afdd7d9801afce118ab7de687 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Tue, 19 Jan 2021 23:24:30 -0800 Subject: [PATCH 10/21] update in templates --- templates/grpc.gemspec.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/grpc.gemspec.template b/templates/grpc.gemspec.template index a5e0801296d..ac543af7a64 100644 --- a/templates/grpc.gemspec.template +++ b/templates/grpc.gemspec.template @@ -15,7 +15,7 @@ s.description = 'Send RPCs from Ruby using GRPC' s.license = 'Apache-2.0' - s.required_ruby_version = '>= 2.3.0' + s.required_ruby_version = '>= 2.4.0' s.files = %w( Makefile .yardopts ) s.files += %w( etc/roots.pem ) From 7d4d516511855fd440f77188a81bcd2e01eef849 Mon Sep 17 00:00:00 2001 From: Greg Miller <9447643+devjgm@users.noreply.github.com> Date: Wed, 13 Jan 2021 13:49:37 -0500 Subject: [PATCH 11/21] wip: change error_details functions to templates --- BUILD | 1 - CMakeLists.txt | 12 +++---- Package.swift | 1 - build_autogenerated.yaml | 2 +- grpc.gyp | 1 - include/grpcpp/support/error_details.h | 48 ++++++++++++++++++++------ src/cpp/util/error_details.cc | 31 ----------------- test/cpp/util/BUILD | 1 + 8 files changed, 44 insertions(+), 53 deletions(-) diff --git a/BUILD b/BUILD index 9702615098f..9a235cf8fa7 100644 --- a/BUILD +++ b/BUILD @@ -462,7 +462,6 @@ grpc_cc_library( standalone = True, deps = [ "grpc++", - "//src/proto/grpc/status:status_proto", ], ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 64a4a9076e5..35e60ac4730 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3039,12 +3039,7 @@ if(gRPC_INSTALL) endif() -if(gRPC_BUILD_CODEGEN) add_library(grpc++_error_details - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.pb.cc - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.grpc.pb.cc - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.pb.h - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.grpc.pb.h src/cpp/util/error_details.cc ) @@ -3097,9 +3092,7 @@ foreach(_hdr DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" ) endforeach() -endif() -if(gRPC_BUILD_CODEGEN) if(gRPC_INSTALL) install(TARGETS grpc++_error_details EXPORT gRPCTargets @@ -3109,7 +3102,6 @@ if(gRPC_INSTALL) ) endif() -endif() if(gRPC_BUILD_CODEGEN) add_library(grpc++_reflection @@ -10804,6 +10796,10 @@ endif() if(gRPC_BUILD_TESTS) add_executable(error_details_test + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.grpc.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.pb.h + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.grpc.pb.h ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo_messages.pb.cc ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo_messages.grpc.pb.cc ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo_messages.pb.h diff --git a/Package.swift b/Package.swift index 610ecb39ff9..c97d43f61c4 100644 --- a/Package.swift +++ b/Package.swift @@ -106,7 +106,6 @@ let package = Package( "src/cpp/server/load_reporter/", "src/cpp/util/core_stats.cc", "src/cpp/util/core_stats.h", - "src/cpp/util/error_details.cc", ], sources: [ "src/cpp/", diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index 45dd397425d..5fca555a21c 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -2395,7 +2395,6 @@ libs: - include/grpcpp/support/error_details.h headers: [] src: - - src/proto/grpc/status/status.proto - src/cpp/util/error_details.cc deps: - grpc++ @@ -5896,6 +5895,7 @@ targets: language: c++ headers: [] src: + - src/proto/grpc/status/status.proto - src/proto/grpc/testing/echo_messages.proto - test/cpp/util/error_details_test.cc deps: diff --git a/grpc.gyp b/grpc.gyp index d8a2616c233..4ad878bcb5a 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -1471,7 +1471,6 @@ 'upb', ], 'sources': [ - 'src/proto/grpc/status/status.proto', 'src/cpp/util/error_details.cc', ], }, diff --git a/include/grpcpp/support/error_details.h b/include/grpcpp/support/error_details.h index 15b917f6c5c..72305e8f3ab 100644 --- a/include/grpcpp/support/error_details.h +++ b/include/grpcpp/support/error_details.h @@ -21,12 +21,6 @@ #include -namespace google { -namespace rpc { -class Status; -} // namespace rpc -} // namespace google - namespace grpc { /// Map a \a grpc::Status to a \a google::rpc::Status. @@ -34,14 +28,48 @@ namespace grpc { /// On success, returns status with OK. /// Returns status with \a INVALID_ARGUMENT, if failed to deserialize. /// Returns status with \a FAILED_PRECONDITION, if \a to is nullptr. -grpc::Status ExtractErrorDetails(const grpc::Status& from, - ::google::rpc::Status* to); +/// +/// \note +/// This function is a template to avoid a build dep on \a status.proto. +/// However, this function still requires that \tparam T is of type +/// \a google::rpc::Status, which is defined at +/// https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto +template +grpc::Status ExtractErrorDetails(const grpc::Status& from, T* to) { + if (to == nullptr) { + return grpc::Status(grpc::StatusCode::FAILED_PRECONDITION, ""); + } + if (!to->ParseFromString(from.error_details())) { + return grpc::Status(grpc::StatusCode::INVALID_ARGUMENT, ""); + } + return grpc::Status::OK; +} +inline grpc::Status ExtractErrorDetails(const grpc::Status&, std::nullptr_t) { + return grpc::Status(grpc::StatusCode::FAILED_PRECONDITION, ""); +} /// Map \a google::rpc::Status to a \a grpc::Status. /// Returns OK on success. /// Returns status with \a FAILED_PRECONDITION if \a to is nullptr. -grpc::Status SetErrorDetails(const ::google::rpc::Status& from, - grpc::Status* to); +/// +/// \note +/// This function is a template to avoid a build dep on \a status.proto. +/// However, this function still requires that \tparam T is of type +/// \a google::rpc::Status, which is defined at +/// https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto +template +grpc::Status SetErrorDetails(const T& from, grpc::Status* to) { + if (to == nullptr) { + return grpc::Status(grpc::StatusCode::FAILED_PRECONDITION, ""); + } + grpc::StatusCode code = grpc::StatusCode::UNKNOWN; + if (from.code() >= grpc::StatusCode::OK && + from.code() <= grpc::StatusCode::UNAUTHENTICATED) { + code = static_cast(from.code()); + } + *to = grpc::Status(code, from.message(), from.SerializeAsString()); + return grpc::Status::OK; +} } // namespace grpc diff --git a/src/cpp/util/error_details.cc b/src/cpp/util/error_details.cc index f35a6125552..0330f012c27 100644 --- a/src/cpp/util/error_details.cc +++ b/src/cpp/util/error_details.cc @@ -17,34 +17,3 @@ */ #include - -#include "src/proto/grpc/status/status.pb.h" - -namespace grpc { - -grpc::Status ExtractErrorDetails(const grpc::Status& from, - ::google::rpc::Status* to) { - if (to == nullptr) { - return grpc::Status(grpc::StatusCode::FAILED_PRECONDITION, ""); - } - if (!to->ParseFromString(from.error_details())) { - return grpc::Status(grpc::StatusCode::INVALID_ARGUMENT, ""); - } - return grpc::Status::OK; -} - -grpc::Status SetErrorDetails(const ::google::rpc::Status& from, - grpc::Status* to) { - if (to == nullptr) { - return grpc::Status(grpc::StatusCode::FAILED_PRECONDITION, ""); - } - grpc::StatusCode code = grpc::StatusCode::UNKNOWN; - if (from.code() >= grpc::StatusCode::OK && - from.code() <= grpc::StatusCode::UNAUTHENTICATED) { - code = static_cast(from.code()); - } - *to = grpc::Status(code, from.message(), from.SerializeAsString()); - return grpc::Status::OK; -} - -} // namespace grpc diff --git a/test/cpp/util/BUILD b/test/cpp/util/BUILD index 6520a80e58b..9f927856248 100644 --- a/test/cpp/util/BUILD +++ b/test/cpp/util/BUILD @@ -290,6 +290,7 @@ grpc_cc_test( ], deps = [ "//:grpc++_error_details", + "//src/proto/grpc/status:status_proto", "//src/proto/grpc/testing:echo_messages_proto", "//test/core/util:grpc_test_util", ], From 0b1798412b2f817334b931fb8897a0bb1253208c Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 20 Jan 2021 16:33:27 +0100 Subject: [PATCH 12/21] Revert "Wrap strerror into a thread-safe implementation" --- BUILD | 2 - BUILD.gn | 2 - CMakeLists.txt | 1 - Makefile | 1 - build_autogenerated.yaml | 2 - config.m4 | 1 - config.w32 | 1 - gRPC-C++.podspec | 2 - gRPC-Core.podspec | 3 - grpc.gemspec | 2 - grpc.gyp | 1 - package.xml | 2 - src/core/lib/gpr/cpu_linux.cc | 8 +- src/core/lib/gpr/strerror.cc | 103 ------------------ src/core/lib/gpr/strerror.h | 35 ------ src/core/lib/gpr/tmpfile_posix.cc | 5 +- src/core/lib/gprpp/stat_posix.cc | 5 +- src/core/lib/gprpp/stat_windows.cc | 5 +- src/core/lib/iomgr/error.cc | 9 +- src/core/lib/iomgr/ev_epoll1_linux.cc | 7 +- src/core/lib/iomgr/internal_errqueue.cc | 3 +- .../lib/iomgr/socket_utils_common_posix.cc | 5 +- src/core/lib/iomgr/tcp_server_posix.cc | 10 +- src/core/lib/iomgr/udp_server.cc | 15 +-- src/core/lib/iomgr/wakeup_fd_pipe.cc | 4 +- src/python/grpcio/grpc_core_dependencies.py | 1 - test/core/iomgr/fd_posix_test.cc | 6 +- test/core/iomgr/tcp_server_posix_test.cc | 3 +- .../network_benchmarks/low_level_ping_pong.cc | 41 +++---- .../alts_concurrent_connectivity_test.cc | 4 +- test/core/util/subprocess_posix.cc | 6 +- tools/doxygen/Doxyfile.c++.internal | 2 - tools/doxygen/Doxyfile.core.internal | 2 - 33 files changed, 49 insertions(+), 250 deletions(-) delete mode 100644 src/core/lib/gpr/strerror.cc delete mode 100644 src/core/lib/gpr/strerror.h diff --git a/BUILD b/BUILD index 9702615098f..4836f557cd3 100644 --- a/BUILD +++ b/BUILD @@ -540,7 +540,6 @@ grpc_cc_library( "src/core/lib/gpr/log_posix.cc", "src/core/lib/gpr/log_windows.cc", "src/core/lib/gpr/murmur_hash.cc", - "src/core/lib/gpr/strerror.cc", "src/core/lib/gpr/string.cc", "src/core/lib/gpr/string_posix.cc", "src/core/lib/gpr/string_util_windows.cc", @@ -577,7 +576,6 @@ grpc_cc_library( "src/core/lib/gpr/env.h", "src/core/lib/gpr/murmur_hash.h", "src/core/lib/gpr/spinlock.h", - "src/core/lib/gpr/strerror.h", "src/core/lib/gpr/string.h", "src/core/lib/gpr/string_windows.h", "src/core/lib/gpr/time_precise.h", diff --git a/BUILD.gn b/BUILD.gn index 1eefe41a37a..472d2cac4c4 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -117,8 +117,6 @@ config("grpc_config") { "src/core/lib/gpr/murmur_hash.cc", "src/core/lib/gpr/murmur_hash.h", "src/core/lib/gpr/spinlock.h", - "src/core/lib/gpr/strerror.cc", - "src/core/lib/gpr/strerror.h", "src/core/lib/gpr/string.cc", "src/core/lib/gpr/string.h", "src/core/lib/gpr/string_posix.cc", diff --git a/CMakeLists.txt b/CMakeLists.txt index 64a4a9076e5..17a177d2369 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1307,7 +1307,6 @@ add_library(gpr src/core/lib/gpr/log_posix.cc src/core/lib/gpr/log_windows.cc src/core/lib/gpr/murmur_hash.cc - src/core/lib/gpr/strerror.cc src/core/lib/gpr/string.cc src/core/lib/gpr/string_posix.cc src/core/lib/gpr/string_util_windows.cc diff --git a/Makefile b/Makefile index 92b71ef0b0a..d895d2a6256 100644 --- a/Makefile +++ b/Makefile @@ -920,7 +920,6 @@ LIBGPR_SRC = \ src/core/lib/gpr/log_posix.cc \ src/core/lib/gpr/log_windows.cc \ src/core/lib/gpr/murmur_hash.cc \ - src/core/lib/gpr/strerror.cc \ src/core/lib/gpr/string.cc \ src/core/lib/gpr/string_posix.cc \ src/core/lib/gpr/string_util_windows.cc \ diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index 45dd397425d..184326d9cea 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -283,7 +283,6 @@ libs: - src/core/lib/gpr/env.h - src/core/lib/gpr/murmur_hash.h - src/core/lib/gpr/spinlock.h - - src/core/lib/gpr/strerror.h - src/core/lib/gpr/string.h - src/core/lib/gpr/string_windows.h - src/core/lib/gpr/time_precise.h @@ -326,7 +325,6 @@ libs: - src/core/lib/gpr/log_posix.cc - src/core/lib/gpr/log_windows.cc - src/core/lib/gpr/murmur_hash.cc - - src/core/lib/gpr/strerror.cc - src/core/lib/gpr/string.cc - src/core/lib/gpr/string_posix.cc - src/core/lib/gpr/string_util_windows.cc diff --git a/config.m4 b/config.m4 index 41af622e0ea..601d4dc929b 100644 --- a/config.m4 +++ b/config.m4 @@ -354,7 +354,6 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/gpr/log_posix.cc \ src/core/lib/gpr/log_windows.cc \ src/core/lib/gpr/murmur_hash.cc \ - src/core/lib/gpr/strerror.cc \ src/core/lib/gpr/string.cc \ src/core/lib/gpr/string_posix.cc \ src/core/lib/gpr/string_util_windows.cc \ diff --git a/config.w32 b/config.w32 index 20ea0fd10d1..0497b183453 100644 --- a/config.w32 +++ b/config.w32 @@ -321,7 +321,6 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\gpr\\log_posix.cc " + "src\\core\\lib\\gpr\\log_windows.cc " + "src\\core\\lib\\gpr\\murmur_hash.cc " + - "src\\core\\lib\\gpr\\strerror.cc " + "src\\core\\lib\\gpr\\string.cc " + "src\\core\\lib\\gpr\\string_posix.cc " + "src\\core\\lib\\gpr\\string_util_windows.cc " + diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 3b65e4d429b..00986eae727 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -486,7 +486,6 @@ Pod::Spec.new do |s| 'src/core/lib/gpr/env.h', 'src/core/lib/gpr/murmur_hash.h', 'src/core/lib/gpr/spinlock.h', - 'src/core/lib/gpr/strerror.h', 'src/core/lib/gpr/string.h', 'src/core/lib/gpr/string_windows.h', 'src/core/lib/gpr/time_precise.h', @@ -1105,7 +1104,6 @@ Pod::Spec.new do |s| 'src/core/lib/gpr/env.h', 'src/core/lib/gpr/murmur_hash.h', 'src/core/lib/gpr/spinlock.h', - 'src/core/lib/gpr/strerror.h', 'src/core/lib/gpr/string.h', 'src/core/lib/gpr/string_windows.h', 'src/core/lib/gpr/time_precise.h', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index d10a315a398..00736e45f0a 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -790,8 +790,6 @@ Pod::Spec.new do |s| 'src/core/lib/gpr/murmur_hash.cc', 'src/core/lib/gpr/murmur_hash.h', 'src/core/lib/gpr/spinlock.h', - 'src/core/lib/gpr/strerror.cc', - 'src/core/lib/gpr/strerror.h', 'src/core/lib/gpr/string.cc', 'src/core/lib/gpr/string.h', 'src/core/lib/gpr/string_posix.cc', @@ -1638,7 +1636,6 @@ Pod::Spec.new do |s| 'src/core/lib/gpr/env.h', 'src/core/lib/gpr/murmur_hash.h', 'src/core/lib/gpr/spinlock.h', - 'src/core/lib/gpr/strerror.h', 'src/core/lib/gpr/string.h', 'src/core/lib/gpr/string_windows.h', 'src/core/lib/gpr/time_precise.h', diff --git a/grpc.gemspec b/grpc.gemspec index 4db7ee3e805..1fe90b67e38 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -705,8 +705,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/gpr/murmur_hash.cc ) s.files += %w( src/core/lib/gpr/murmur_hash.h ) s.files += %w( src/core/lib/gpr/spinlock.h ) - s.files += %w( src/core/lib/gpr/strerror.cc ) - s.files += %w( src/core/lib/gpr/strerror.h ) s.files += %w( src/core/lib/gpr/string.cc ) s.files += %w( src/core/lib/gpr/string.h ) s.files += %w( src/core/lib/gpr/string_posix.cc ) diff --git a/grpc.gyp b/grpc.gyp index d8a2616c233..23e251b4efb 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -404,7 +404,6 @@ 'src/core/lib/gpr/log_posix.cc', 'src/core/lib/gpr/log_windows.cc', 'src/core/lib/gpr/murmur_hash.cc', - 'src/core/lib/gpr/strerror.cc', 'src/core/lib/gpr/string.cc', 'src/core/lib/gpr/string_posix.cc', 'src/core/lib/gpr/string_util_windows.cc', diff --git a/package.xml b/package.xml index e7ec113e033..0dda7e37f4b 100644 --- a/package.xml +++ b/package.xml @@ -685,8 +685,6 @@ - - diff --git a/src/core/lib/gpr/cpu_linux.cc b/src/core/lib/gpr/cpu_linux.cc index 34656c438ae..2e16e3d992e 100644 --- a/src/core/lib/gpr/cpu_linux.cc +++ b/src/core/lib/gpr/cpu_linux.cc @@ -33,15 +33,12 @@ #include #include -#include "src/core/lib/gpr/strerror.h" - static int ncpus = 0; static void init_num_cpus() { #ifndef GPR_MUSL_LIBC_COMPAT if (sched_getcpu() < 0) { - gpr_log(GPR_ERROR, "Error determining current CPU: %s\n", - grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "Error determining current CPU: %s\n", strerror(errno)); ncpus = 1; return; } @@ -71,8 +68,7 @@ unsigned gpr_cpu_current_cpu(void) { } int cpu = sched_getcpu(); if (cpu < 0) { - gpr_log(GPR_ERROR, "Error determining current CPU: %s\n", - grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "Error determining current CPU: %s\n", strerror(errno)); return 0; } if (static_cast(cpu) >= gpr_cpu_num_cores()) { diff --git a/src/core/lib/gpr/strerror.cc b/src/core/lib/gpr/strerror.cc deleted file mode 100644 index 0cc8cd02342..00000000000 --- a/src/core/lib/gpr/strerror.cc +++ /dev/null @@ -1,103 +0,0 @@ -/* - * - * 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. - * - */ - -#include - -#include "src/core/lib/gpr/strerror.h" - -#include -#include -#include -#include -#include -#include -#include - -// The implementation below is mostly copied from abseil because it is internal -// there. -namespace grpc_core { -namespace { - -// `ErrnoSaver` captures the value of `errno` upon construction and restores it -// upon deletion. It is used in low-level code and must be super fast. Do not -// add instrumentation, even in debug modes. -class ErrnoSaver { - public: - ErrnoSaver() : saved_errno_(errno) {} - ~ErrnoSaver() { errno = saved_errno_; } - int operator()() const { return saved_errno_; } - - private: - const int saved_errno_; -}; - -const char* StrErrorAdaptor(int errnum, char* buf, size_t buflen) { -#if defined(GPR_WINDOWS) - int rc = strerror_s(buf, buflen, errnum); - buf[buflen - 1] = '\0'; // guarantee NUL termination - if (rc == 0 && strncmp(buf, "Unknown error", buflen) == 0) *buf = '\0'; - return buf; -#else - // The type of `ret` is platform-specific; both of these branches must compile - // either way but only one will execute on any given platform: - auto ret = strerror_r(errnum, buf, buflen); - if (std::is_same::value) { - // XSI `strerror_r`; `ret` is `int`: - if (ret) *buf = '\0'; - return buf; - } else { - // GNU `strerror_r`; `ret` is `char *`: - return reinterpret_cast(ret); - } -#endif -} - -std::string StrErrorInternal(int errnum) { - char buf[100]; - const char* str = StrErrorAdaptor(errnum, buf, sizeof buf); - if (*str == '\0') { - snprintf(buf, sizeof buf, "Unknown error %d", errnum); - str = buf; - } - return str; -} - -// kSysNerr is the number of errors from a recent glibc. `StrError()` falls back -// to `StrErrorAdaptor()` if the value is larger than this. -constexpr int kSysNerr = 135; - -std::array* NewStrErrorTable() { - auto* table = new std::array; - for (int i = 0; i < static_cast(table->size()); ++i) { - (*table)[i] = StrErrorInternal(i); - } - return table; -} - -} // namespace - -std::string StrError(int errnum) { - ErrnoSaver errno_saver; - static const auto* table = NewStrErrorTable(); - if (errnum >= 0 && errnum < static_cast(table->size())) { - return (*table)[errnum]; - } - return StrErrorInternal(errnum); -} - -} // namespace grpc_core diff --git a/src/core/lib/gpr/strerror.h b/src/core/lib/gpr/strerror.h deleted file mode 100644 index f1e85129599..00000000000 --- a/src/core/lib/gpr/strerror.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * 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. - * - */ - -#ifndef GRPC_CORE_LIB_GPR_STRERROR_H -#define GRPC_CORE_LIB_GPR_STRERROR_H - -#include - -#include - -namespace grpc_core { - -// `strerror` is not thread-safe. This wrapper is a portable thread-safe -// implementation. It does not modify `errno`. -// The implementation is copied from abseil's internal. -std::string StrError(int errnum); - -} // namespace grpc_core - -#endif /* GRPC_CORE_LIB_GPR_STRERROR_H */ diff --git a/src/core/lib/gpr/tmpfile_posix.cc b/src/core/lib/gpr/tmpfile_posix.cc index b4b7f214de6..ffdad335d67 100644 --- a/src/core/lib/gpr/tmpfile_posix.cc +++ b/src/core/lib/gpr/tmpfile_posix.cc @@ -31,7 +31,6 @@ #include #include -#include "src/core/lib/gpr/strerror.h" #include "src/core/lib/gpr/string.h" FILE* gpr_tmpfile(const char* prefix, char** tmp_filename) { @@ -47,13 +46,13 @@ FILE* gpr_tmpfile(const char* prefix, char** tmp_filename) { fd = mkstemp(filename_template); if (fd == -1) { gpr_log(GPR_ERROR, "mkstemp failed for filename_template %s with error %s.", - filename_template, grpc_core::StrError(errno).c_str()); + filename_template, strerror(errno)); goto end; } result = fdopen(fd, "w+"); if (result == nullptr) { gpr_log(GPR_ERROR, "Could not open file %s from fd %d (error = %s).", - filename_template, fd, grpc_core::StrError(errno).c_str()); + filename_template, fd, strerror(errno)); unlink(filename_template); close(fd); goto end; diff --git a/src/core/lib/gprpp/stat_posix.cc b/src/core/lib/gprpp/stat_posix.cc index a77faeae875..888361bf2aa 100644 --- a/src/core/lib/gprpp/stat_posix.cc +++ b/src/core/lib/gprpp/stat_posix.cc @@ -25,7 +25,6 @@ #include -#include "src/core/lib/gpr/strerror.h" #include "src/core/lib/gprpp/stat.h" namespace grpc_core { @@ -35,9 +34,9 @@ absl::Status GetFileModificationTime(const char* filename, time_t* timestamp) { GPR_ASSERT(timestamp != nullptr); struct stat buf; if (stat(filename, &buf) != 0) { - std::string error_msg = StrError(errno); + const char* error_msg = strerror(errno); gpr_log(GPR_ERROR, "stat failed for filename %s with error %s.", filename, - error_msg.c_str()); + error_msg); return absl::Status(absl::StatusCode::kInternal, error_msg); } // Last file/directory modification time. diff --git a/src/core/lib/gprpp/stat_windows.cc b/src/core/lib/gprpp/stat_windows.cc index 6e2ea434872..f1435e03305 100644 --- a/src/core/lib/gprpp/stat_windows.cc +++ b/src/core/lib/gprpp/stat_windows.cc @@ -24,7 +24,6 @@ #include -#include "src/core/lib/gpr/strerror.h" #include "src/core/lib/gprpp/stat.h" namespace grpc_core { @@ -34,9 +33,9 @@ absl::Status GetFileModificationTime(const char* filename, time_t* timestamp) { GPR_ASSERT(timestamp != nullptr); struct _stat buf; if (_stat(filename, &buf) != 0) { - std::string error_msg = StrError(errno); + const char* error_msg = strerror(errno); gpr_log(GPR_ERROR, "_stat failed for filename %s with error %s.", filename, - error_msg.c_str()); + error_msg); return absl::Status(absl::StatusCode::kInternal, error_msg); } // Last file/directory modification time. diff --git a/src/core/lib/iomgr/error.cc b/src/core/lib/iomgr/error.cc index 38115fe475a..091014593ee 100644 --- a/src/core/lib/iomgr/error.cc +++ b/src/core/lib/iomgr/error.cc @@ -32,7 +32,6 @@ #endif #include "src/core/lib/debug/trace.h" -#include "src/core/lib/gpr/strerror.h" #include "src/core/lib/gpr/useful.h" #include "src/core/lib/iomgr/error_internal.h" #include "src/core/lib/profiling/timers.h" @@ -778,15 +777,15 @@ const char* grpc_error_string(grpc_error* err) { grpc_error* grpc_os_error(const char* file, int line, int err, const char* call_name) { - std::string err_string = grpc_core::StrError(err); return grpc_error_set_str( grpc_error_set_str( grpc_error_set_int( grpc_error_create(file, line, - grpc_slice_from_cpp_string(err_string), nullptr, - 0), + grpc_slice_from_static_string(strerror(err)), + nullptr, 0), GRPC_ERROR_INT_ERRNO, err), - GRPC_ERROR_STR_OS_ERROR, grpc_slice_from_cpp_string(err_string)), + GRPC_ERROR_STR_OS_ERROR, + grpc_slice_from_static_string(strerror(err))), GRPC_ERROR_STR_SYSCALL, grpc_slice_from_copied_string(call_name)); } diff --git a/src/core/lib/iomgr/ev_epoll1_linux.cc b/src/core/lib/iomgr/ev_epoll1_linux.cc index c59bf9e6bb4..8a1013da21f 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.cc +++ b/src/core/lib/iomgr/ev_epoll1_linux.cc @@ -49,7 +49,6 @@ #include #include "src/core/lib/debug/stats.h" -#include "src/core/lib/gpr/strerror.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/tls.h" #include "src/core/lib/gpr/useful.h" @@ -372,8 +371,7 @@ static grpc_fd* fd_create(int fd, const char* name, bool track_err) { ev.data.ptr = reinterpret_cast(reinterpret_cast(new_fd) | (track_err ? 1 : 0)); if (epoll_ctl(g_epoll_set.epfd, EPOLL_CTL_ADD, fd, &ev) != 0) { - gpr_log(GPR_ERROR, "epoll_ctl failed: %s", - grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "epoll_ctl failed: %s", strerror(errno)); } return new_fd; @@ -394,8 +392,7 @@ static void fd_shutdown_internal(grpc_fd* fd, grpc_error* why, epoll_event dummy_event; if (epoll_ctl(g_epoll_set.epfd, EPOLL_CTL_DEL, fd->fd, &dummy_event) != 0) { - gpr_log(GPR_ERROR, "epoll_ctl failed: %s", - grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "epoll_ctl failed: %s", strerror(errno)); } } fd->write_closure->SetShutdown(GRPC_ERROR_REF(why)); diff --git a/src/core/lib/iomgr/internal_errqueue.cc b/src/core/lib/iomgr/internal_errqueue.cc index bd5b97b35a6..b68c66b7575 100644 --- a/src/core/lib/iomgr/internal_errqueue.cc +++ b/src/core/lib/iomgr/internal_errqueue.cc @@ -21,7 +21,6 @@ #include "src/core/lib/iomgr/port.h" #include -#include "src/core/lib/gpr/strerror.h" #include "src/core/lib/iomgr/internal_errqueue.h" #ifdef GRPC_POSIX_SOCKET_TCP @@ -42,7 +41,7 @@ void grpc_errqueue_init() { #ifdef GRPC_LINUX_ERRQUEUE struct utsname buffer; if (uname(&buffer) != 0) { - gpr_log(GPR_ERROR, "uname: %s", StrError(errno).c_str()); + gpr_log(GPR_ERROR, "uname: %s", strerror(errno)); return; } char* release = buffer.release; diff --git a/src/core/lib/iomgr/socket_utils_common_posix.cc b/src/core/lib/iomgr/socket_utils_common_posix.cc index 0b94d8a3d4b..fa7f893f72c 100644 --- a/src/core/lib/iomgr/socket_utils_common_posix.cc +++ b/src/core/lib/iomgr/socket_utils_common_posix.cc @@ -48,7 +48,6 @@ #include #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/gpr/strerror.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/iomgr/sockaddr_utils.h" @@ -364,12 +363,12 @@ grpc_error* grpc_set_socket_tcp_user_timeout( if (0 != setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT, &timeout, sizeof(timeout))) { gpr_log(GPR_ERROR, "setsockopt(TCP_USER_TIMEOUT) %s", - grpc_core::StrError(errno).c_str()); + strerror(errno)); return GRPC_ERROR_NONE; } if (0 != getsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT, &newval, &len)) { gpr_log(GPR_ERROR, "getsockopt(TCP_USER_TIMEOUT) %s", - grpc_core::StrError(errno).c_str()); + strerror(errno)); return GRPC_ERROR_NONE; } if (newval != timeout) { diff --git a/src/core/lib/iomgr/tcp_server_posix.cc b/src/core/lib/iomgr/tcp_server_posix.cc index d47bd359b69..d6e13e81d15 100644 --- a/src/core/lib/iomgr/tcp_server_posix.cc +++ b/src/core/lib/iomgr/tcp_server_posix.cc @@ -48,7 +48,6 @@ #include #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/gpr/strerror.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/iomgr/exec_ctx.h" @@ -214,8 +213,7 @@ static void on_read(void* arg, grpc_error* err) { default: gpr_mu_lock(&sp->server->mu); if (!sp->server->shutdown_listeners) { - gpr_log(GPR_ERROR, "Failed accept4: %s", - grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "Failed accept4: %s", strerror(errno)); } else { /* if we have shutdown listeners, accept4 could fail, and we needn't notify users */ @@ -232,8 +230,7 @@ static void on_read(void* arg, grpc_error* err) { addr.len = static_cast(sizeof(struct sockaddr_storage)); if (getsockname(fd, reinterpret_cast(addr.addr), &(addr.len)) < 0) { - gpr_log(GPR_ERROR, "Failed getsockname: %s", - grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "Failed getsockname: %s", strerror(errno)); close(fd); goto error; } @@ -583,8 +580,7 @@ class ExternalConnectionHandler : public grpc_core::TcpServerFdHandler { if (getpeername(fd, reinterpret_cast(addr.addr), &(addr.len)) < 0) { - gpr_log(GPR_ERROR, "Failed getpeername: %s", - grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "Failed getpeername: %s", strerror(errno)); close(fd); return; } diff --git a/src/core/lib/iomgr/udp_server.cc b/src/core/lib/iomgr/udp_server.cc index d318fb2a129..c2eacc5053d 100644 --- a/src/core/lib/iomgr/udp_server.cc +++ b/src/core/lib/iomgr/udp_server.cc @@ -57,7 +57,6 @@ #include #include #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/gpr/strerror.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/iomgr/error.h" @@ -368,13 +367,11 @@ static int prepare_socket(grpc_socket_factory* socket_factory, int fd, } if (grpc_set_socket_nonblocking(fd, 1) != GRPC_ERROR_NONE) { - gpr_log(GPR_ERROR, "Unable to set nonblocking %d: %s", fd, - grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "Unable to set nonblocking %d: %s", fd, strerror(errno)); goto error; } if (grpc_set_socket_cloexec(fd, 1) != GRPC_ERROR_NONE) { - gpr_log(GPR_ERROR, "Unable to set cloexec %d: %s", fd, - grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "Unable to set cloexec %d: %s", fd, strerror(errno)); goto error; } @@ -416,8 +413,7 @@ static int prepare_socket(grpc_socket_factory* socket_factory, int fd, if (bind_socket(socket_factory, fd, addr) < 0) { std::string addr_str = grpc_sockaddr_to_string(addr, false); - gpr_log(GPR_ERROR, "bind addr=%s: %s", addr_str.c_str(), - grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "bind addr=%s: %s", addr_str.c_str(), strerror(errno)); goto error; } @@ -426,7 +422,7 @@ static int prepare_socket(grpc_socket_factory* socket_factory, int fd, if (getsockname(fd, reinterpret_cast(sockname_temp.addr), &sockname_temp.len) < 0) { gpr_log(GPR_ERROR, "Unable to get the address socket %d is bound to: %s", - fd, grpc_core::StrError(errno).c_str()); + fd, strerror(errno)); goto error; } @@ -674,8 +670,7 @@ int grpc_udp_server_add_port(grpc_udp_server* s, grpc_resolved_address* addr, GRPC_ERROR_UNREF(grpc_create_dualstack_socket_using_factory( s->socket_factory, addr, SOCK_DGRAM, IPPROTO_UDP, &dsmode, &fd)); if (fd < 0) { - gpr_log(GPR_ERROR, "Unable to create socket: %s", - grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "Unable to create socket: %s", strerror(errno)); } if (dsmode == GRPC_DSMODE_IPV4 && grpc_sockaddr_is_v4mapped(addr, &addr4_copy)) { diff --git a/src/core/lib/iomgr/wakeup_fd_pipe.cc b/src/core/lib/iomgr/wakeup_fd_pipe.cc index 475e6eba1f1..797cd44cd1a 100644 --- a/src/core/lib/iomgr/wakeup_fd_pipe.cc +++ b/src/core/lib/iomgr/wakeup_fd_pipe.cc @@ -31,15 +31,13 @@ #include -#include "src/core/lib/gpr/strerror.h" #include "src/core/lib/iomgr/socket_utils_posix.h" static grpc_error* pipe_init(grpc_wakeup_fd* fd_info) { int pipefd[2]; int r = pipe(pipefd); if (0 != r) { - gpr_log(GPR_ERROR, "pipe creation failed (%d): %s", errno, - grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "pipe creation failed (%d): %s", errno, strerror(errno)); return GRPC_OS_ERROR(errno, "pipe"); } grpc_error* err; diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 3baf7dd56ca..008482e043b 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -330,7 +330,6 @@ CORE_SOURCE_FILES = [ 'src/core/lib/gpr/log_posix.cc', 'src/core/lib/gpr/log_windows.cc', 'src/core/lib/gpr/murmur_hash.cc', - 'src/core/lib/gpr/strerror.cc', 'src/core/lib/gpr/string.cc', 'src/core/lib/gpr/string_posix.cc', 'src/core/lib/gpr/string_util_windows.cc', diff --git a/test/core/iomgr/fd_posix_test.cc b/test/core/iomgr/fd_posix_test.cc index f9841c14ce6..e0b29abb454 100644 --- a/test/core/iomgr/fd_posix_test.cc +++ b/test/core/iomgr/fd_posix_test.cc @@ -41,7 +41,6 @@ #include #include -#include "src/core/lib/gpr/strerror.h" #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/iomgr/socket_utils_posix.h" @@ -161,8 +160,7 @@ static void session_read_cb(void* arg, /*session */ before notify_on_read is called. */ grpc_fd_notify_on_read(se->em_fd, &se->session_read_closure); } else { - gpr_log(GPR_ERROR, "Unhandled read error %s", - grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "Unhandled read error %s", strerror(errno)); abort(); } } @@ -328,7 +326,7 @@ static void client_session_write(void* arg, /*client */ } gpr_mu_unlock(g_mu); } else { - gpr_log(GPR_ERROR, "unknown errno %s", grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "unknown errno %s", strerror(errno)); abort(); } } diff --git a/test/core/iomgr/tcp_server_posix_test.cc b/test/core/iomgr/tcp_server_posix_test.cc index 7d570d03461..1441c0d54e5 100644 --- a/test/core/iomgr/tcp_server_posix_test.cc +++ b/test/core/iomgr/tcp_server_posix_test.cc @@ -40,7 +40,6 @@ #include #include -#include "src/core/lib/gpr/strerror.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/iomgr/resolve_address.h" @@ -458,7 +457,7 @@ int main(int argc, char** argv) { test_no_op_with_port_and_start(); if (getifaddrs(&ifa) != 0 || ifa == nullptr) { - gpr_log(GPR_ERROR, "getifaddrs: %s", grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "getifaddrs: %s", strerror(errno)); return EXIT_FAILURE; } dst_addrs->naddrs = 0; diff --git a/test/core/network_benchmarks/low_level_ping_pong.cc b/test/core/network_benchmarks/low_level_ping_pong.cc index 0e0155543bb..a983b1876d6 100644 --- a/test/core/network_benchmarks/low_level_ping_pong.cc +++ b/test/core/network_benchmarks/low_level_ping_pong.cc @@ -38,7 +38,6 @@ #include #include -#include "src/core/lib/gpr/strerror.h" #include "src/core/lib/gpr/useful.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/error.h" @@ -81,8 +80,7 @@ static int read_bytes(int fd, char* buf, size_t read_size, int spin) { if (errno == EAGAIN && spin == 1) { continue; } - gpr_log(GPR_ERROR, "Read failed: %s", - grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "Read failed: %s", strerror(errno)); return -1; } } else { @@ -115,8 +113,7 @@ static int poll_read_bytes(int fd, char* buf, size_t read_size, int spin) { if (errno == EINTR) { continue; } else { - gpr_log(GPR_ERROR, "Poll failed: %s", - grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "Poll failed: %s", strerror(errno)); return -1; } } @@ -127,7 +124,7 @@ static int poll_read_bytes(int fd, char* buf, size_t read_size, int spin) { err2 = read(fd, buf + bytes_read, read_size - bytes_read); } while (err2 < 0 && errno == EINTR); if (err2 < 0 && errno != EAGAIN) { - gpr_log(GPR_ERROR, "Read failed: %s", grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "Read failed: %s", strerror(errno)); return -1; } bytes_read += static_cast(err2); @@ -156,8 +153,7 @@ static int epoll_read_bytes(struct thread_args* args, char* buf, int spin) { err = epoll_wait(args->epoll_fd, &ev, 1, spin ? 0 : -1); if (err < 0) { if (errno == EINTR) continue; - gpr_log(GPR_ERROR, "epoll_wait failed: %s", - grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "epoll_wait failed: %s", strerror(errno)); return -1; } if (err == 0 && spin) continue; @@ -203,8 +199,7 @@ static int blocking_write_bytes(struct thread_args* args, char* buf) { if (errno == EINTR) { continue; } else { - gpr_log(GPR_ERROR, "Read failed: %s", - grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "Read failed: %s", strerror(errno)); return -1; } } else { @@ -242,7 +237,7 @@ static int epoll_setup(thread_args* args) { set_socket_nonblocking(args); epoll_fd = epoll_create(1); if (epoll_fd < 0) { - gpr_log(GPR_ERROR, "epoll_create: %s", grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "epoll_create: %s", strerror(errno)); return -1; } @@ -251,7 +246,7 @@ static int epoll_setup(thread_args* args) { ev.events = EPOLLIN | EPOLLET; ev.data.fd = args->fds.read_fd; if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, args->fds.read_fd, &ev) < 0) { - gpr_log(GPR_ERROR, "epoll_ctl: %s", grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "epoll_ctl: %s", strerror(errno)); } return 0; } @@ -335,8 +330,7 @@ error: static int create_listening_socket(struct sockaddr* port, socklen_t len) { int fd = socket(port->sa_family, SOCK_STREAM, 0); if (fd < 0) { - gpr_log(GPR_ERROR, "Unable to create socket: %s", - grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "Unable to create socket: %s", strerror(errno)); goto error; } @@ -354,17 +348,17 @@ static int create_listening_socket(struct sockaddr* port, socklen_t len) { } if (bind(fd, port, len) < 0) { - gpr_log(GPR_ERROR, "bind: %s", grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "bind: %s", strerror(errno)); goto error; } if (listen(fd, 1) < 0) { - gpr_log(GPR_ERROR, "listen: %s", grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "listen: %s", strerror(errno)); goto error; } if (getsockname(fd, port, &len) < 0) { - gpr_log(GPR_ERROR, "getsockname: %s", grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "getsockname: %s", strerror(errno)); goto error; } @@ -381,8 +375,7 @@ static int connect_client(struct sockaddr* addr, socklen_t len) { int fd = socket(addr->sa_family, SOCK_STREAM, 0); int err; if (fd < 0) { - gpr_log(GPR_ERROR, "Unable to create socket: %s", - grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "Unable to create socket: %s", strerror(errno)); goto error; } @@ -400,7 +393,7 @@ static int connect_client(struct sockaddr* addr, socklen_t len) { } while (err < 0 && errno == EINTR); if (err < 0) { - gpr_log(GPR_ERROR, "connect error: %s", grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "connect error: %s", strerror(errno)); goto error; } return fd; @@ -415,7 +408,7 @@ error: static int accept_server(int listen_fd) { int fd = accept(listen_fd, nullptr, nullptr); if (fd < 0) { - gpr_log(GPR_ERROR, "Accept failed: %s", grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "Accept failed: %s", strerror(errno)); return -1; } return fd; @@ -474,7 +467,7 @@ error: static int create_sockets_socketpair(fd_pair* client_fds, fd_pair* server_fds) { int fds[2]; if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) { - gpr_log(GPR_ERROR, "socketpair: %s", grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "socketpair: %s", strerror(errno)); return -1; } @@ -489,12 +482,12 @@ static int create_sockets_pipe(fd_pair* client_fds, fd_pair* server_fds) { int cfds[2]; int sfds[2]; if (pipe(cfds) < 0) { - gpr_log(GPR_ERROR, "pipe: %s", grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "pipe: %s", strerror(errno)); return -1; } if (pipe(sfds) < 0) { - gpr_log(GPR_ERROR, "pipe: %s", grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "pipe: %s", strerror(errno)); return -1; } diff --git a/test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc b/test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc index 2477105c817..bc2eca1a61b 100644 --- a/test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc +++ b/test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc @@ -45,7 +45,6 @@ #include #include -#include "src/core/lib/gpr/strerror.h" #include "src/core/lib/gpr/useful.h" #include "src/core/lib/gprpp/host_port.h" #include "src/core/lib/gprpp/thd.h" @@ -460,8 +459,7 @@ class FakeTcpServer { gpr_log(GPR_ERROR, "Fake TCP server encountered unexpected error:%d |%s| " "sending %d bytes on fd:%d", - errno, grpc_core::StrError(errno).c_str(), bytes_to_send, - fd_); + errno, strerror(errno), bytes_to_send, fd_); GPR_ASSERT(0); } else if (bytes_sent > 0) { total_bytes_sent_ += bytes_sent; diff --git a/test/core/util/subprocess_posix.cc b/test/core/util/subprocess_posix.cc index a6b2c29823a..ab288d777fc 100644 --- a/test/core/util/subprocess_posix.cc +++ b/test/core/util/subprocess_posix.cc @@ -34,7 +34,6 @@ #include #include -#include "src/core/lib/gpr/strerror.h" #include "test/core/util/subprocess.h" struct gpr_subprocess { @@ -59,8 +58,7 @@ gpr_subprocess* gpr_subprocess_create(int argc, const char** argv) { exec_args[argc] = nullptr; execv(exec_args[0], exec_args); /* if we reach here, an error has occurred */ - gpr_log(GPR_ERROR, "execv '%s' failed: %s", exec_args[0], - grpc_core::StrError(errno).c_str()); + gpr_log(GPR_ERROR, "execv '%s' failed: %s", exec_args[0], strerror(errno)); _exit(1); return nullptr; } else { @@ -86,7 +84,7 @@ retry: goto retry; } gpr_log(GPR_ERROR, "waitpid failed for pid %d: %s", p->pid, - grpc_core::StrError(errno).c_str()); + strerror(errno)); return -1; } p->joined = true; diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 575aedde096..8f5132b30ce 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1636,8 +1636,6 @@ src/core/lib/gpr/log_windows.cc \ src/core/lib/gpr/murmur_hash.cc \ src/core/lib/gpr/murmur_hash.h \ src/core/lib/gpr/spinlock.h \ -src/core/lib/gpr/strerror.cc \ -src/core/lib/gpr/strerror.h \ src/core/lib/gpr/string.cc \ src/core/lib/gpr/string.h \ src/core/lib/gpr/string_posix.cc \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 891a3c12d84..c6b920dfc3c 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1475,8 +1475,6 @@ src/core/lib/gpr/log_windows.cc \ src/core/lib/gpr/murmur_hash.cc \ src/core/lib/gpr/murmur_hash.h \ src/core/lib/gpr/spinlock.h \ -src/core/lib/gpr/strerror.cc \ -src/core/lib/gpr/strerror.h \ src/core/lib/gpr/string.cc \ src/core/lib/gpr/string.h \ src/core/lib/gpr/string_posix.cc \ From 4ce755c86e737202ad1ceff564fae7cc561c0237 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 19 Jan 2021 15:45:20 -0800 Subject: [PATCH 13/21] Made update_mirror.sh skip the existing files --- bazel/update_mirror.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/bazel/update_mirror.sh b/bazel/update_mirror.sh index 4b754cf3a54..274fe51616e 100755 --- a/bazel/update_mirror.sh +++ b/bazel/update_mirror.sh @@ -34,13 +34,18 @@ trap cleanup EXIT function upload { local file="$1" - echo "Downloading https://${file}" - curl -L --fail --output "${tmpdir}/archive" "https://${file}" + if gsutil stat "gs://grpc-bazel-mirror/${file}" > /dev/null + then + echo "Skipping ${file}" + else + echo "Downloading https://${file}" + curl -L --fail --output "${tmpdir}/archive" "https://${file}" - echo "Uploading https://${file} to https://storage.googleapis.com/grpc-bazel-mirror/${file}" - gsutil cp -n "${tmpdir}/archive" "gs://grpc-bazel-mirror/${file}" # "-n" will skip existing files + echo "Uploading https://${file} to https://storage.googleapis.com/grpc-bazel-mirror/${file}" + gsutil cp "${tmpdir}/archive" "gs://grpc-bazel-mirror/${file}" - rm -rf "${tmpdir}/archive" + rm -rf "${tmpdir}/archive" + fi } # How to check that all mirror URLs work: From 06ee6fea7adcdefc352481147b30734563edd2a0 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Wed, 20 Jan 2021 10:21:13 -0800 Subject: [PATCH 14/21] Update by review --- third_party/ABSEIL_MANUAL.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/third_party/ABSEIL_MANUAL.md b/third_party/ABSEIL_MANUAL.md index 71e941dd248..1e510e9073c 100644 --- a/third_party/ABSEIL_MANUAL.md +++ b/third_party/ABSEIL_MANUAL.md @@ -5,17 +5,19 @@ supposed to explain general usage of Abseil. ## The version of Abseil -gRPC is inteded to use the LTS versions of Abseil only because it simplfies +gRPC intends to use the LTS versions of Abseil only because it simplifies dependency management. Abseil is being distributed via package distribution systems such as vcpkg and cocoapods. If gRPC depends on the certain version -that aren't registered, gRPC in that system wouldn't build or work. +that aren't registered, gRPC in that system cannot get the right version of +Abseil when being built, resulting in a build failure. Therefore, gRPC will use the LTS version only, preferably the latest one. ## Libraries that are not ready to use Most of Abseil libraries are okay to use but there are some exceptions because they're not going well yet on some of our test machinaries or -platforms it supports. Following is targets that are NOT ready to use. +platforms it supports. The following is a list of targets that are NOT +ready to use. - `absl/synchronization:*`: This will be ready from the LTS version in 2021. - `absl/random`: [WIP](https://github.com/grpc/grpc/pull/23346). From 0db0ab052da508cb075e5d14f0e0c0b4193aa875 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 19 Jan 2021 18:14:43 -0800 Subject: [PATCH 15/21] Update by review --- .../client_channel/lb_policy/grpclb/grpclb.cc | 8 +++----- .../lb_policy/grpclb/grpclb_channel.cc | 3 +-- .../lb_policy/grpclb/grpclb_channel.h | 3 +-- .../lb_policy/grpclb/grpclb_channel_secure.cc | 3 +-- .../ext/transport/chttp2/server/chttp2_server.cc | 2 +- .../chttp2/server/insecure/server_chttp2.cc | 2 +- src/core/ext/xds/xds_api.cc | 4 ++-- .../security/credentials/fake/fake_credentials.cc | 2 +- src/core/lib/surface/server.cc | 4 ++-- src/cpp/ext/filters/census/context.cc | 6 ++---- src/cpp/ext/filters/census/context.h | 5 ++--- src/cpp/ext/filters/census/server_filter.cc | 13 +------------ test/cpp/end2end/xds_end2end_test.cc | 10 +++------- 13 files changed, 21 insertions(+), 44 deletions(-) diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc index 6a46a0bbc30..3b6e59b5f5a 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc @@ -1259,12 +1259,10 @@ ServerAddressList ExtractBalancerAddresses(const grpc_channel_args& args) { * stream for the reception of load balancing updates. * * Inputs: - * - \a addresses: corresponding to the balancers. * - \a response_generator: in order to propagate updates from the resolver * above the grpclb policy. * - \a args: other args inherited from the grpclb policy. */ grpc_channel_args* BuildBalancerChannelArgs( - const ServerAddressList& addresses, FakeResolverResponseGenerator* response_generator, const grpc_channel_args* args) { // Channel args to remove. @@ -1313,7 +1311,7 @@ grpc_channel_args* BuildBalancerChannelArgs( args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove), args_to_add.data(), args_to_add.size()); // Make any necessary modifications for security. - return ModifyGrpclbBalancerChannelArgs(addresses, new_args); + return ModifyGrpclbBalancerChannelArgs(new_args); } // @@ -1464,8 +1462,8 @@ void GrpcLb::ProcessAddressesAndChannelArgsLocked( &args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove), &new_arg, 1); // Construct args for balancer channel. ServerAddressList balancer_addresses = ExtractBalancerAddresses(args); - grpc_channel_args* lb_channel_args = BuildBalancerChannelArgs( - balancer_addresses, response_generator_.get(), &args); + grpc_channel_args* lb_channel_args = + BuildBalancerChannelArgs(response_generator_.get(), &args); // Create balancer channel if needed. if (lb_channel_ == nullptr) { std::string uri_str = absl::StrCat("fake:///", server_name_); diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc index f8197a89bfb..07c5fd6fe9e 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc @@ -24,8 +24,7 @@ namespace grpc_core { -grpc_channel_args* ModifyGrpclbBalancerChannelArgs( - const ServerAddressList& /*addresses*/, grpc_channel_args* args) { +grpc_channel_args* ModifyGrpclbBalancerChannelArgs(grpc_channel_args* args) { return args; } diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h index 1458233022f..8ea48852855 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h @@ -33,8 +33,7 @@ namespace grpc_core { /// Takes ownership of \a args. /// /// Caller takes ownership of the returned args. -grpc_channel_args* ModifyGrpclbBalancerChannelArgs( - const ServerAddressList& addresses, grpc_channel_args* args); +grpc_channel_args* ModifyGrpclbBalancerChannelArgs(grpc_channel_args* args); grpc_channel* CreateGrpclbBalancerChannel(const char* target_uri, const grpc_channel_args& args); diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc index 70e6dec18cf..d2a10296f5f 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc @@ -39,8 +39,7 @@ namespace grpc_core { -grpc_channel_args* ModifyGrpclbBalancerChannelArgs( - const ServerAddressList& /*addresses*/, grpc_channel_args* args) { +grpc_channel_args* ModifyGrpclbBalancerChannelArgs(grpc_channel_args* args) { absl::InlinedVector args_to_remove; absl::InlinedVector args_to_add; // Substitute the channel credentials with a version without call diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.cc b/src/core/ext/transport/chttp2/server/chttp2_server.cc index 8b114603e82..e930407f3f1 100644 --- a/src/core/ext/transport/chttp2/server/chttp2_server.cc +++ b/src/core/ext/transport/chttp2/server/chttp2_server.cc @@ -93,7 +93,7 @@ class Chttp2ServerListener : public Server::ListenerInterface { explicit ConfigFetcherWatcher(Chttp2ServerListener* listener) : listener_(listener) {} - void UpdateConfig(grpc_channel_args* /*args*/) override { + void UpdateConfig(grpc_channel_args* args) override { { MutexLock lock(&listener_->mu_); grpc_channel_args_destroy(listener_->args_); diff --git a/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc b/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc index 4980b4eaeb7..3a3d6f371e5 100644 --- a/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc @@ -30,7 +30,7 @@ namespace { grpc_channel_args* ModifyArgsForConnection(grpc_channel_args* args, - grpc_error** error) { + grpc_error** /*error*/) { return args; } diff --git a/src/core/ext/xds/xds_api.cc b/src/core/ext/xds/xds_api.cc index 5420d947b3a..816b34e96e3 100644 --- a/src/core/ext/xds/xds_api.cc +++ b/src/core/ext/xds/xds_api.cc @@ -1389,8 +1389,8 @@ grpc_error* LdsResponseParseClient( grpc_error* LdsResponseParseServer( upb_arena* arena, const envoy_config_listener_v3_Listener* listener, - const std::string& listener_name, - const envoy_config_core_v3_Address* address, + const std::string& /*listener_name*/, + const envoy_config_core_v3_Address* /*address*/, XdsApi::LdsUpdate* lds_update) { lds_update->type = XdsApi::LdsUpdate::ListenerType::kTcpListener; // TODO(yashykt): Support filter chain match. diff --git a/src/core/lib/security/credentials/fake/fake_credentials.cc b/src/core/lib/security/credentials/fake/fake_credentials.cc index 7ad4d61809a..c439282ffb1 100644 --- a/src/core/lib/security/credentials/fake/fake_credentials.cc +++ b/src/core/lib/security/credentials/fake/fake_credentials.cc @@ -59,7 +59,7 @@ class grpc_fake_server_credentials final : public grpc_server_credentials { ~grpc_fake_server_credentials() override = default; grpc_core::RefCountedPtr - create_security_connector(const grpc_channel_args* args) override { + create_security_connector(const grpc_channel_args* /*args*/) override { return grpc_fake_server_security_connector_create(this->Ref()); } }; diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc index e380e274b66..967f744cee4 100644 --- a/src/core/lib/surface/server.cc +++ b/src/core/lib/surface/server.cc @@ -513,7 +513,7 @@ grpc_resource_user* CreateDefaultResourceUser(const grpc_channel_args* args) { } RefCountedPtr CreateChannelzNode( - Server* /*server*/, const grpc_channel_args* args) { + const grpc_channel_args* args) { RefCountedPtr channelz_node; if (grpc_channel_args_find_bool(args, GRPC_ARG_ENABLE_CHANNELZ, GRPC_ENABLE_CHANNELZ_DEFAULT)) { @@ -534,7 +534,7 @@ RefCountedPtr CreateChannelzNode( Server::Server(const grpc_channel_args* args) : channel_args_(grpc_channel_args_copy(args)), default_resource_user_(CreateDefaultResourceUser(args)), - channelz_node_(CreateChannelzNode(this, args)) {} + channelz_node_(CreateChannelzNode(args)) {} Server::~Server() { grpc_channel_args_destroy(channel_args_); diff --git a/src/cpp/ext/filters/census/context.cc b/src/cpp/ext/filters/census/context.cc index f2d251c1833..cffa68d6f56 100644 --- a/src/cpp/ext/filters/census/context.cc +++ b/src/cpp/ext/filters/census/context.cc @@ -28,10 +28,8 @@ using ::opencensus::tags::TagMap; using ::opencensus::trace::Span; using ::opencensus::trace::SpanContext; -void GenerateServerContext(absl::string_view tracing, - absl::string_view /*stats*/, - absl::string_view /*primary_role*/, - absl::string_view method, CensusContext* context) { +void GenerateServerContext(absl::string_view tracing, absl::string_view method, + CensusContext* context) { // Destruct the current CensusContext to free the Span memory before // overwriting it below. context->~CensusContext(); diff --git a/src/cpp/ext/filters/census/context.h b/src/cpp/ext/filters/census/context.h index 0c945b5f361..55709963522 100644 --- a/src/cpp/ext/filters/census/context.h +++ b/src/cpp/ext/filters/census/context.h @@ -96,9 +96,8 @@ size_t ServerStatsDeserialize(const char* buf, size_t buf_size, // Deserialize the incoming SpanContext and generate a new server context based // on that. This new span will never be a root span. This should only be called // with a blank CensusContext as it overwrites it. -void GenerateServerContext(absl::string_view tracing, absl::string_view stats, - absl::string_view primary_role, - absl::string_view method, CensusContext* context); +void GenerateServerContext(absl::string_view tracing, absl::string_view method, + CensusContext* context); // Creates a new client context that is by default a new root context. // If the current context is the default context then the newly created diff --git a/src/cpp/ext/filters/census/server_filter.cc b/src/cpp/ext/filters/census/server_filter.cc index e01985e3fe3..61e28de635e 100644 --- a/src/cpp/ext/filters/census/server_filter.cc +++ b/src/cpp/ext/filters/census/server_filter.cc @@ -103,19 +103,8 @@ void CensusServerCallData::OnDoneRecvInitialMetadataCb(void* user_data, size_t tracing_str_len = GRPC_SLICE_IS_EMPTY(sml.tracing_slice) ? 0 : GRPC_SLICE_LENGTH(sml.tracing_slice); - const char* census_str = GRPC_SLICE_IS_EMPTY(sml.census_proto) - ? "" - : reinterpret_cast( - GRPC_SLICE_START_PTR(sml.census_proto)); - size_t census_str_len = GRPC_SLICE_IS_EMPTY(sml.census_proto) - ? 0 - : GRPC_SLICE_LENGTH(sml.census_proto); - GenerateServerContext(absl::string_view(tracing_str, tracing_str_len), - absl::string_view(census_str, census_str_len), - /*primary_role*/ "", calld->qualified_method_, - &calld->context_); - + calld->qualified_method_, &calld->context_); grpc_slice_unref_internal(sml.tracing_slice); grpc_slice_unref_internal(sml.census_proto); grpc_slice_unref_internal(sml.path); diff --git a/test/cpp/end2end/xds_end2end_test.cc b/test/cpp/end2end/xds_end2end_test.cc index 36b6c777ced..2f56706a94c 100644 --- a/test/cpp/end2end/xds_end2end_test.cc +++ b/test/cpp/end2end/xds_end2end_test.cc @@ -895,8 +895,7 @@ class AdsServiceImpl : public std::enable_shared_from_this { &subscription_state, &resource_state, update_queue) || ClientNeedsResourceUpdate(resource_type_state, resource_state, - client_resource_type_version, - &subscription_state)) { + client_resource_type_version)) { gpr_log(GPR_INFO, "ADS[%p]: Sending update for type=%s name=%s", this, request.type_url().c_str(), resource_name.c_str()); resources_added_to_response.emplace(resource_name); @@ -942,11 +941,9 @@ class AdsServiceImpl : public std::enable_shared_from_this { auto& resource_name_map = resource_type_state.resource_name_map; auto it = subscription_name_map.find(resource_name); if (it != subscription_name_map.end()) { - SubscriptionState& subscription_state = it->second; ResourceState& resource_state = resource_name_map[resource_name]; if (ClientNeedsResourceUpdate(resource_type_state, resource_state, - sent_state->resource_type_version, - &subscription_state)) { + sent_state->resource_type_version)) { gpr_log(GPR_INFO, "ADS[%p]: Sending update for type=%s name=%s", this, resource_type.c_str(), resource_name.c_str()); response->emplace(); @@ -1060,8 +1057,7 @@ class AdsServiceImpl : public std::enable_shared_from_this { // the resource. static bool ClientNeedsResourceUpdate( const ResourceTypeState& resource_type_state, - const ResourceState& resource_state, int client_resource_type_version, - SubscriptionState* /*subscription_state*/) { + const ResourceState& resource_state, int client_resource_type_version) { return client_resource_type_version < resource_type_state.resource_type_version && resource_state.resource_type_version <= From 42f123efbecb10445aa129d7169495bd688d84c2 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Wed, 20 Jan 2021 10:12:28 -0800 Subject: [PATCH 16/21] Add ability to read xDS bootstrap config from an env var. --- src/core/ext/xds/xds_bootstrap.cc | 73 ++++++++++++++++------------ src/core/ext/xds/xds_bootstrap.h | 19 +++++--- src/core/ext/xds/xds_client.cc | 4 +- test/cpp/end2end/xds_end2end_test.cc | 39 +++++++++++++-- 4 files changed, 92 insertions(+), 43 deletions(-) diff --git a/src/core/ext/xds/xds_bootstrap.cc b/src/core/ext/xds/xds_bootstrap.cc index 95f4c3de1e3..acc9e216d72 100644 --- a/src/core/ext/xds/xds_bootstrap.cc +++ b/src/core/ext/xds/xds_bootstrap.cc @@ -157,38 +157,51 @@ std::unique_ptr ParseJsonAndCreate( } // namespace -std::unique_ptr XdsBootstrap::ReadFromFile( - XdsClient* client, TraceFlag* tracer, const char* fallback_config, - grpc_error** error) { +std::unique_ptr XdsBootstrap::Create(XdsClient* client, + TraceFlag* tracer, + const char* fallback_config, + grpc_error** error) { + // First, try GRPC_XDS_BOOTSTRAP env var. grpc_core::UniquePtr path(gpr_getenv("GRPC_XDS_BOOTSTRAP")); - if (path == nullptr) { - if (fallback_config != nullptr) { - return ParseJsonAndCreate(client, tracer, fallback_config, - "fallback config", error); + if (path != nullptr) { + if (GRPC_TRACE_FLAG_ENABLED(*tracer)) { + gpr_log(GPR_INFO, + "[xds_client %p] Got bootstrap file location from " + "GRPC_XDS_BOOTSTRAP environment variable: %s", + client, path.get()); } - *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING( - "Environment variable GRPC_XDS_BOOTSTRAP not defined"); - return nullptr; - } - if (GRPC_TRACE_FLAG_ENABLED(*tracer)) { - gpr_log(GPR_INFO, - "[xds_client %p] Got bootstrap file location from " - "GRPC_XDS_BOOTSTRAP environment variable: %s", - client, path.get()); - } - grpc_slice contents; - *error = grpc_load_file(path.get(), /*add_null_terminator=*/true, &contents); - if (*error != GRPC_ERROR_NONE) return nullptr; - absl::string_view contents_str_view = StringViewFromSlice(contents); - if (GRPC_TRACE_FLAG_ENABLED(*tracer)) { - gpr_log(GPR_DEBUG, "[xds_client %p] Bootstrap file contents: %s", client, - std::string(contents_str_view).c_str()); - } - std::string bootstrap_source = absl::StrCat("file ", path.get()); - auto result = ParseJsonAndCreate(client, tracer, contents_str_view, - bootstrap_source, error); - grpc_slice_unref_internal(contents); - return result; + grpc_slice contents; + *error = + grpc_load_file(path.get(), /*add_null_terminator=*/true, &contents); + if (*error != GRPC_ERROR_NONE) return nullptr; + absl::string_view contents_str_view = StringViewFromSlice(contents); + if (GRPC_TRACE_FLAG_ENABLED(*tracer)) { + gpr_log(GPR_DEBUG, "[xds_client %p] Bootstrap file contents: %s", client, + std::string(contents_str_view).c_str()); + } + std::string bootstrap_source = absl::StrCat("file ", path.get()); + auto result = ParseJsonAndCreate(client, tracer, contents_str_view, + bootstrap_source, error); + grpc_slice_unref_internal(contents); + return result; + } + // Next, try GRPC_XDS_BOOTSTRAP_CONFIG env var. + grpc_core::UniquePtr env_config( + gpr_getenv("GRPC_XDS_BOOTSTRAP_CONFIG")); + if (env_config != nullptr) { + return ParseJsonAndCreate(client, tracer, env_config.get(), + "GRPC_XDS_BOOTSTRAP_CONFIG env var", error); + } + // Finally, try fallback config. + if (fallback_config != nullptr) { + return ParseJsonAndCreate(client, tracer, fallback_config, + "fallback config", error); + } + // No bootstrap config found. + *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING( + "Environment variables GRPC_XDS_BOOTSTRAP or GRPC_XDS_BOOTSTRAP_CONFIG " + "not defined"); + return nullptr; } XdsBootstrap::XdsBootstrap(Json json, grpc_error** error) { diff --git a/src/core/ext/xds/xds_bootstrap.h b/src/core/ext/xds/xds_bootstrap.h index 5d1f9095858..c4ae4d4457f 100644 --- a/src/core/ext/xds/xds_bootstrap.h +++ b/src/core/ext/xds/xds_bootstrap.h @@ -67,14 +67,19 @@ class XdsBootstrap { bool ShouldUseV3() const; }; - // Normally locates the bootstrap file via an env var. If no env var - // is set, fallback_config will be used instead (if non-null). + // Creates bootstrap object, obtaining the bootstrap JSON as appropriate + // for the environment: + // - If the GRPC_XDS_BOOTSTRAP env var is set, reads the file it specifies + // to obtain the bootstrap JSON. + // - Otherwise, if the GRPC_XDS_BOOTSTRAP_CONFIG env var is set, reads the + // content of that env var to obtain the bootstrap JSON. + // - Otherwise, the JSON will be read from fallback_config (if non-null). // If *error is not GRPC_ERROR_NONE after returning, then there was an - // error reading the file. - static std::unique_ptr ReadFromFile(XdsClient* client, - TraceFlag* tracer, - const char* fallback_config, - grpc_error** error); + // error (e.g., no config found or error reading the file). + static std::unique_ptr Create(XdsClient* client, + TraceFlag* tracer, + const char* fallback_config, + grpc_error** error); // Do not instantiate directly -- use ReadFromFile() above instead. XdsBootstrap(Json json, grpc_error** error); diff --git a/src/core/ext/xds/xds_client.cc b/src/core/ext/xds/xds_client.cc index 5b360eb0bdc..5189dc10afe 100644 --- a/src/core/ext/xds/xds_client.cc +++ b/src/core/ext/xds/xds_client.cc @@ -1734,8 +1734,8 @@ XdsClient::XdsClient(grpc_error** error) : nullptr), request_timeout_(GetRequestTimeout()), interested_parties_(grpc_pollset_set_create()), - bootstrap_(XdsBootstrap::ReadFromFile( - this, &grpc_xds_client_trace, g_fallback_bootstrap_config, error)), + bootstrap_(XdsBootstrap::Create(this, &grpc_xds_client_trace, + g_fallback_bootstrap_config, error)), certificate_provider_store_(MakeOrphanable( bootstrap_ == nullptr ? CertificateProviderStore::PluginDefinitionMap() diff --git a/test/cpp/end2end/xds_end2end_test.cc b/test/cpp/end2end/xds_end2end_test.cc index 2fad87d9d90..026d02c9fdb 100644 --- a/test/cpp/end2end/xds_end2end_test.cc +++ b/test/cpp/end2end/xds_end2end_test.cc @@ -1506,17 +1506,25 @@ class XdsEnd2endTest : public ::testing::TestWithParam { protected: XdsEnd2endTest(size_t num_backends, size_t num_balancers, int client_load_reporting_interval_seconds = 100, - bool use_xds_enabled_server = false) + bool use_xds_enabled_server = false, + bool bootstrap_contents_from_env_var = false) : num_backends_(num_backends), num_balancers_(num_balancers), client_load_reporting_interval_seconds_( client_load_reporting_interval_seconds), - use_xds_enabled_server_(use_xds_enabled_server) {} + use_xds_enabled_server_(use_xds_enabled_server), + bootstrap_contents_from_env_var_(bootstrap_contents_from_env_var) {} void SetUp() override { gpr_setenv("GRPC_XDS_EXPERIMENTAL_V3_SUPPORT", "true"); - gpr_setenv("GRPC_XDS_BOOTSTRAP", - GetParam().use_v2() ? g_bootstrap_file_v2 : g_bootstrap_file_v3); + if (bootstrap_contents_from_env_var_) { + gpr_setenv("GRPC_XDS_BOOTSTRAP_CONFIG", + GetParam().use_v2() ? kBootstrapFileV2 : kBootstrapFileV3); + } else { + gpr_setenv("GRPC_XDS_BOOTSTRAP", GetParam().use_v2() + ? g_bootstrap_file_v2 + : g_bootstrap_file_v3); + } g_port_saver->Reset(); bool localhost_resolves_to_ipv4 = false; bool localhost_resolves_to_ipv6 = false; @@ -1597,6 +1605,8 @@ class XdsEnd2endTest : public ::testing::TestWithParam { // Clear global xDS channel args, since they will go out of scope // when this test object is destroyed. grpc_core::internal::SetXdsChannelArgsForTest(nullptr); + gpr_unsetenv("GRPC_XDS_BOOTSTRAP"); + gpr_unsetenv("GRPC_XDS_BOOTSTRAP_CONFIG"); } void StartAllBackends() { @@ -2272,6 +2282,7 @@ class XdsEnd2endTest : public ::testing::TestWithParam { RouteConfiguration default_route_config_; Cluster default_cluster_; bool use_xds_enabled_server_; + bool bootstrap_contents_from_env_var_; }; class BasicTest : public XdsEnd2endTest { @@ -7833,6 +7844,22 @@ TEST_P(ClientLoadReportingWithDropTest, Vanilla) { kDropRateForThrottle * (1 + kErrorTolerance)))); } +class BootstrapContentsFromEnvVarTest : public XdsEnd2endTest { + public: + BootstrapContentsFromEnvVarTest() : XdsEnd2endTest(4, 1, 100, false, true) {} +}; + +TEST_P(BootstrapContentsFromEnvVarTest, Vanilla) { + SetNextResolution({}); + SetNextResolutionForLbChannelAllBalancers(); + AdsServiceImpl::EdsResourceArgs args({ + {"locality0", GetBackendPorts()}, + }); + balancers_[0]->ads_service()->SetEdsResource( + BuildEdsResource(args, DefaultEdsServiceName())); + WaitForAllBackends(); +} + std::string TestTypeName(const ::testing::TestParamInfo& info) { return info.param.AsString(); } @@ -7967,6 +7994,10 @@ INSTANTIATE_TEST_SUITE_P(XdsTest, ClientLoadReportingWithDropTest, TestType(true, true)), &TestTypeName); +INSTANTIATE_TEST_SUITE_P(XdsTest, BootstrapContentsFromEnvVarTest, + ::testing::Values(TestType(true, false)), + &TestTypeName); + } // namespace } // namespace testing } // namespace grpc From 289eaab1fb2de514bc920e25d9f0cd4a9f47d132 Mon Sep 17 00:00:00 2001 From: AJ Heller Date: Wed, 20 Jan 2021 11:04:45 -0800 Subject: [PATCH 17/21] Fix broken nightly build and publish due to MacOS x86 protoc deprecation The grpc_publish_packages.sh build has been broken since 2020-12-03 due to commit 010d9f302, after which protoc artifacts for MacOS x86 were no longer being built. See #24870. The internal errors for `grpc/core/nightly/grpc_publish_packages` are failing on `chmod +x `. As pointed out in #25210, https://packages.grpc.io/ has not been updated since 2020-12-02. --- tools/internal_ci/linux/grpc_publish_packages.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/internal_ci/linux/grpc_publish_packages.sh b/tools/internal_ci/linux/grpc_publish_packages.sh index 1aa66bcf931..39d955115e5 100755 --- a/tools/internal_ci/linux/grpc_publish_packages.sh +++ b/tools/internal_ci/linux/grpc_publish_packages.sh @@ -49,7 +49,7 @@ for zip_dir in protoc_windows_{x86,x64} do zip -jr "$PROTOC_PLUGINS_ZIPPED_PACKAGES/grpc-$zip_dir-$GRPC_VERSION.zip" "$INPUT_ARTIFACTS/$zip_dir/"* done -for tar_dir in protoc_{linux,macos}_{x86,x64} +for tar_dir in protoc_linux_x86 protoc_linux_x64 protoc_macos_x64 do chmod +x "$INPUT_ARTIFACTS/$tar_dir"/* tar -cvzf "$PROTOC_PLUGINS_ZIPPED_PACKAGES/grpc-$tar_dir-$GRPC_VERSION.tar.gz" -C "$INPUT_ARTIFACTS/$tar_dir" . From 985c8ff3b2ad159c9a22c64eedf651cfcd9c7a77 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Wed, 20 Jan 2021 11:23:38 -0800 Subject: [PATCH 18/21] Fix the bug of cq_maybe_expect_completion --- test/core/end2end/cq_verifier.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/core/end2end/cq_verifier.cc b/test/core/end2end/cq_verifier.cc index 0d1d69d1191..b110ed6f282 100644 --- a/test/core/end2end/cq_verifier.cc +++ b/test/core/end2end/cq_verifier.cc @@ -304,9 +304,9 @@ void cq_verify_empty_timeout(cq_verifier* v, int timeout_sec) { void cq_verify_empty(cq_verifier* v) { cq_verify_empty_timeout(v, 1); } void cq_maybe_expect_completion(cq_verifier* v, const char* file, int line, - void* tag, bool /*success*/, bool* seen) { - v->maybe_expectations.emplace_back(file, line, GRPC_OP_COMPLETE, tag, true, - true, seen); + void* tag, bool success, bool* seen) { + v->maybe_expectations.emplace_back(file, line, GRPC_OP_COMPLETE, tag, + true /* check_success */, success, seen); } static void add(cq_verifier* v, const char* file, int line, From ff872f1ca01dc7070e291fd77544f04c10e600be Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Wed, 20 Jan 2021 11:57:42 -0800 Subject: [PATCH 19/21] Make centos7 docker image buildable --- tools/dockerfile/distribtest/ruby_centos7_x64/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/dockerfile/distribtest/ruby_centos7_x64/Dockerfile b/tools/dockerfile/distribtest/ruby_centos7_x64/Dockerfile index baf5e066cae..b781e92aea0 100644 --- a/tools/dockerfile/distribtest/ruby_centos7_x64/Dockerfile +++ b/tools/dockerfile/distribtest/ruby_centos7_x64/Dockerfile @@ -14,7 +14,7 @@ FROM centos:7 -RUN yum update && yum install -y curl tar which +RUN yum update -y && yum install -y curl tar which # Install rvm RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB From 85aa1c5f832e0f596e6add1c6aca02f77208e874 Mon Sep 17 00:00:00 2001 From: AJ Heller Date: Thu, 21 Jan 2021 09:01:35 -0800 Subject: [PATCH 20/21] Fix the publish packages script v2 (macos x86 deprecation) --- tools/internal_ci/linux/grpc_publish_packages.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/internal_ci/linux/grpc_publish_packages.sh b/tools/internal_ci/linux/grpc_publish_packages.sh index 39d955115e5..1cf639bed3e 100755 --- a/tools/internal_ci/linux/grpc_publish_packages.sh +++ b/tools/internal_ci/linux/grpc_publish_packages.sh @@ -49,7 +49,7 @@ for zip_dir in protoc_windows_{x86,x64} do zip -jr "$PROTOC_PLUGINS_ZIPPED_PACKAGES/grpc-$zip_dir-$GRPC_VERSION.zip" "$INPUT_ARTIFACTS/$zip_dir/"* done -for tar_dir in protoc_linux_x86 protoc_linux_x64 protoc_macos_x64 +for tar_dir in protoc_linux_{x86,x64} protoc_macos_x64 do chmod +x "$INPUT_ARTIFACTS/$tar_dir"/* tar -cvzf "$PROTOC_PLUGINS_ZIPPED_PACKAGES/grpc-$tar_dir-$GRPC_VERSION.tar.gz" -C "$INPUT_ARTIFACTS/$tar_dir" . @@ -57,7 +57,8 @@ done PROTOC_PACKAGES=( "$PROTOC_PLUGINS_ZIPPED_PACKAGES"/grpc-protoc_windows_{x86,x64}-"$GRPC_VERSION.zip" - "$PROTOC_PLUGINS_ZIPPED_PACKAGES"/grpc-protoc_{linux,macos}_{x86,x64}-"$GRPC_VERSION.tar.gz" + "$PROTOC_PLUGINS_ZIPPED_PACKAGES"/grpc-protoc_linux_{x86,x64}-"$GRPC_VERSION.tar.gz" + "$PROTOC_PLUGINS_ZIPPED_PACKAGES"/grpc-protoc_macos_x64-"$GRPC_VERSION.tar.gz" ) # C# From 669e859f7a7d0911733e8019c5d0fb27a546c429 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Thu, 21 Jan 2021 10:30:16 -0800 Subject: [PATCH 21/21] Fix more unused-parameter warning --- test/cpp/end2end/context_allocator_end2end_test.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/cpp/end2end/context_allocator_end2end_test.cc b/test/cpp/end2end/context_allocator_end2end_test.cc index 33e4bc11de0..cae3029f783 100644 --- a/test/cpp/end2end/context_allocator_end2end_test.cc +++ b/test/cpp/end2end/context_allocator_end2end_test.cc @@ -223,11 +223,12 @@ class NullContextAllocatorTest : public ContextAllocatorEnd2endTestBase { } void Release( - grpc::CallbackServerContext* callback_server_context) override { + grpc::CallbackServerContext* /*callback_server_context*/) override { deallocation_count_->fetch_add(1, std::memory_order_relaxed); } - void Release(GenericCallbackServerContext* generic_callback_server_context) + void Release( + GenericCallbackServerContext* /*generic_callback_server_context*/) override { deallocation_count_->fetch_add(1, std::memory_order_relaxed); }