From 1dc7685c55e8b4a1a9d03f981ea4eed91ce7d045 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 19 Aug 2022 13:32:32 -0700 Subject: [PATCH] [fixit] More max_connection_idle fixes (#30639) * [fixit] More max_connection_idle fixes - handle the case that the idle timeout occurs between the connection becoming ready and the request being made (by making the request WAIT_FOR_READY to reconnect if needed) - fix up the math for cq verification: the MAX_CONNECTION_IDLE_MS is an unscaled timeout, whereas the 3000 ms is scaled, so we cannot directly add them and scale * Automated change: Fix sanity tests Co-authored-by: ctiller --- test/core/end2end/tests/max_connection_idle.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/core/end2end/tests/max_connection_idle.cc b/test/core/end2end/tests/max_connection_idle.cc index 1f5dc82f728..425f404ccc7 100644 --- a/test/core/end2end/tests/max_connection_idle.cc +++ b/test/core/end2end/tests/max_connection_idle.cc @@ -27,6 +27,7 @@ #include #include #include +#include #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gpr/useful.h" @@ -84,7 +85,8 @@ static void simple_request_body(grpc_end2end_test_config /*config*/, op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; - op->flags = 0; + op->flags = GRPC_INITIAL_METADATA_WAIT_FOR_READY | + GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET; op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; @@ -210,7 +212,8 @@ static void test_max_connection_idle(grpc_end2end_test_config config) { /* wait for the channel to reach its maximum idle time */ grpc_channel_watch_connectivity_state( f.client, GRPC_CHANNEL_READY, - grpc_timeout_milliseconds_to_deadline(MAX_CONNECTION_IDLE_MS + 3000), + gpr_time_add(grpc_timeout_milliseconds_to_deadline(3000), + gpr_time_from_millis(MAX_CONNECTION_IDLE_MS, GPR_TIMESPAN)), f.cq, tag(99)); cqv.Expect(tag(99), true); cqv.Verify();