{"record":{"id":"c3e4a8cd85cd2910","repo":"prometheus/node_exporter","slug":"unable-to-retrieve-limit-number-of-maximum-pids-al","errorCode":null,"errorMessage":"unable to retrieve limit number of maximum pids allowed: %w","messagePattern":"unable to retrieve limit number of maximum pids allowed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/processes_linux.go","lineNumber":108,"sourceCode":"\n\tch <- prometheus.MustNewConstMetric(c.threadAlloc, prometheus.GaugeValue, float64(threads))\n\tmaxThreads, err := readUintFromFile(procFilePath(\"sys/kernel/threads-max\"))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to retrieve limit number of threads: %w\", err)\n\t}\n\tch <- prometheus.MustNewConstMetric(c.threadLimit, prometheus.GaugeValue, float64(maxThreads))\n\n\tfor state := range states {\n\t\tch <- prometheus.MustNewConstMetric(c.procsState, prometheus.GaugeValue, float64(states[state]), state)\n\t}\n\n\tfor state := range threadStates {\n\t\tch <- prometheus.MustNewConstMetric(c.threadsState, prometheus.GaugeValue, float64(threadStates[state]), state)\n\t}\n\n\tpidM, err := readUintFromFile(procFilePath(\"sys/kernel/pid_max\"))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to retrieve limit number of maximum pids allowed: %w\", err)\n\t}\n\tch <- prometheus.MustNewConstMetric(c.pidUsed, prometheus.GaugeValue, float64(pids))\n\tch <- prometheus.MustNewConstMetric(c.pidMax, prometheus.GaugeValue, float64(pidM))\n\n\treturn nil\n}\n\nfunc (c *processCollector) getAllocatedThreads() (int, map[string]int32, int, map[string]int32, error) {\n\tp, err := c.fs.AllProcs()\n\tif err != nil {\n\t\treturn 0, nil, 0, nil, fmt.Errorf(\"unable to list all processes: %w\", err)\n\t}\n\tpids := 0\n\tthread := 0\n\tprocStates := make(map[string]int32)\n\tthreadStates := make(map[string]int32)\n\n\tfor _, pid := range p {","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/processes_linux.go#L90-L126","documentation":"Update reads /proc/sys/kernel/pid_max via readUintFromFile to expose node_processes_pids and node_processes_max_pids. This error means /proc/sys/kernel/pid_max could not be read or parsed as an unsigned integer during a scrape.","triggerScenarios":"readUintFromFile(procFilePath(\"sys/kernel/pid_max\")) fails because the file is absent, permission-denied, or contains non-numeric content.","commonSituations":"Container runtimes that mask /proc/sys/kernel/pid_max; hardened images where proc sysctls are not world-readable; running node_exporter inside a user namespace with restricted procfs visibility.","solutions":["Check readability: cat /proc/sys/kernel/pid_max as the exporter's user.","Unmask /proc/sys/kernel/pid_max in your container spec if a runtime is masking it.","Grant the exporter user read access to proc sysctls (or run as root).","Confirm the exporter is actually running on Linux against a real procfs (not a truncated fixture mount)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before scraping, as the exporter user\nif _, err := os.ReadFile(\"/proc/sys/kernel/pid_max\"); err != nil {\n    log.Printf(\"pid_max sysctl unreadable: %v\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := c.Update(ch); err != nil {\n    if strings.Contains(err.Error(), \"maximum pids allowed\") {\n        log.Printf(\"pid_max unavailable in this environment: %v\", err)\n    }\n}","preventionTips":["Verify pid_max readability for the exporter user in each deployment environment.","Unmask /proc/sys/kernel/pid_max in container runtime configurations.","Re-test after security policy changes (SELinux/AppArmor/seccomp updates).","Run smoke scrapes as part of deployment health checks."],"tags":["linux","procfs","sysctl","pids","node-exporter"],"backgroundTag":"file-read-failed","analyzedSha":"17ddd77c59ba27e1508e9f7894b1e55b44d6aed3","analyzedAt":"2026-09-07T17:54:06.211Z","contentChangedAt":"2026-09-07T17:54:06.211Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}