From 604a7ca07b7aeb5ecff210ab4e854526c78ae863 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 22 Sep 2017 09:28:32 -0700 Subject: [PATCH 1/2] Reduce stack size of simple_request e2e test --- test/core/end2end/tests/simple_request.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index 82ab0a1cfeb..7ba5bd8f469 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -103,10 +103,10 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_slice details; int was_cancelled = 2; char *peer; - grpc_stats_data before; - grpc_stats_data after; + grpc_stats_data *before = gpr_malloc(sizeof(grpc_stats_data)); + grpc_stats_data *after = gpr_malloc(sizeof(grpc_stats_data)); - grpc_stats_collect(&before); + grpc_stats_collect(before); gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( @@ -214,9 +214,9 @@ static void simple_request_body(grpc_end2end_test_config config, cq_verifier_destroy(cqv); - grpc_stats_collect(&after); + grpc_stats_collect(after); - char *stats = grpc_stats_data_as_json(&after); + char *stats = grpc_stats_data_as_json(after); gpr_log(GPR_DEBUG, "%s", stats); gpr_free(stats); @@ -224,11 +224,11 @@ static void simple_request_body(grpc_end2end_test_config config, if (config.feature_mask & FEATURE_MASK_SUPPORTS_REQUEST_PROXYING) { expected_calls *= 2; } - GPR_ASSERT(after.counters[GRPC_STATS_COUNTER_CLIENT_CALLS_CREATED] - - before.counters[GRPC_STATS_COUNTER_CLIENT_CALLS_CREATED] == + GPR_ASSERT(after->counters[GRPC_STATS_COUNTER_CLIENT_CALLS_CREATED] - + before->counters[GRPC_STATS_COUNTER_CLIENT_CALLS_CREATED] == expected_calls); - GPR_ASSERT(after.counters[GRPC_STATS_COUNTER_SERVER_CALLS_CREATED] - - before.counters[GRPC_STATS_COUNTER_SERVER_CALLS_CREATED] == + GPR_ASSERT(after->counters[GRPC_STATS_COUNTER_SERVER_CALLS_CREATED] - + before->counters[GRPC_STATS_COUNTER_SERVER_CALLS_CREATED] == expected_calls); } From 3c5203886838d08f74f20a66d9d00af23f415644 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 22 Sep 2017 09:31:03 -0700 Subject: [PATCH 2/2] Fix memory leak --- test/core/end2end/tests/simple_request.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index 7ba5bd8f469..7ce7e1f2855 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -230,6 +230,8 @@ static void simple_request_body(grpc_end2end_test_config config, GPR_ASSERT(after->counters[GRPC_STATS_COUNTER_SERVER_CALLS_CREATED] - before->counters[GRPC_STATS_COUNTER_SERVER_CALLS_CREATED] == expected_calls); + gpr_free(before); + gpr_free(after); } static void test_invoke_simple_request(grpc_end2end_test_config config) {