Skip to content

Commit

Permalink
TUN-8374: Close UDP socket if registration fails
Browse files Browse the repository at this point in the history
If cloudflared was unable to register the UDP session with the
edge, the socket would be left open to be eventually closed by the
OS, or garbage collected by the runtime. Considering that either of
these closes happened significantly after some delay, it was causing
cloudflared to hold open file descriptors longer than usual if continuously
unable to register sessions.
  • Loading branch information
DevinCarr committed Apr 22, 2024
1 parent 8483301 commit 1b02d16
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions connection/quic.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ func (q *QUICConnection) RegisterUdpSession(ctx context.Context, sessionID uuid.

session, err := q.sessionManager.RegisterSession(ctx, sessionID, originProxy)
if err != nil {
originProxy.Close()
log.Err(err).Str("sessionID", sessionID.String()).Msgf("Failed to register udp session")
tracing.EndWithErrorStatus(registerSpan, err)
return nil, err
Expand Down

0 comments on commit 1b02d16

Please sign in to comment.