TUN-8621: Prevent QUIC connection from closing before grace period after unregistering

Whenever cloudflared receives a SIGTERM or SIGINT it goes into graceful shutdown mode, which unregisters the connection and closes the control stream. Unregistering makes it so we no longer receive any new requests and makes the edge close the connection, allowing in-flight requests to finish (within a 3 minute period).
 This was working fine for http2 connections, but the quic proxy was cancelling the context as soon as the controls stream ended, forcing the process to stop immediately.

 This commit changes the behavior so that we wait the full grace period before cancelling the request
This commit is contained in:
GoncaloGarcia
2024-08-30 12:51:20 +01:00
committed by chungthuang
parent 05249c7b51
commit e251a21810
8 changed files with 53 additions and 16 deletions

View File

@@ -604,6 +604,7 @@ func (e *EdgeTunnelServer) serveQUIC(
e.config.PacketConfig,
e.config.RPCTimeout,
e.config.WriteStreamTimeout,
e.config.GracePeriod,
)
if err != nil {
connLogger.ConnAwareLogger().Err(err).Msgf("Failed to create new quic connection")