From 29bc253d25e9aa7d932ae70b752447a3264339b0 Mon Sep 17 00:00:00 2001 From: Zoltan Kuscsik Date: Thu, 13 Apr 2017 16:41:25 +0200 Subject: [PATCH 01/12] core: fix duplicated definition Refactor remove() function name to avoid duplicated function definition when building on latest AOSP. stdio in Bionic also defines remove(). --- src/core/lib/support/avl.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/lib/support/avl.c b/src/core/lib/support/avl.c index acf8fd5a552..d8440001536 100644 --- a/src/core/lib/support/avl.c +++ b/src/core/lib/support/avl.c @@ -247,7 +247,7 @@ static gpr_avl_node *in_order_tail(gpr_avl_node *node) { return node; } -static gpr_avl_node *remove(const gpr_avl_vtable *vtable, gpr_avl_node *node, +static gpr_avl_node *_remove(const gpr_avl_vtable *vtable, gpr_avl_node *node, void *key) { long cmp; if (node == NULL) { @@ -263,27 +263,27 @@ static gpr_avl_node *remove(const gpr_avl_vtable *vtable, gpr_avl_node *node, gpr_avl_node *h = in_order_head(node->right); return rebalance(vtable, vtable->copy_key(h->key), vtable->copy_value(h->value), ref_node(node->left), - remove(vtable, node->right, h->key)); + _remove(vtable, node->right, h->key)); } else { gpr_avl_node *h = in_order_tail(node->left); return rebalance( vtable, vtable->copy_key(h->key), vtable->copy_value(h->value), - remove(vtable, node->left, h->key), ref_node(node->right)); + _remove(vtable, node->left, h->key), ref_node(node->right)); } } else if (cmp > 0) { return rebalance(vtable, vtable->copy_key(node->key), vtable->copy_value(node->value), - remove(vtable, node->left, key), ref_node(node->right)); + _remove(vtable, node->left, key), ref_node(node->right)); } else { return rebalance(vtable, vtable->copy_key(node->key), vtable->copy_value(node->value), ref_node(node->left), - remove(vtable, node->right, key)); + _remove(vtable, node->right, key)); } } gpr_avl gpr_avl_remove(gpr_avl avl, void *key) { gpr_avl_node *old_root = avl.root; - avl.root = remove(avl.vtable, avl.root, key); + avl.root = _remove(avl.vtable, avl.root, key); assert_invariants(avl.root); unref_node(avl.vtable, old_root); return avl; From ae64b01506b5b5322694c5fc06d09910f4945cbb Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 21 Apr 2017 16:12:39 -0700 Subject: [PATCH 02/12] updated g meaning for 1.4.x --- BUILD | 2 +- build.yaml | 2 +- doc/g_stands_for.md | 1 + src/core/lib/surface/version.c | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/BUILD b/BUILD index 09b17ad6eb2..5662a9e795b 100644 --- a/BUILD +++ b/BUILD @@ -39,7 +39,7 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_proto_plugin", "grpc_cc_libraries") # This should be updated along with build.yaml -g_stands_for = "gentle" +g_stands_for = "gregarious" core_version = "3.0.0-dev" diff --git a/build.yaml b/build.yaml index 58a474aabf1..e063f3e3df0 100644 --- a/build.yaml +++ b/build.yaml @@ -13,7 +13,7 @@ settings: '#09': Per-language overrides are possible with (eg) ruby_version tag here '#10': See the expand_version.py for all the quirks here core_version: 4.0.0-dev - g_stands_for: gentle + g_stands_for: gregarious version: 1.4.0-dev filegroups: - name: census diff --git a/doc/g_stands_for.md b/doc/g_stands_for.md index d2fc7a50f95..2078bb37ea1 100644 --- a/doc/g_stands_for.md +++ b/doc/g_stands_for.md @@ -8,3 +8,4 @@ future), and the corresponding version numbers that used them: - 1.1 'g' stands for 'good' - 1.2 'g' stands for 'green' - 1.3 'g' stands for 'gentle' +- 1.4 'g' stands for 'gregarious' diff --git a/src/core/lib/surface/version.c b/src/core/lib/surface/version.c index 3793845559c..cddc595e4c9 100644 --- a/src/core/lib/surface/version.c +++ b/src/core/lib/surface/version.c @@ -38,4 +38,4 @@ const char *grpc_version_string(void) { return "4.0.0-dev"; } -const char *grpc_g_stands_for(void) { return "gentle"; } +const char *grpc_g_stands_for(void) { return "gregarious"; } From d3ba7cbc8c26659983d9f4a15ad58a17d4a56bb2 Mon Sep 17 00:00:00 2001 From: Noah Eisen Date: Mon, 24 Apr 2017 11:51:07 -0700 Subject: [PATCH 03/12] Don't abort on input --- src/core/lib/channel/connected_channel.c | 4 +++- src/core/lib/security/transport/client_auth_filter.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/core/lib/channel/connected_channel.c b/src/core/lib/channel/connected_channel.c index 22caf243737..d8985268eba 100644 --- a/src/core/lib/channel/connected_channel.c +++ b/src/core/lib/channel/connected_channel.c @@ -128,7 +128,9 @@ static grpc_error *init_channel_elem(grpc_exec_ctx *exec_ctx, static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem) { channel_data *cd = (channel_data *)elem->channel_data; - grpc_transport_destroy(exec_ctx, cd->transport); + if (cd->transport) { + grpc_transport_destroy(exec_ctx, cd->transport); + } } static char *con_get_peer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) { diff --git a/src/core/lib/security/transport/client_auth_filter.c b/src/core/lib/security/transport/client_auth_filter.c index f526653ffa3..1f0daf73253 100644 --- a/src/core/lib/security/transport/client_auth_filter.c +++ b/src/core/lib/security/transport/client_auth_filter.c @@ -343,8 +343,16 @@ static grpc_error *init_channel_elem(grpc_exec_ctx *exec_ctx, grpc_channel_element_args *args) { grpc_security_connector *sc = grpc_security_connector_find_in_args(args->channel_args); + if (sc == NULL) { + return GRPC_ERROR_CREATE_FROM_STATIC_STRING( + "Security connector missing from client auth filter args"); + } grpc_auth_context *auth_context = grpc_find_auth_context_in_args(args->channel_args); + if (auth_context == NULL) { + return GRPC_ERROR_CREATE_FROM_STATIC_STRING( + "Auth context missing from client auth filter args"); + } /* grab pointers to our data from the channel element */ channel_data *chand = elem->channel_data; @@ -353,8 +361,6 @@ static grpc_error *init_channel_elem(grpc_exec_ctx *exec_ctx, handle the case that there's no 'next' filter to call on the up or down path */ GPR_ASSERT(!args->is_last); - GPR_ASSERT(sc != NULL); - GPR_ASSERT(auth_context != NULL); /* initialize members */ chand->security_connector = From 7eaca2f7b62d88c1601e59ff4a1dc34706df923c Mon Sep 17 00:00:00 2001 From: Noah Eisen Date: Mon, 24 Apr 2017 16:34:25 -0700 Subject: [PATCH 04/12] Propagate publish error --- src/core/ext/filters/client_channel/subchannel.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/core/ext/filters/client_channel/subchannel.c b/src/core/ext/filters/client_channel/subchannel.c index 967e571221c..177a3c2ee7a 100644 --- a/src/core/ext/filters/client_channel/subchannel.c +++ b/src/core/ext/filters/client_channel/subchannel.c @@ -615,7 +615,7 @@ void grpc_connected_subchannel_ping(grpc_exec_ctx *exec_ctx, elem->filter->start_transport_op(exec_ctx, elem, op); } -static void publish_transport_locked(grpc_exec_ctx *exec_ctx, +static bool publish_transport_locked(grpc_exec_ctx *exec_ctx, grpc_subchannel *c) { grpc_connected_subchannel *con; grpc_channel_stack *stk; @@ -631,15 +631,16 @@ static void publish_transport_locked(grpc_exec_ctx *exec_ctx, if (!grpc_channel_init_create_stack(exec_ctx, builder, GRPC_CLIENT_SUBCHANNEL)) { grpc_channel_stack_builder_destroy(exec_ctx, builder); - abort(); /* TODO(ctiller): what to do here (previously we just crashed) */ + return false; } grpc_error *error = grpc_channel_stack_builder_finish( exec_ctx, builder, 0, 1, connection_destroy, NULL, (void **)&con); if (error != GRPC_ERROR_NONE) { + grpc_transport_destroy(exec_ctx, c->connecting_result.transport); gpr_log(GPR_ERROR, "error initializing subchannel stack: %s", grpc_error_string(error)); GRPC_ERROR_UNREF(error); - abort(); /* TODO(ctiller): what to do here? */ + return false; } stk = CHANNEL_STACK_FROM_CONNECTION(con); memset(&c->connecting_result, 0, sizeof(c->connecting_result)); @@ -656,7 +657,7 @@ static void publish_transport_locked(grpc_exec_ctx *exec_ctx, grpc_channel_stack_destroy(exec_ctx, stk); gpr_free(con); GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, c, "connecting"); - return; + return false; } /* publish */ @@ -678,6 +679,7 @@ static void publish_transport_locked(grpc_exec_ctx *exec_ctx, /* signal completion */ grpc_connectivity_state_set(exec_ctx, &c->state_tracker, GRPC_CHANNEL_READY, GRPC_ERROR_NONE, "connected"); + return true; } static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *arg, @@ -688,8 +690,8 @@ static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *arg, GRPC_SUBCHANNEL_WEAK_REF(c, "connected"); gpr_mu_lock(&c->mu); c->connecting = false; - if (c->connecting_result.transport != NULL) { - publish_transport_locked(exec_ctx, c); + if (c->connecting_result.transport != NULL && publish_transport_locked(exec_ctx, c)) { + /* do nothing, transport was published */ } else if (c->disconnected) { GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, c, "connecting"); } else { From 6b42bfde1f710edc5856a3934894aa80d311d0e6 Mon Sep 17 00:00:00 2001 From: Noah Eisen Date: Mon, 24 Apr 2017 16:36:11 -0700 Subject: [PATCH 05/12] Add fuzzer to corpus --- ...erfuzz-testcase-minimized-5175380371570688 | Bin 0 -> 48 bytes tools/run_tests/generated/tests.json | 23 ++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 test/core/end2end/fuzzers/api_fuzzer_corpus/clusterfuzz-testcase-minimized-5175380371570688 diff --git a/test/core/end2end/fuzzers/api_fuzzer_corpus/clusterfuzz-testcase-minimized-5175380371570688 b/test/core/end2end/fuzzers/api_fuzzer_corpus/clusterfuzz-testcase-minimized-5175380371570688 new file mode 100644 index 0000000000000000000000000000000000000000..9c7aebc63a291d2d6c3213a1a9fcbf2a56e0033d GIT binary patch literal 48 zcmZQ7PAw`+En;9~OfM=()+ Date: Tue, 25 Apr 2017 08:10:04 -0700 Subject: [PATCH 06/12] clang fmt --- src/core/ext/filters/client_channel/subchannel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/ext/filters/client_channel/subchannel.c b/src/core/ext/filters/client_channel/subchannel.c index 177a3c2ee7a..b2de85c4a12 100644 --- a/src/core/ext/filters/client_channel/subchannel.c +++ b/src/core/ext/filters/client_channel/subchannel.c @@ -690,7 +690,8 @@ static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *arg, GRPC_SUBCHANNEL_WEAK_REF(c, "connected"); gpr_mu_lock(&c->mu); c->connecting = false; - if (c->connecting_result.transport != NULL && publish_transport_locked(exec_ctx, c)) { + if (c->connecting_result.transport != NULL && + publish_transport_locked(exec_ctx, c)) { /* do nothing, transport was published */ } else if (c->disconnected) { GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, c, "connecting"); From fcb56a785dfd7b20ec831b6822ffdfcf3d2acd73 Mon Sep 17 00:00:00 2001 From: Zoltan Kuscsik Date: Wed, 19 Apr 2017 15:47:37 +0200 Subject: [PATCH 07/12] core, avl: rename static functions Renamed remove and add static functions to remove_key and add_key --- src/core/lib/support/avl.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/core/lib/support/avl.c b/src/core/lib/support/avl.c index d8440001536..ffa10c1e4fc 100644 --- a/src/core/lib/support/avl.c +++ b/src/core/lib/support/avl.c @@ -205,8 +205,8 @@ static gpr_avl_node *rebalance(const gpr_avl_vtable *vtable, void *key, } } -static gpr_avl_node *add(const gpr_avl_vtable *vtable, gpr_avl_node *node, - void *key, void *value) { +static gpr_avl_node *add_key(const gpr_avl_vtable *vtable, gpr_avl_node *node, + void *key, void *value) { long cmp; if (node == NULL) { return new_node(key, value, NULL, NULL); @@ -217,17 +217,17 @@ static gpr_avl_node *add(const gpr_avl_vtable *vtable, gpr_avl_node *node, } else if (cmp > 0) { return rebalance( vtable, vtable->copy_key(node->key), vtable->copy_value(node->value), - add(vtable, node->left, key, value), ref_node(node->right)); + add_key(vtable, node->left, key, value), ref_node(node->right)); } else { return rebalance(vtable, vtable->copy_key(node->key), vtable->copy_value(node->value), ref_node(node->left), - add(vtable, node->right, key, value)); + add_key(vtable, node->right, key, value)); } } gpr_avl gpr_avl_add(gpr_avl avl, void *key, void *value) { gpr_avl_node *old_root = avl.root; - avl.root = add(avl.vtable, avl.root, key, value); + avl.root = add_key(avl.vtable, avl.root, key, value); assert_invariants(avl.root); unref_node(avl.vtable, old_root); return avl; @@ -247,8 +247,8 @@ static gpr_avl_node *in_order_tail(gpr_avl_node *node) { return node; } -static gpr_avl_node *_remove(const gpr_avl_vtable *vtable, gpr_avl_node *node, - void *key) { +static gpr_avl_node *remove_key(const gpr_avl_vtable *vtable, + gpr_avl_node *node, void *key) { long cmp; if (node == NULL) { return NULL; @@ -263,27 +263,27 @@ static gpr_avl_node *_remove(const gpr_avl_vtable *vtable, gpr_avl_node *node, gpr_avl_node *h = in_order_head(node->right); return rebalance(vtable, vtable->copy_key(h->key), vtable->copy_value(h->value), ref_node(node->left), - _remove(vtable, node->right, h->key)); + remove_key(vtable, node->right, h->key)); } else { gpr_avl_node *h = in_order_tail(node->left); return rebalance( vtable, vtable->copy_key(h->key), vtable->copy_value(h->value), - _remove(vtable, node->left, h->key), ref_node(node->right)); + remove_key(vtable, node->left, h->key), ref_node(node->right)); } } else if (cmp > 0) { - return rebalance(vtable, vtable->copy_key(node->key), - vtable->copy_value(node->value), - _remove(vtable, node->left, key), ref_node(node->right)); + return rebalance( + vtable, vtable->copy_key(node->key), vtable->copy_value(node->value), + remove_key(vtable, node->left, key), ref_node(node->right)); } else { return rebalance(vtable, vtable->copy_key(node->key), vtable->copy_value(node->value), ref_node(node->left), - _remove(vtable, node->right, key)); + remove_key(vtable, node->right, key)); } } gpr_avl gpr_avl_remove(gpr_avl avl, void *key) { gpr_avl_node *old_root = avl.root; - avl.root = _remove(avl.vtable, avl.root, key); + avl.root = remove_key(avl.vtable, avl.root, key); assert_invariants(avl.root); unref_node(avl.vtable, old_root); return avl; From 017b452b7b1256cbaa0ef3cb11f363b51ff1e7c5 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 24 Apr 2017 22:57:59 -0700 Subject: [PATCH 08/12] Use larger block size in proto write --- include/grpc++/impl/codegen/proto_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/grpc++/impl/codegen/proto_utils.h b/include/grpc++/impl/codegen/proto_utils.h index 6df9de4fd22..8c0c32bfc5d 100644 --- a/include/grpc++/impl/codegen/proto_utils.h +++ b/include/grpc++/impl/codegen/proto_utils.h @@ -52,7 +52,7 @@ namespace internal { class GrpcBufferWriterPeer; -const int kGrpcBufferWriterMaxBufferLength = 8192; +const int kGrpcBufferWriterMaxBufferLength = 1024 * 1024; class GrpcBufferWriter final : public ::grpc::protobuf::io::ZeroCopyOutputStream { From e7c31edb555399b699261cb6e0b9f83fb3d6d9d9 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 26 Apr 2017 08:46:44 -0700 Subject: [PATCH 09/12] Print before commenting to ensure theres A copy of the results somewhere --- tools/profiling/microbenchmarks/bm_diff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index 3c15478774e..b2d6f460475 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -248,8 +248,8 @@ def finalize(): text = 'Performance differences noted:\n' + tabulate.tabulate(rows, headers=headers, floatfmt='+.2f') else: text = 'No significant performance differences' - comment_on_pr.comment_on_pr('```\n%s\n```' % text) print text + comment_on_pr.comment_on_pr('```\n%s\n```' % text) eintr_be_gone(finalize) From ffc23ff17fe1ad33206310b4799aec94cfa9cb5e Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Wed, 26 Apr 2017 19:59:07 +0000 Subject: [PATCH 10/12] Drop Python 2.7-only implication --- src/python/grpcio/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/grpcio/README.rst b/src/python/grpcio/README.rst index 3fc318539ea..014a6491dad 100644 --- a/src/python/grpcio/README.rst +++ b/src/python/grpcio/README.rst @@ -6,7 +6,7 @@ Package for gRPC Python. Installation ------------ -gRPC Python is available for Linux, Mac OS X, and Windows running Python 2.7. +gRPC Python is available for Linux, Mac OS X, and Windows. From PyPI ~~~~~~~~~ From b1faf02140890d72c600cebe18cec6329080fbcf Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Wed, 26 Apr 2017 20:07:58 +0000 Subject: [PATCH 11/12] What was once Mac OS X is now called macOS --- src/python/grpcio/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/grpcio/README.rst b/src/python/grpcio/README.rst index 014a6491dad..28a27145682 100644 --- a/src/python/grpcio/README.rst +++ b/src/python/grpcio/README.rst @@ -6,7 +6,7 @@ Package for gRPC Python. Installation ------------ -gRPC Python is available for Linux, Mac OS X, and Windows. +gRPC Python is available for Linux, macOS, and Windows. From PyPI ~~~~~~~~~ From 78e0864d3d89bf71d0aa2f817bad4ce7d3fe488e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 24 Apr 2017 08:14:23 -0700 Subject: [PATCH 12/12] Expand allowable resource quota failures: unavailable seems sane --- test/core/end2end/tests/resource_quota_server.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/core/end2end/tests/resource_quota_server.c b/test/core/end2end/tests/resource_quota_server.c index 2453ca1b89b..6418f5d01ad 100644 --- a/test/core/end2end/tests/resource_quota_server.c +++ b/test/core/end2end/tests/resource_quota_server.c @@ -169,6 +169,7 @@ void resource_quota_server(grpc_end2end_test_config config) { int cancelled_calls_on_client = 0; int cancelled_calls_on_server = 0; int deadline_exceeded = 0; + int unavailable = 0; grpc_byte_buffer *request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); @@ -260,6 +261,9 @@ void resource_quota_server(grpc_end2end_test_config config) { case GRPC_STATUS_DEADLINE_EXCEEDED: deadline_exceeded++; break; + case GRPC_STATUS_UNAVAILABLE: + unavailable++; + break; case GRPC_STATUS_OK: break; default: @@ -358,9 +362,9 @@ void resource_quota_server(grpc_end2end_test_config config) { gpr_log(GPR_INFO, "Done. %d total calls: %d cancelled at server, %d cancelled at " - "client, %d timed out.", + "client, %d timed out, %d unavailable.", NUM_CALLS, cancelled_calls_on_server, cancelled_calls_on_client, - deadline_exceeded); + deadline_exceeded, unavailable); grpc_byte_buffer_destroy(request_payload); grpc_slice_unref(request_payload_slice);