From 673e4407700b90c5ecbbcec5e06fec07fc1149b1 Mon Sep 17 00:00:00 2001 From: Rafael Zalamena Date: Mon, 21 Feb 2022 06:28:11 -0500 Subject: [PATCH] lib: tweak northbound gRPC default timeout Don't let open sockets hang for too long. This will fix an issue where a improperly coded client (e.g. socat) could exaust the amount of open file descriptors. Documentation: https://grpc.github.io/grpc/cpp/md_doc_keepalive.html Signed-off-by: Rafael Zalamena --- lib/northbound_grpc.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/northbound_grpc.cpp b/lib/northbound_grpc.cpp index e227d0385c..ecab732e92 100644 --- a/lib/northbound_grpc.cpp +++ b/lib/northbound_grpc.cpp @@ -1264,6 +1264,8 @@ static void *grpc_pthread_start(void *arg) builder.AddListeningPort(server_address.str(), grpc::InsecureServerCredentials()); builder.RegisterService(service); + builder.AddChannelArgument( + GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS, 5000); auto cq = builder.AddCompletionQueue(); s_cq = cq.get(); s_server = builder.BuildAndStart();