{"record":{"id":"73dd50ca9e2d1216","repo":"kubernetes/kops","slug":"stop-requested","errorCode":null,"errorMessage":"stop requested","messagePattern":"stop requested","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"dns-controller/pkg/dns/dnscontroller.go","lineNumber":265,"sourceCode":"\t}\n\n\tvar oldValueMap map[recordKey][]string\n\tif c.lastSuccessfulSnapshot != nil {\n\t\toldValueMap = c.lastSuccessfulSnapshot.recordValues\n\t}\n\n\top, err := newDNSOp(c.zoneRules, c.dnsCache)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Store a list of all the errors, so that one bad apple doesn't block every other request\n\tvar errors []error\n\n\t// Check each hostname for changes and apply them\n\tfor k, newValues := range newValueMap {\n\t\tif c.StopRequested() {\n\t\t\treturn fmt.Errorf(\"stop requested\")\n\t\t}\n\t\toldValues := oldValueMap[k]\n\n\t\tif util.StringSlicesEqual(newValues, oldValues) {\n\t\t\tklog.V(4).Infof(\"no change to records for %s\", k)\n\t\t\tcontinue\n\t\t}\n\n\t\tttl := DefaultTTL\n\t\tklog.Infof(\"Using default TTL of %v\", ttl)\n\n\t\tklog.V(4).Infof(\"updating records for %s: %v -> %v\", k, oldValues, newValues)\n\n\t\t// Duplicate records are a hard-error on e.g. Route53\n\t\tvar dedup []string\n\t\tfor _, s := range newValues {\n\t\t\talreadyExists := false\n\t\t\tfor _, e := range dedup {","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/dns-controller/pkg/dns/dnscontroller.go#L247-L283","documentation":"During the DNS-controller's runOnce loop, before updating records for a hostname, it polls c.StopRequested(). If the controller is shutting down (stop channel closed), it aborts immediately instead of applying further updates, returning this sentinel error. It is an intentional cooperative-shutdown signal, not a fault in the DNS provider.","triggerScenarios":"Sentinel/term signal received (c.Stop Signal/stopCh closed) while runOnce is iterating newValueMap; the check fires at the top of each per-hostname iteration before updateRecords.","commonSituations":"kops dns-controller pod receiving SIGTERM during node rotation, cluster teardown, or a kubectl rollout restart; a slow update loop spanning many hostnames is mid-flight when shutdown begins.","solutions":["Treat as expected during shutdown: ensure the watcher/leader loop treats this error as a clean exit rather than crash-looping or alerting.","If it recurs without shutdown, verify nothing is closing the stop channel prematurely (e.g. context cancellation in the caller of Run/watcher).","Reduce loop duration (fewer records per pass) so in-flight passes finish faster before SIGTERM grace expires."],"exampleFix":"// before: treating all errors from runOnce as failures\nif err := runOnce(...); err != nil {\n    klog.Errorf(\"dns update failed: %v\", err)\n}\n// after\nif err := runOnce(...); err != nil {\n    if err.Error() == \"stop requested\" {\n        klog.V(2).Infof(\"dns update aborted: shutdown in progress\")\n        return\n    }\n    klog.Errorf(\"dns update failed: %v\", err)\n}","handlingStrategy":"fallback","validationCode":"// before invoking the watcher, check shutdown state\nselect {\ncase <-stopCh:\n    klog.Infof(\"shutdown already requested; skipping dns runOnce\")\n    return\ndefault:\n}\nrunWatcher(ctx)","typeGuard":null,"tryCatchPattern":"if err := runOnce(...); err != nil {\n    if strings.Contains(err.Error(), \"stop requested\") {\n        return // clean exit, not a failure\n    }\n    klog.Errorf(\"dns update failed: %v\", err)\n}","preventionTips":["Treat 'stop requested' as a terminal, non-retryable condition in any wrapper loops.","Keep runOnce passes short so they finish inside the pod termination grace period.","Do not alert or restart on this error during rollout/teardown."],"tags":["dns-controller","shutdown","graceful-exit","go"],"backgroundTag":"graceful-shutdown-abort","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}