Skip to content

we can replace most exit calls with returns #3352

Description

@butonic

As pointed out by #3344 (comment) and a quick grep:

❯ grep -r -B2 'os.Exit(1)' . | grep -B2 server.go | grep -v vendor
--
--
--
--
--
./pkg/log/log.go:                       os.Exit(1)
--
./services/antivirus/pkg/command/server.go-                             if err != nil {
./services/antivirus/pkg/command/server.go-                                     logger.Error().Err(err).Str("server", "antivirus").Msg("Failed to initialize antivirus service")
./services/antivirus/pkg/command/server.go:                                     os.Exit(1)
--
./services/storage-users/pkg/command/uploads.go:                                                os.Exit(1)
--
./services/postprocessing/pkg/command/server.go-                        if err != nil {
./services/postprocessing/pkg/command/server.go-                                fmt.Printf("%v", err)
./services/postprocessing/pkg/command/server.go:                                os.Exit(1)
--
./services/proxy/pkg/server/http/server.go-                     if err := pkgcrypto.GenCert(httpCfg.TLSCert, httpCfg.TLSKey, l); err != nil {
./services/proxy/pkg/server/http/server.go-                             l.Fatal().Err(err).Msgf("Could not generate test-certificate")
./services/proxy/pkg/server/http/server.go:                             os.Exit(1)
--
./services/idp/pkg/server/http/server.go-                       if err := pkgcrypto.GenCert(options.Config.HTTP.TLSCert, options.Config.HTTP.TLSKey, options.Logger); err != nil {
./services/idp/pkg/server/http/server.go-                               options.Logger.Fatal().Err(err).Msg("Could not setup TLS")
./services/idp/pkg/server/http/server.go:                               os.Exit(1)

We are still making calls to exit in error cases.

This might corrupt the nats index and sucks in general, because other goroutines used for services and workers have no way to shut down properly.

Since #3140 you can simply return the error

Activity

  1. added theissue type on Aug 19, 2026
  2. rhafer commented on Aug 19, 2026

    @rhafer
    Member

    Here's another one that we should address:

    pps.log.Fatal().Err(err).Msg("fatal error - exiting")

  3. self-assigned this
    on Oct 14, 2026
  4. moved this from Qualification to In Progress in OpenCloud Team Boardon Oct 14, 2026
  5. removed their assignment
    on Oct 19, 2026
  6. moved this from In Progress to Qualification in OpenCloud Team Boardon Oct 19, 2026
  7. moved this from Qualification to Todo in OpenCloud Team Boardon Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions