{"record":{"id":"ad3ed6e66e2ee1c3","repo":"netdata/netdata","slug":"cannot-create-spawn-server-ad3ed6","errorCode":null,"errorMessage":"Cannot create spawn server.\n","messagePattern":"Cannot create spawn server\\.\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/collectors/utils/local_listeners.c","lineNumber":267,"sourceCode":"        }\n        else if (strcmp(\"procfile\", s) == 0) {\n            ls.config.procfile = positive;\n            // fprintf(stderr, \"%s procfile\\n\", positive ? \"enabling\" : \"disabling\");\n        }\n        else if (strcmp(\"report\", s) == 0) {\n            ls.config.report = positive;\n            // fprintf(stderr, \"%s report\\n\", positive ? \"enabling\" : \"disabling\");\n        }\n        else {\n            fprintf(stderr, \"Unknown parameter %s\\n\", s);\n            exit(1);\n        }\n    }\n\n#if defined(LOCAL_SOCKETS_USE_SETNS)\n    SPAWN_SERVER *spawn_server = spawn_server_create(SPAWN_SERVER_OPTION_CALLBACK, NULL, local_sockets_spawn_server_callback, argc, (const char **)argv);\n    if(spawn_server == NULL) {\n        fprintf(stderr, \"Cannot create spawn server.\\n\");\n        exit(1);\n    }\n\n    ls.spawn_server = spawn_server;\n#endif\n\n    local_sockets_process(&ls);\n\n#if defined(LOCAL_SOCKETS_USE_SETNS)\n    spawn_server_destroy(spawn_server);\n#endif\n\n    getrusage(RUSAGE_SELF, &ended);\n\n    if(debug) {\n        unsigned long long user   = ended.ru_utime.tv_sec * 1000000ULL + ended.ru_utime.tv_usec - started.ru_utime.tv_sec * 1000000ULL + started.ru_utime.tv_usec;\n        unsigned long long system = ended.ru_stime.tv_sec * 1000000ULL + ended.ru_stime.tv_usec - started.ru_stime.tv_sec * 1000000ULL + started.ru_stime.tv_usec;\n        unsigned long long total  = user + system;","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/netdata/netdata/blob/4864de85e26f6734d92cfc27ccbeff5921f49938/src/collectors/utils/local_listeners.c#L249-L285","documentation":"On builds with LOCAL_SOCKETS_USE_SETNS (Linux with network-namespace support), local_listeners uses a spawn server so worker children can enter other processes' network namespaces via setns(). spawn_server_create() returning NULL means the IPC infrastructure for those callbacks could not be initialized. The tool exits 1 because socket enumeration across namespaces cannot proceed without it.","triggerScenarios":"Building/running on a platform where the spawn server cannot be created: socketpair/pipe allocation failure under heavy fd pressure, a failed fork during server setup, or memory exhaustion. The call passes SPAWN_SERVER_OPTION_CALLBACK with local_sockets_spawn_server_callback plus argc/argv so children re-run the same command line in target namespaces.","commonSituations":"Running under a restrictive sandbox/seccomp profile that blocks the socket/fork primitives the spawn server needs, fd ulimit exhaustion in long-lived wrapper processes, or container runtimes denying namespace-related syscalls.","solutions":["Check errno-producing conditions around process creation: raise 'ulimit -n' if fd exhaustion is plausible.","Run outside restrictive sandboxes (seccomp/container profiles that block socketpair or clone) or grant the needed syscalls.","If namespace traversal is not required, use a build without LOCAL_SOCKETS_USE_SETNS so the spawn server is never created.","Report upstream with strace output if spawn_server_create fails on an unconfined system."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"# detect sandbox restrictions that break the spawn server before running\nif grep -q 'NoNewPrivs:.*yes' /proc/self/status 2>/dev/null; then\n  echo 'no_new_privs active: spawn server may fail' >&2\nfi\nulimit -n  # ensure a sane fd limit for socketpair/fork","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run outside seccomp/no_new_privs sandboxes or grant socketpair/fork syscalls","Raise fd limits in long-lived wrappers","Build without LOCAL_SOCKETS_USE_SETNS when namespace traversal is unnecessary"],"tags":["local-listeners","spawn-server","namespaces","netdata"],"backgroundTag":null,"analyzedSha":"4864de85e26f6734d92cfc27ccbeff5921f49938","analyzedAt":"2026-08-15T09:12:38.226Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}