From 27aadc0e0ca29574780f6b62d72ad2f0b876f63a Mon Sep 17 00:00:00 2001 From: Christian Maurer Date: Mon, 2 Mar 2020 15:24:33 +0100 Subject: [PATCH 01/10] fix memory leak of grpc_resource_user_quota --- src/core/lib/surface/server.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc index e6c81d9d460..810b35de2ff 100644 --- a/src/core/lib/surface/server.cc +++ b/src/core/lib/surface/server.cc @@ -1352,13 +1352,6 @@ void grpc_server_shutdown_and_notify(grpc_server* server, channel_broadcaster_shutdown(&broadcaster, true /* send_goaway */, GRPC_ERROR_NONE); - - if (server->default_resource_user != nullptr) { - grpc_resource_quota_unref( - grpc_resource_user_quota(server->default_resource_user)); - grpc_resource_user_shutdown(server->default_resource_user); - grpc_resource_user_unref(server->default_resource_user); - } } void grpc_server_cancel_all_calls(grpc_server* server) { @@ -1396,6 +1389,12 @@ void grpc_server_destroy(grpc_server* server) { gpr_mu_unlock(&server->mu_global); + if (server->default_resource_user != nullptr) { + grpc_resource_quota_unref( + grpc_resource_user_quota(server->default_resource_user)); + grpc_resource_user_shutdown(server->default_resource_user); + grpc_resource_user_unref(server->default_resource_user); + } server_unref(server); } From 45d92f26ca533fc5fd9b863dca78913a36a62cb3 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 1 Jul 2020 13:34:57 +0200 Subject: [PATCH 02/10] add Grpc.Tools test for generating for .proto with the same name --- test/distrib/csharp/DistribTest/Program.cs | 8 +++++++ .../duplicate_proto/testcodegen.proto | 23 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 test/distrib/csharp/DistribTest/duplicate_proto/testcodegen.proto diff --git a/test/distrib/csharp/DistribTest/Program.cs b/test/distrib/csharp/DistribTest/Program.cs index bda7b2104d6..79c10ac3a99 100644 --- a/test/distrib/csharp/DistribTest/Program.cs +++ b/test/distrib/csharp/DistribTest/Program.cs @@ -53,6 +53,14 @@ namespace TestGrpcPackage server.ShutdownAsync().Wait(); } } + + // Test that codegen works well in case the .csproj has .proto files + // of the same name, but under different directories (see #17672). + // This method doesn't need to be used, it is enough to check that it builds. + private static object CheckDuplicateProtoFilesAreOk() + { + return new DuplicateProto.MessageFromDuplicateProto(); + } } class GreeterImpl : Greeter.GreeterBase diff --git a/test/distrib/csharp/DistribTest/duplicate_proto/testcodegen.proto b/test/distrib/csharp/DistribTest/duplicate_proto/testcodegen.proto new file mode 100644 index 00000000000..cb767cb8055 --- /dev/null +++ b/test/distrib/csharp/DistribTest/duplicate_proto/testcodegen.proto @@ -0,0 +1,23 @@ +// Copyright 2019 The 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. + +// Test that codegen works well in case the .csproj has .proto files +// of the same name, but under different directories (see #17672). +syntax = "proto3"; + +package duplicate_proto; + +message MessageFromDuplicateProto { + string name = 1; +} From 27033c4f8d79ae60d7caf6313378da540e5411e6 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Thu, 9 Jul 2020 15:17:37 -0700 Subject: [PATCH 03/10] Update the hint for install Python header to depend on version --- src/python/grpcio/support.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/python/grpcio/support.py b/src/python/grpcio/support.py index 054f86445f5..7ee72da46b0 100644 --- a/src/python/grpcio/support.py +++ b/src/python/grpcio/support.py @@ -28,18 +28,20 @@ int main(int argc, char **argv) { return 0; } """ C_PYTHON_DEV_ERROR_MESSAGE = """ Could not find . This could mean the following: - * You're on Ubuntu and haven't run `apt-get install python-dev`. - * You're on RHEL/Fedora and haven't run `yum install python-devel` or - `dnf install python-devel` (make sure you also have redhat-rpm-config + * You're on Ubuntu and haven't run `apt-get install -dev`. + * You're on RHEL/Fedora and haven't run `yum install -devel` or + `dnf install -devel` (make sure you also have redhat-rpm-config installed) * You're on Mac OS X and the usual Python framework was somehow corrupted (check your environment variables or try re-installing?) * You're on Windows and your Python installation was somehow corrupted (check your environment variables or try re-installing?) """ +PYTHON_REPRESENTATION = 'python' if sys.version_info[0] == 2 else 'python3' C_CHECKS = { - C_PYTHON_DEV: C_PYTHON_DEV_ERROR_MESSAGE, + C_PYTHON_DEV: + C_PYTHON_DEV_ERROR_MESSAGE.replace('', PYTHON_REPRESENTATION), } From 8f3bd10c03659cd411fc5a5bf82b702adb5dc380 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Thu, 9 Jul 2020 15:34:06 -0700 Subject: [PATCH 04/10] Make sure >3 Python version triggers a failure --- src/python/grpcio/support.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/python/grpcio/support.py b/src/python/grpcio/support.py index 7ee72da46b0..217f3cb9ed5 100644 --- a/src/python/grpcio/support.py +++ b/src/python/grpcio/support.py @@ -37,7 +37,12 @@ Could not find . This could mean the following: * You're on Windows and your Python installation was somehow corrupted (check your environment variables or try re-installing?) """ -PYTHON_REPRESENTATION = 'python' if sys.version_info[0] == 2 else 'python3' +if sys.version_info[0] == 2: + PYTHON_REPRESENTATION = 'python' +elif sys.version_info[0] == 3: + PYTHON_REPRESENTATION = 'python3' +else: + raise NotImplementedError('Unsupported Python version: %s' % sys.version) C_CHECKS = { C_PYTHON_DEV: From d03daab50913a48bf4f2993ac7c4e3c0cd9d00d1 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 9 Jul 2020 16:28:14 -0700 Subject: [PATCH 05/10] Remove unused variable (fixes builder error) --- test/cpp/end2end/grpclb_end2end_test.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/test/cpp/end2end/grpclb_end2end_test.cc b/test/cpp/end2end/grpclb_end2end_test.cc index 862e7306f9e..97ea12df7ea 100644 --- a/test/cpp/end2end/grpclb_end2end_test.cc +++ b/test/cpp/end2end/grpclb_end2end_test.cc @@ -1404,7 +1404,6 @@ TEST_F(SingleBalancerTest, ServiceNameFromLbPolicyConfig) { "}"; SetNextResolutionAllBalancers(kServiceConfigWithTarget); - const size_t kNumRpcsPerAddress = 1; ScheduleResponseForBalancer( 0, BalancerServiceImpl::BuildResponseForBackends(GetBackendPorts(), {}), 0); From 93bd8b39cdafade7e1fa0a5d59f952fad68a8dd9 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Fri, 10 Jul 2020 09:34:02 -0700 Subject: [PATCH 06/10] Added change_repo_manager.sh --- .github/change_repo_manager.sh | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 .github/change_repo_manager.sh diff --git a/.github/change_repo_manager.sh b/.github/change_repo_manager.sh new file mode 100755 index 00000000000..8e41217395e --- /dev/null +++ b/.github/change_repo_manager.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# Copyright 2020 The 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. + +set -e + +if [ $# -lt 1 ];then + echo "Usage: $0 github-id" + exit 1 +fi + +echo "Change a repo manager to $0" + +BASE_PATH=$(dirname $0) + +for file in bug_report.md cleanup_request.md feature_request.md question.md +do + sed -i -E "s/assignees: ([a-zA-Z0-9-]+)/assignees: $1/" $BASE_PATH/ISSUE_TEMPLATE/$file +done + +sed -i -E "s/^@([a-zA-Z0-9-]+)/@$1/" $BASE_PATH/pull_request_template.md + +echo "Done" \ No newline at end of file From 1e5841855d555c8845d99cf939f4b1b4d619a742 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Fri, 10 Jul 2020 09:34:50 -0700 Subject: [PATCH 07/10] Changed a repo manager to karthikrs --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/cleanup_request.md | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- .github/ISSUE_TEMPLATE/question.md | 2 +- .github/pull_request_template.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index dbec90aefc9..2692dc7faa2 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -2,7 +2,7 @@ name: Report a bug about: Create a report to help us improve labels: kind/bug, priority/P2 -assignees: veblush +assignees: karthikravis --- diff --git a/.github/ISSUE_TEMPLATE/cleanup_request.md b/.github/ISSUE_TEMPLATE/cleanup_request.md index d821fef2cf9..bea10f3ef6a 100644 --- a/.github/ISSUE_TEMPLATE/cleanup_request.md +++ b/.github/ISSUE_TEMPLATE/cleanup_request.md @@ -2,7 +2,7 @@ name: Request a cleanup about: Suggest a cleanup in our repository labels: kind/internal cleanup, priority/P2 -assignees: veblush +assignees: karthikravis --- diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 5a2f61d118a..e11349754ba 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -2,7 +2,7 @@ name: Request a feature about: Suggest an idea for this project labels: kind/enhancement, priority/P2 -assignees: veblush +assignees: karthikravis --- diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index 68f5dfb29bf..db52e41626c 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -2,7 +2,7 @@ name: Ask a question about: Ask a question labels: kind/question, priority/P3 -assignees: veblush +assignees: karthikravis --- diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 366b68604df..681d2f819ce 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -8,4 +8,4 @@ If you know who should review your pull request, please remove the mentioning be --> -@veblush +@karthikravis From f258c5cb94c31864769c1d94723a43638f4d8503 Mon Sep 17 00:00:00 2001 From: Hannah Shi Date: Fri, 10 Jul 2020 17:23:50 +0000 Subject: [PATCH 08/10] add comments for constants --- src/php/ext/grpc/php_grpc.c | 137 ++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) diff --git a/src/php/ext/grpc/php_grpc.c b/src/php/ext/grpc/php_grpc.c index 87099f47a9e..f567d8c59c3 100644 --- a/src/php/ext/grpc/php_grpc.c +++ b/src/php/ext/grpc/php_grpc.c @@ -285,122 +285,259 @@ PHP_MINIT_FUNCTION(grpc) { REGISTER_INI_ENTRIES(); /* Register call error constants */ + /** everything went ok */ REGISTER_LONG_CONSTANT("Grpc\\CALL_OK", GRPC_CALL_OK, CONST_CS | CONST_PERSISTENT); + /** something failed, we don't know what */ REGISTER_LONG_CONSTANT("Grpc\\CALL_ERROR", GRPC_CALL_ERROR, CONST_CS | CONST_PERSISTENT); + /** this method is not available on the server */ REGISTER_LONG_CONSTANT("Grpc\\CALL_ERROR_NOT_ON_SERVER", GRPC_CALL_ERROR_NOT_ON_SERVER, CONST_CS | CONST_PERSISTENT); + /** this method is not available on the client */ REGISTER_LONG_CONSTANT("Grpc\\CALL_ERROR_NOT_ON_CLIENT", GRPC_CALL_ERROR_NOT_ON_CLIENT, CONST_CS | CONST_PERSISTENT); + /** this method must be called before invoke */ REGISTER_LONG_CONSTANT("Grpc\\CALL_ERROR_ALREADY_INVOKED", GRPC_CALL_ERROR_ALREADY_INVOKED, CONST_CS | CONST_PERSISTENT); + /** this method must be called after invoke */ REGISTER_LONG_CONSTANT("Grpc\\CALL_ERROR_NOT_INVOKED", GRPC_CALL_ERROR_NOT_INVOKED, CONST_CS | CONST_PERSISTENT); + /** this call is already finished + (writes_done or write_status has already been called) */ REGISTER_LONG_CONSTANT("Grpc\\CALL_ERROR_ALREADY_FINISHED", GRPC_CALL_ERROR_ALREADY_FINISHED, CONST_CS | CONST_PERSISTENT); + /** there is already an outstanding read/write operation on the call */ REGISTER_LONG_CONSTANT("Grpc\\CALL_ERROR_TOO_MANY_OPERATIONS", GRPC_CALL_ERROR_TOO_MANY_OPERATIONS, CONST_CS | CONST_PERSISTENT); + /** the flags value was illegal for this call */ REGISTER_LONG_CONSTANT("Grpc\\CALL_ERROR_INVALID_FLAGS", GRPC_CALL_ERROR_INVALID_FLAGS, CONST_CS | CONST_PERSISTENT); /* Register flag constants */ + /** Hint that the write may be buffered and need not go out on the wire + immediately. GRPC is free to buffer the message until the next non-buffered + write, or until writes_done, but it need not buffer completely or at all. */ REGISTER_LONG_CONSTANT("Grpc\\WRITE_BUFFER_HINT", GRPC_WRITE_BUFFER_HINT, CONST_CS | CONST_PERSISTENT); + /** Force compression to be disabled for a particular write + (start_write/add_metadata). Illegal on invoke/accept. */ REGISTER_LONG_CONSTANT("Grpc\\WRITE_NO_COMPRESS", GRPC_WRITE_NO_COMPRESS, CONST_CS | CONST_PERSISTENT); /* Register status constants */ + /** Not an error; returned on success */ REGISTER_LONG_CONSTANT("Grpc\\STATUS_OK", GRPC_STATUS_OK, CONST_CS | CONST_PERSISTENT); + /** The operation was cancelled (typically by the caller). */ REGISTER_LONG_CONSTANT("Grpc\\STATUS_CANCELLED", GRPC_STATUS_CANCELLED, CONST_CS | CONST_PERSISTENT); + /** Unknown error. An example of where this error may be returned is + if a Status value received from another address space belongs to + an error-space that is not known in this address space. Also + errors raised by APIs that do not return enough error information + may be converted to this error. */ REGISTER_LONG_CONSTANT("Grpc\\STATUS_UNKNOWN", GRPC_STATUS_UNKNOWN, CONST_CS | CONST_PERSISTENT); + /** Client specified an invalid argument. Note that this differs + from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments + that are problematic regardless of the state of the system + (e.g., a malformed file name). */ REGISTER_LONG_CONSTANT("Grpc\\STATUS_INVALID_ARGUMENT", GRPC_STATUS_INVALID_ARGUMENT, CONST_CS | CONST_PERSISTENT); + /** Deadline expired before operation could complete. For operations + that change the state of the system, this error may be returned + even if the operation has completed successfully. For example, a + successful response from a server could have been delayed long + enough for the deadline to expire. */ REGISTER_LONG_CONSTANT("Grpc\\STATUS_DEADLINE_EXCEEDED", GRPC_STATUS_DEADLINE_EXCEEDED, CONST_CS | CONST_PERSISTENT); + /** Some requested entity (e.g., file or directory) was not found. */ REGISTER_LONG_CONSTANT("Grpc\\STATUS_NOT_FOUND", GRPC_STATUS_NOT_FOUND, CONST_CS | CONST_PERSISTENT); + /** Some entity that we attempted to create (e.g., file or directory) + already exists. */ REGISTER_LONG_CONSTANT("Grpc\\STATUS_ALREADY_EXISTS", GRPC_STATUS_ALREADY_EXISTS, CONST_CS | CONST_PERSISTENT); + /** The caller does not have permission to execute the specified + operation. PERMISSION_DENIED must not be used for rejections + caused by exhausting some resource (use RESOURCE_EXHAUSTED + instead for those errors). PERMISSION_DENIED must not be + used if the caller can not be identified (use UNAUTHENTICATED + instead for those errors). */ REGISTER_LONG_CONSTANT("Grpc\\STATUS_PERMISSION_DENIED", GRPC_STATUS_PERMISSION_DENIED, CONST_CS | CONST_PERSISTENT); + /** The request does not have valid authentication credentials for the + operation. */ REGISTER_LONG_CONSTANT("Grpc\\STATUS_UNAUTHENTICATED", GRPC_STATUS_UNAUTHENTICATED, CONST_CS | CONST_PERSISTENT); + /** Some resource has been exhausted, perhaps a per-user quota, or + perhaps the entire file system is out of space. */ REGISTER_LONG_CONSTANT("Grpc\\STATUS_RESOURCE_EXHAUSTED", GRPC_STATUS_RESOURCE_EXHAUSTED, CONST_CS | CONST_PERSISTENT); + /** Operation was rejected because the system is not in a state + required for the operation's execution. For example, directory + to be deleted may be non-empty, an rmdir operation is applied to + a non-directory, etc. + + A litmus test that may help a service implementor in deciding + between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE: + (a) Use UNAVAILABLE if the client can retry just the failing call. + (b) Use ABORTED if the client should retry at a higher-level + (e.g., restarting a read-modify-write sequence). + (c) Use FAILED_PRECONDITION if the client should not retry until + the system state has been explicitly fixed. E.g., if an "rmdir" + fails because the directory is non-empty, FAILED_PRECONDITION + should be returned since the client should not retry unless + they have first fixed up the directory by deleting files from it. + (d) Use FAILED_PRECONDITION if the client performs conditional + REST Get/Update/Delete on a resource and the resource on the + server does not match the condition. E.g., conflicting + read-modify-write on the same resource. */ REGISTER_LONG_CONSTANT("Grpc\\STATUS_FAILED_PRECONDITION", GRPC_STATUS_FAILED_PRECONDITION, CONST_CS | CONST_PERSISTENT); + /** The operation was aborted, typically due to a concurrency issue + like sequencer check failures, transaction aborts, etc. + + See litmus test above for deciding between FAILED_PRECONDITION, + ABORTED, and UNAVAILABLE. */ REGISTER_LONG_CONSTANT("Grpc\\STATUS_ABORTED", GRPC_STATUS_ABORTED, CONST_CS | CONST_PERSISTENT); + /** Operation was attempted past the valid range. E.g., seeking or + reading past end of file. + + Unlike INVALID_ARGUMENT, this error indicates a problem that may + be fixed if the system state changes. For example, a 32-bit file + system will generate INVALID_ARGUMENT if asked to read at an + offset that is not in the range [0,2^32-1], but it will generate + OUT_OF_RANGE if asked to read from an offset past the current + file size. + + There is a fair bit of overlap between FAILED_PRECONDITION and + OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific + error) when it applies so that callers who are iterating through + a space can easily look for an OUT_OF_RANGE error to detect when + they are done. */ REGISTER_LONG_CONSTANT("Grpc\\STATUS_OUT_OF_RANGE", GRPC_STATUS_OUT_OF_RANGE, CONST_CS | CONST_PERSISTENT); + /** Operation is not implemented or not supported/enabled in this service. */ REGISTER_LONG_CONSTANT("Grpc\\STATUS_UNIMPLEMENTED", GRPC_STATUS_UNIMPLEMENTED, CONST_CS | CONST_PERSISTENT); + /** Internal errors. Means some invariants expected by underlying + system has been broken. If you see one of these errors, + something is very broken. */ REGISTER_LONG_CONSTANT("Grpc\\STATUS_INTERNAL", GRPC_STATUS_INTERNAL, CONST_CS | CONST_PERSISTENT); + /** The service is currently unavailable. This is a most likely a + transient condition and may be corrected by retrying with + a backoff. Note that it is not always safe to retry non-idempotent + operations. + + WARNING: Although data MIGHT not have been transmitted when this + status occurs, there is NOT A GUARANTEE that the server has not seen + anything. So in general it is unsafe to retry on this status code + if the call is non-idempotent. + + See litmus test above for deciding between FAILED_PRECONDITION, + ABORTED, and UNAVAILABLE. */ REGISTER_LONG_CONSTANT("Grpc\\STATUS_UNAVAILABLE", GRPC_STATUS_UNAVAILABLE, CONST_CS | CONST_PERSISTENT); + /** Unrecoverable data loss or corruption. */ REGISTER_LONG_CONSTANT("Grpc\\STATUS_DATA_LOSS", GRPC_STATUS_DATA_LOSS, CONST_CS | CONST_PERSISTENT); /* Register op type constants */ + /** Send initial metadata: one and only one instance MUST be sent for each + call, unless the call was cancelled - in which case this can be skipped. + This op completes after all bytes of metadata have been accepted by + outgoing flow control. */ REGISTER_LONG_CONSTANT("Grpc\\OP_SEND_INITIAL_METADATA", GRPC_OP_SEND_INITIAL_METADATA, CONST_CS | CONST_PERSISTENT); + /** Send a message: 0 or more of these operations can occur for each call. + This op completes after all bytes for the message have been accepted by + outgoing flow control. */ REGISTER_LONG_CONSTANT("Grpc\\OP_SEND_MESSAGE", GRPC_OP_SEND_MESSAGE, CONST_CS | CONST_PERSISTENT); + /** Send a close from the client: one and only one instance MUST be sent from + the client, unless the call was cancelled - in which case this can be + skipped. This op completes after all bytes for the call + (including the close) have passed outgoing flow control. */ REGISTER_LONG_CONSTANT("Grpc\\OP_SEND_CLOSE_FROM_CLIENT", GRPC_OP_SEND_CLOSE_FROM_CLIENT, CONST_CS | CONST_PERSISTENT); + /** Send status from the server: one and only one instance MUST be sent from + the server unless the call was cancelled - in which case this can be + skipped. This op completes after all bytes for the call + (including the status) have passed outgoing flow control. */ REGISTER_LONG_CONSTANT("Grpc\\OP_SEND_STATUS_FROM_SERVER", GRPC_OP_SEND_STATUS_FROM_SERVER, CONST_CS | CONST_PERSISTENT); + /** Receive initial metadata: one and only one MUST be made on the client, + must not be made on the server. + This op completes after all initial metadata has been read from the + peer. */ REGISTER_LONG_CONSTANT("Grpc\\OP_RECV_INITIAL_METADATA", GRPC_OP_RECV_INITIAL_METADATA, CONST_CS | CONST_PERSISTENT); + /** Receive a message: 0 or more of these operations can occur for each call. + This op completes after all bytes of the received message have been + read, or after a half-close has been received on this call. */ REGISTER_LONG_CONSTANT("Grpc\\OP_RECV_MESSAGE", GRPC_OP_RECV_MESSAGE, CONST_CS | CONST_PERSISTENT); + /** Receive status on the client: one and only one must be made on the client. + This operation always succeeds, meaning ops paired with this operation + will also appear to succeed, even though they may not have. In that case + the status will indicate some failure. + This op completes after all activity on the call has completed. */ REGISTER_LONG_CONSTANT("Grpc\\OP_RECV_STATUS_ON_CLIENT", GRPC_OP_RECV_STATUS_ON_CLIENT, CONST_CS | CONST_PERSISTENT); + /** Receive close on the server: one and only one must be made on the + server. This op completes after the close has been received by the + server. This operation always succeeds, meaning ops paired with + this operation will also appear to succeed, even though they may not + have. */ REGISTER_LONG_CONSTANT("Grpc\\OP_RECV_CLOSE_ON_SERVER", GRPC_OP_RECV_CLOSE_ON_SERVER, CONST_CS | CONST_PERSISTENT); /* Register connectivity state constants */ + /** channel is idle */ REGISTER_LONG_CONSTANT("Grpc\\CHANNEL_IDLE", GRPC_CHANNEL_IDLE, CONST_CS | CONST_PERSISTENT); + /** channel is connecting */ REGISTER_LONG_CONSTANT("Grpc\\CHANNEL_CONNECTING", GRPC_CHANNEL_CONNECTING, CONST_CS | CONST_PERSISTENT); + /** channel is ready for work */ REGISTER_LONG_CONSTANT("Grpc\\CHANNEL_READY", GRPC_CHANNEL_READY, CONST_CS | CONST_PERSISTENT); + /** channel has seen a failure but expects to recover */ REGISTER_LONG_CONSTANT("Grpc\\CHANNEL_TRANSIENT_FAILURE", GRPC_CHANNEL_TRANSIENT_FAILURE, CONST_CS | CONST_PERSISTENT); + /** channel has seen a failure that it cannot recover from */ REGISTER_LONG_CONSTANT("Grpc\\CHANNEL_FATAL_FAILURE", GRPC_CHANNEL_SHUTDOWN, CONST_CS | CONST_PERSISTENT); From 03056001db417de73cdcfd957f4a5d31f5780530 Mon Sep 17 00:00:00 2001 From: yang-g Date: Fri, 10 Jul 2020 11:27:29 -0700 Subject: [PATCH 09/10] Fix initialization order --- .../resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc index 5fce1c4e356..9b6a0d5023a 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc @@ -102,11 +102,11 @@ class GrpcPolledFdWindows { GrpcPolledFdWindows(ares_socket_t as, std::shared_ptr work_serializer, int address_family, int socket_type) - : name_(absl::StrFormat("c-ares socket: %" PRIdPTR, as)), - work_serializer_(std::move(work_serializer)), + : work_serializer_(std::move(work_serializer)), read_buf_(grpc_empty_slice()), write_buf_(grpc_empty_slice()), tcp_write_state_(WRITE_IDLE), + name_(absl::StrFormat("c-ares socket: %" PRIdPTR, as)), gotten_into_driver_list_(false), address_family_(address_family), socket_type_(socket_type) { From c071cfa9e883eeb2209b7890fbe4178bdf44b868 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Mon, 13 Jul 2020 09:22:20 -0700 Subject: [PATCH 10/10] Remove xds-experimental URI scheme. --- .../client_channel/resolver/xds/xds_resolver.cc | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc b/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc index d3b79e39e2c..de00d4fafe4 100644 --- a/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +++ b/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc @@ -144,8 +144,6 @@ void XdsResolver::StartLocked() { class XdsResolverFactory : public ResolverFactory { public: - explicit XdsResolverFactory(const char* scheme) : scheme_(scheme) {} - bool IsValidUri(const grpc_uri* uri) const override { if (GPR_UNLIKELY(0 != strcmp(uri->authority, ""))) { gpr_log(GPR_ERROR, "URI authority not supported"); @@ -159,26 +157,16 @@ class XdsResolverFactory : public ResolverFactory { return MakeOrphanable(std::move(args)); } - const char* scheme() const override { return scheme_; } - - private: - const char* scheme_; + const char* scheme() const override { return "xds"; } }; -constexpr char kXdsScheme[] = "xds"; -constexpr char kXdsExperimentalScheme[] = "xds-experimental"; - } // namespace } // namespace grpc_core void grpc_resolver_xds_init() { grpc_core::ResolverRegistry::Builder::RegisterResolverFactory( - absl::make_unique(grpc_core::kXdsScheme)); - // TODO(roth): Remov this in the 1.31 release. - grpc_core::ResolverRegistry::Builder::RegisterResolverFactory( - absl::make_unique( - grpc_core::kXdsExperimentalScheme)); + absl::make_unique()); } void grpc_resolver_xds_shutdown() {}