Skip to content

Commit

Permalink
pkg/cri/streaming: increase ReadHeaderTimeout
Browse files Browse the repository at this point in the history
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 <fuweid89@gmail.com>
(cherry picked from commit 460b053)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
fuweid authored and thaJeztah committed Mar 7, 2023
1 parent 45f055d commit efb88a8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/cri/streaming/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit efb88a8

Please sign in to comment.