Trident: Trident logs `http: Server closed` as a fatal error when it shutdowns

Created on 1 Jul 2021  路  1Comment  路  Source: NetApp/trident

Describe the bug
Trident logs http: Server closed as a fatal error when it shutdowns.

time="2021-07-01T01:47:30Z" level=fatal msg="http: Server closed"

Tident components call func (*Server) Shutdown, so ErrServerClosed(http: Server closed) is returned in normal cases.

Environment

  • Trident version: 21.04.1
  • Trident installation flags used: silenceAutosupport: true (Trident Operator)
  • Container runtime: Docker 19.03.13
  • Kubernetes version: v1.19.11
  • Kubernetes orchestrator: Kubernetes
  • Kubernetes enabled feature gates:
  • OS: Ubuntu 18.04.5
  • NetApp backend types: ONTAP AFF 9.1P14
  • Other:

To Reproduce

  1. Watch the log of one trident-csi pod

    • e.g. kubectl logs -n trident --since 10s -f trident-csi-xxxx

  2. Delete the trident-csi pod

    • e.g. kubectl delete pod -n trident trident-csi-xxxx

Expected behavior
ErrServerClosed(http: Server closed) should be ignored like below. (ListenAndServe always returns a non-nil error.)

diff --git a/frontend/metrics/plugin.go b/frontend/metrics/plugin.go
index fd1562f..0c2a109 100644
--- a/frontend/metrics/plugin.go
+++ b/frontend/metrics/plugin.go
@@ -38,7 +38,7 @@ func (s *Server) Activate() error {
        go func() {
                log.WithField("address", s.server.Addr).Info("Activating metrics frontend.")
                http.Handle("/metrics", s.server.Handler)
-               if err := s.server.ListenAndServe(); err != nil {
+               if err := s.server.ListenAndServe(); err != http.ErrServerClosed {
                        log.Fatal(err)
                }
        }()
bug tracked

Most helpful comment

This is fixed with commit ddddc0b and will be included in the Trident v21.10 release.

>All comments

This is fixed with commit ddddc0b and will be included in the Trident v21.10 release.

Was this page helpful?
0 / 5 - 0 ratings