{"record":{"id":"f994c6e16e5e7f2f","repo":"jaegertracing/jaeger","slug":"error-starting-cleaner-server-w","errorCode":null,"errorMessage":"error starting cleaner server: %w","messagePattern":"error starting cleaner server: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/jaeger/internal/integration/storagecleaner/extension.go","lineNumber":70,"sourceCode":"\t\tif err := purger.Purge(r.Context()); err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write([]byte(\"Purge request processed successfully\"))\n\t}\n\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(\"POST \"+URL, purgeHandler)\n\tc.server = &http.Server{\n\t\tAddr:              \":\" + c.config.Port,\n\t\tHandler:           mux,\n\t\tReadHeaderTimeout: 3 * time.Second,\n\t}\n\tc.telset.Logger.Info(\"Starting storage cleaner server\", zap.String(\"addr\", c.server.Addr))\n\tgo func() {\n\t\tif err := c.server.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {\n\t\t\terr = fmt.Errorf(\"error starting cleaner server: %w\", err)\n\t\t\tcomponentstatus.ReportStatus(host, componentstatus.NewFatalErrorEvent(err))\n\t\t}\n\t}()\n\n\treturn nil\n}\n\nfunc (c *storageCleaner) Shutdown(ctx context.Context) error {\n\tif c.server != nil {\n\t\tif err := c.server.Shutdown(ctx); err != nil {\n\t\t\treturn fmt.Errorf(\"error shutting down cleaner server: %w\", err)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (*storageCleaner) Dependencies() []component.ID {\n\treturn []component.ID{jaegerstorage.ID}","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/cmd/jaeger/internal/integration/storagecleaner/extension.go#L52-L88","documentation":"The storage-cleaner extension starts an internal HTTP server via c.server.ListenAndServe() in a goroutine to expose the purge endpoint. If ListenAndServe fails for any reason other than a clean shutdown (http.ErrServerClosed), the error is wrapped as 'error starting cleaner server' and reported as a fatal component status event to the OTel host, since the goroutine cannot return an error from Start.","triggerScenarios":"ListenAndServe returns a non-nil, non-ErrServerClosed error: the configured address/port is already in use, the port lacks permissions, or the listener fails at bind time.","commonSituations":"Port conflict with another process or a second jaeger instance using the same cleaner port; running in a container without the port published/bound; invalid bind address (e.g. wrong hostname).","solutions":["Change the storagecleaner extension's server port/address to a free one (check with lsof/netstat for the conflicting listener)","Stop the other process holding the port or configure it to use a different port","Verify the configured address is bindable in your environment (0.0.0.0 vs localhost, container networking)"],"exampleFix":"// before\nextensions:\n  storagecleaner:\n    server:\n      endpoint: localhost:9877\n// after  (port changed because 9877 was in use)\nextensions:\n  storagecleaner:\n    server:\n      endpoint: localhost:9878","handlingStrategy":"validation","validationCode":"// before start, check the port is free\nconn, err := net.Listen(\"tcp\", \"localhost:9877\")\nif err != nil { /* choose another port */ }\nconn.Close()","typeGuard":null,"tryCatchPattern":"// the extension reports a fatal status event; observe it\notelcol.Run returns the fatal error:\nif err := cmd.Execute(); err != nil {\n    if strings.Contains(err.Error(), \"error starting cleaner server\") {\n        log.Fatalf(\"cleaner port in use: %v\", err)\n    }\n}","preventionTips":["Reserve distinct, documented ports for integration extensions","Set the cleaner endpoint to 127.0.0.1 with a high ephemeral port","Check for running jaeger instances before tests"],"tags":["network","http-server","port-conflict"],"backgroundTag":"address-already-in-use","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}