From abd9d53a9f9ebe8eebfbca6e45fa9a18b466a8a8 Mon Sep 17 00:00:00 2001 From: yang-g Date: Tue, 6 Mar 2018 16:41:35 -0800 Subject: [PATCH 1/2] Only increase strike once --- src/core/ext/transport/chttp2/transport/chttp2_transport.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index df3fb8c68c1..56aaada9127 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -1711,7 +1711,6 @@ static void send_goaway(grpc_chttp2_transport* t, grpc_error* error) { } void grpc_chttp2_add_ping_strike(grpc_chttp2_transport* t) { - t->ping_recv_state.ping_strikes++; if (++t->ping_recv_state.ping_strikes > t->ping_policy.max_ping_strikes && t->ping_policy.max_ping_strikes != 0) { send_goaway(t, From 4a15f4016e840517d560427e656077f61103867f Mon Sep 17 00:00:00 2001 From: yang-g Date: Wed, 7 Mar 2018 12:23:16 -0800 Subject: [PATCH 2/2] Fix test --- test/core/end2end/tests/bad_ping.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/core/end2end/tests/bad_ping.cc b/test/core/end2end/tests/bad_ping.cc index f305ea57032..95f72ca4c85 100644 --- a/test/core/end2end/tests/bad_ping.cc +++ b/test/core/end2end/tests/bad_ping.cc @@ -155,14 +155,15 @@ static void test_bad_ping(grpc_end2end_test_config config) { cq_verify(cqv); // Send too many pings to the server to trigger the punishment: - // Each ping will trigger a ping strike, and we need at least MAX_PING_STRIKES - // strikes to trigger the punishment. So (MAX_PING_STRIKES + 1) pings are + // The first ping will let server mark its last_recv time. Afterwards, each + // ping will trigger a ping strike, and we need at least MAX_PING_STRIKES + // strikes to trigger the punishment. So (MAX_PING_STRIKES + 2) pings are // needed here. int i; - for (i = 1; i <= MAX_PING_STRIKES + 1; i++) { + for (i = 1; i <= MAX_PING_STRIKES + 2; i++) { grpc_channel_ping(f.client, f.cq, tag(200 + i), nullptr); CQ_EXPECT_COMPLETION(cqv, tag(200 + i), 1); - if (i == MAX_PING_STRIKES + 1) { + if (i == MAX_PING_STRIKES + 2) { CQ_EXPECT_COMPLETION(cqv, tag(1), 1); } cq_verify(cqv);