From 460b0533b2c0da74f5eaf7b57576752e7da8a1a5 Mon Sep 17 00:00:00 2001 From: Wei Fu Date: Sat, 13 Aug 2022 17:19:05 +0800 Subject: [PATCH] pkg/cri/streaming: increase ReadHeaderTimeout It is follow-up of #7254. This commit will increase ReadHeaderTimeout from 3s to 30m, which prevent from unexpected timeout when the node is running with high-load. 30 Minutes is longer enough to get close to before what #7254 changes. And ideally, we should allow user to configure the streaming server if the users want this feature. Signed-off-by: Wei Fu --- pkg/cri/streaming/server.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/cri/streaming/server.go b/pkg/cri/streaming/server.go index 346dfb2c7..cc598562c 100644 --- a/pkg/cri/streaming/server.go +++ b/pkg/cri/streaming/server.go @@ -162,10 +162,11 @@ func NewServer(config Config, runtime Runtime) (Server, error) { handler.Add(ws) s.handler = handler s.server = &http.Server{ - Addr: s.config.Addr, - Handler: s.handler, - TLSConfig: s.config.TLSConfig, - ReadHeaderTimeout: 3 * time.Second, // Fix linter G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server + Addr: s.config.Addr, + Handler: s.handler, + TLSConfig: s.config.TLSConfig, + // TODO(fuweid): allow user to configure streaming server + ReadHeaderTimeout: 30 * time.Minute, // Fix linter G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server } return s, nil