diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ea40fec1..07ae88364 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ This document outlines major changes between releases. - Fix marshaling errors in `DeleteObjects` method (#222) - Fix status code in GET/HEAD delete marker (#226) - Fix `NextVersionIDMarker` in `list-object-versions` (#248) +- Fix possibility of panic during SIGHUP (#288) ### Added - Add new `frostfs.buffer_max_size_for_put` config param and sync TZ hash for PUT operations (#197) diff --git a/cmd/s3-gw/service.go b/cmd/s3-gw/service.go index 18aefaeeb..6b8b9937e 100644 --- a/cmd/s3-gw/service.go +++ b/cmd/s3-gw/service.go @@ -34,6 +34,9 @@ func (ms *Service) ShutDown(ctx context.Context) { ms.log.Info(logs.ShuttingDownService, zap.String("endpoint", ms.Addr)) err := ms.Shutdown(ctx) if err != nil { - ms.log.Panic(logs.CantShutDownService) + ms.log.Error(logs.CantGracefullyShutDownService, zap.Error(err)) + if err = ms.Close(); err != nil { + ms.log.Panic(logs.CantShutDownService, zap.Error(err)) + } } } diff --git a/internal/logs/logs.go b/internal/logs/logs.go index 951ba44e0..c3ca1fa7a 100644 --- a/internal/logs/logs.go +++ b/internal/logs/logs.go @@ -12,6 +12,7 @@ const ( ServiceCouldntStartOnConfiguredPort = "service couldn't start on configured port" // Warn in ../../cmd/s3-gw/service.go ServiceHasntStartedSinceItsDisabled = "service hasn't started since it's disabled" // Info in ../../cmd/s3-gw/service.go ShuttingDownService = "shutting down service" // Info in ../../cmd/s3-gw/service.go + CantGracefullyShutDownService = "can't gracefully shut down service, force stop" // Error in ../../cmd/s3-gw/service.go ContainerResolverWillBeDisabled = "container resolver will be disabled because of resolvers 'resolver_order' is empty" // Info in ../../cmd/s3-gw/app.go FailedToInitializeTracing = "failed to initialize tracing" // Warn in ../../cmd/s3-gw/app.go TracingConfigUpdated = "tracing config updated" // Info in ../../cmd/s3-gw/app.go