{"record":{"id":"cfe1bac67ed335e6","repo":"crowdsecurity/crowdsec","slug":"connection-aborted-shutting-down-docker-watcher","errorCode":null,"errorMessage":"connection aborted, shutting down docker watcher","messagePattern":"connection aborted, shutting down docker watcher","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/docker/run.go","lineNumber":386,"sourceCode":"\tcase err := <-result.Err:\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"docker events connection failed: %w\", err)\n\t\t}\n\tdefault:\n\t}\n\n\treturn &subscription{events: result.Messages, errs: result.Err}, nil\n}\n\n// subscribeEvents will loop until it can successfully call d.Client.Events()\n// without immediately receiving an error. It applies exponential backoff on failures.\n// Returns the new (eventsChan, errChan) pair or an error if context/tomb is done.\nfunc (d *Source) subscribeEvents(ctx context.Context) (*subscription, error) {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn nil, ctx.Err()\n\tcase <-d.t.Dying():\n\t\treturn nil, errors.New(\"connection aborted, shutting down docker watcher\")\n\tdefault:\n\t}\n\n\td.logger.Infof(\"Subscribing to Docker events\")\n\n\toperation := func() (*subscription, error) {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil, backoff.Permanent(ctx.Err())\n\t\tcase <-d.t.Dying():\n\t\t\treturn nil, backoff.Permanent(errors.New(\"connection aborted, shutting down docker watcher\"))\n\t\tdefault:\n\t\t}\n\n\t\treturn d.trySubscribeEvents(ctx)\n\t}\n\n\tnotify := func(err error, wait time.Duration) {","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/docker/run.go#L368-L404","documentation":"Raised from subscribeEvents (called by Watch) in the docker datasource: the connection to the docker daemon's events stream was aborted and the watcher is shutting down. subscribeEvents normally retries Events() with exponential backoff on failures; reaching this error means the retry loop gave up — the context/tomb is done or the daemon is unreachable for good, so the docker watcher terminates rather than spinning forever.","triggerScenarios":"Thrown at pkg/acquisition/modules/docker/run.go:386 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check docker daemon availability and socket permissions (docker_host / DOCKER_HOST)","Inspect crowdsec logs for the preceding backoff errors to find the root cause (socket gone, daemon restart, permission denied)","If the daemon restarts frequently, ensure the socket path is stable or use the TCP endpoint with proper TLS"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}