Skip to content

Commit

Permalink
connection: exit with less output on connection loss
Browse files Browse the repository at this point in the history
klog.Fatal dumps information about all running goroutines when the
connection to the CSI driver is lost. Loosing the connection is normal
and depends on the order in which containers are shut down. If it
happens, then the reason is unlikely to be related to goroutines.

Therefore this extra output is not helpful or worse, fills up logfiles
when a sidecar has many goroutines, as in the external-provisioner
which runs 100 workers by default.
  • Loading branch information
pohly authored and ialidzhikov committed May 2, 2022
1 parent 1ddd41d commit 29f418d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion connection/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ func ExitOnConnectionLoss() func() bool {
if err := ioutil.WriteFile(terminationLogPath, []byte(terminationMsg), 0644); err != nil {
klog.Errorf("%s: %s", terminationLogPath, err)
}
klog.Fatalf(terminationMsg)
klog.Exit(terminationMsg)
// Not reached.
return false
}
}
Expand Down

0 comments on commit 29f418d

Please sign in to comment.