{"record":{"id":"172e089ea7ed3255","repo":"coredns/coredns","slug":"num-sockets-exceeds-maximum-d-d","errorCode":null,"errorMessage":"num sockets exceeds maximum (%d): %d","messagePattern":"num sockets exceeds maximum \\((.+?)\\): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/multisocket/multisocket.go","lineNumber":50,"sourceCode":"\tif len(args) > 1 || c.Next() {\n\t\treturn c.ArgErr()\n\t}\n\n\tif len(args) == 0 {\n\t\t// Nothing specified; use default that is equal to GOMAXPROCS.\n\t\tconfig.NumSockets = runtime.GOMAXPROCS(0)\n\t\treturn nil\n\t}\n\n\tnumSockets, err := strconv.Atoi(args[0])\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid num sockets: %w\", err)\n\t}\n\tif numSockets < 1 {\n\t\treturn fmt.Errorf(\"num sockets can not be zero or negative: %d\", numSockets)\n\t}\n\tif numSockets > maxNumSockets {\n\t\treturn fmt.Errorf(\"num sockets exceeds maximum (%d): %d\", maxNumSockets, numSockets)\n\t}\n\tconfig.NumSockets = numSockets\n\n\treturn nil\n}\n","sourceCodeStart":32,"sourceCodeEnd":56,"githubUrl":"https://github.com/coredns/coredns/blob/558c9757a92b361e550bdba82d0b4ddf3d12d595/plugin/multisocket/multisocket.go#L32-L56","documentation":"multisocket caps the number of sockets at maxNumSockets to prevent file-descriptor exhaustion and unbounded resource use. parseNumSockets returns this error when the Corefile argument exceeds that maximum during setup.","triggerScenarios":"Corefile contains e.g. `multisocket 512` where 512 > maxNumSockets, so setup aborts CoreDNS startup.","commonSituations":"Over-tuning on machines with many CPUs; copying a config from a host with a higher compiled max; misunderstanding the plugin's cap.","solutions":["Lower the value to at or below maxNumSockets (see plugin/multisocket/multisocket.go for the constant)","Remove the directive to use the GOMAXPROCS default","Rebuild CoreDNS with a larger maxNumSockets constant if you genuinely need more sockets","Verify ulimit -n allows the number of sockets you intend to open"],"exampleFix":"// before\nmultisocket 512\n// after\nmultisocket 64","handlingStrategy":"validation","validationCode":"const maxNumSockets = <check plugin source>; n, _ := strconv.Atoi(value); if n > maxNumSockets { n = maxNumSockets }","typeGuard":null,"tryCatchPattern":"if err := setup(...); err != nil && strings.Contains(err.Error(), \"exceeds maximum\") { /* reduce the value or rebuild with a larger cap */ }","preventionTips":["Check maxNumSockets in the plugin source before choosing large values","Verify ulimit -n supports the intended socket count","Keep multisocket values at or near GOMAXPROCS"],"tags":["coredns","corefile","config","limits"],"backgroundTag":"value-out-of-range","analyzedSha":"558c9757a92b361e550bdba82d0b4ddf3d12d595","analyzedAt":"2026-09-06T22:47:02.106Z","contentChangedAt":"2026-09-06T22:47:02.106Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}