{"record":{"id":"3ef00e7b1c9a4163","repo":"dotnet/runtime","slug":"problem-waiting-for-createdump-waitpid-failed-r-3ef00e","errorCode":null,"errorMessage":"Problem waiting for createdump: waitpid() FAILED result %d wstatus %08x errno %s (%d)\\n","messagePattern":"Problem waiting for createdump: waitpid\\(\\) FAILED result (.+?) wstatus %08x errno (.+?) \\((.+?)\\)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/coreclr/pal/src/thread/process.cpp","lineNumber":1617,"sourceCode":"            int count = 0;\n            while ((count = read(parent_read_pipe, errorMessageBuffer + bytesRead, cbErrorMessageBuffer - bytesRead)) > 0)\n            {\n                bytesRead += count;\n            }\n            errorMessageBuffer[bytesRead] = 0;\n            if (bytesRead > 0)\n            {\n                fputs(errorMessageBuffer, stderr);\n            }\n        }\n        close(parent_read_pipe);\n\n        // Parent waits until the child process is done\n        int wstatus = 0;\n        int result = waitpid(childpid, &wstatus, 0);\n        if (result != childpid)\n        {\n            fprintf(stderr, \"Problem waiting for createdump: waitpid() FAILED result %d wstatus %08x errno %s (%d)\\n\",\n                result, wstatus, strerror(errno), errno);\n            return false;\n        }\n        else\n        {\n#ifdef _DEBUG\n            fprintf(stderr, \"waitpid() returned successfully (wstatus %08x) WEXITSTATUS %x WTERMSIG %x\\n\", wstatus, WEXITSTATUS(wstatus), WTERMSIG(wstatus));\n#endif\n            return !WIFEXITED(wstatus) || WEXITSTATUS(wstatus) == 0;\n        }\n    }\n    return true;\n#endif // !TARGET_IOS && !TARGET_TVOS && !TARGET_WASM\n}\n\n/*++\nFunction:\n  PROCCreateCrashDump","sourceCodeStart":1599,"sourceCodeEnd":1635,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/coreclr/pal/src/thread/process.cpp#L1599-L1635","documentation":"Emitted by the CoreCLR parent in PROCLaunchCreateDump (process.cpp:1617) when waitpid(childpid, &wstatus, 0) returns a value other than childpid. Like its NativeAOT sibling (error 242) the call is not retried on EINTR, so a single interruption or an already-reaped child yields this message and a false return even though createdump may have completed successfully. ECHILD (no child to wait for) is the dominant real-world cause.","triggerScenarios":"Full CoreCLR crash-dump parent reaches waitpid but the createdump child was already reaped (ECHILD) or waitpid was interrupted (EINTR, not retried). result != childpid at line 1615 trips the fprintf and returns false.","commonSituations":"Container/PID-1 reapers (docker --init, tini, dumb-init, systemd) reaping the createdump child; a native dependency's global SIGCHLD handler calling wait(); heavy signal load causing EINTR; process running under a tracer that intercepts child exits.","solutions":["Stop a PID-1 reaper from claiming the createdump child: drop --init from docker, or use a reaper that only harvests orphans.","Move dump capture to the kernel core_pattern so waitpid is the kernel's responsibility: `echo '|/usr/share/dotnet/createdump %p %e' > /proc/sys/kernel/core_pattern`.","Identify and neutralize any global SIGCHLD waiter installed by a loaded native library.","Confirm whether createdump actually finished despite the waitpid error by enabling DOTNET_CreateDumpVerboseDiagnostics=1 and checking for the output dump file.","Where the environment makes reliable waitpid impossible, treat OS-level coredumps as the source of truth."],"exampleFix":"# before: --init installs tini which reaps the createdump child\n$ docker run --init myapp   # waitpid() FAILED ECHILD\n\n# after: no reaper, or kernel-driven core_pattern\n$ docker run myapp\n$ echo '|/usr/share/dotnet/createdump %p %e' > /proc/sys/kernel/core_pattern\n$ ulimit -c unlimited && ./app","handlingStrategy":"validation","validationCode":"# Detect environmental causes of waitpid failure before relying on in-process minidumps.\nps -o pid,comm -p 1 | grep -Eqi 'tini|dumb-init|init|systemd' && echo \"WARN: PID 1 reaper may break waitpid\"\nif [ -w /proc/sys/kernel/core_pattern ]; then\n  echo '|/usr/share/dotnet/createdump %p %e' > /proc/sys/kernel/core_pattern\n  ulimit -c unlimited\nelse\n  echo \"core_pattern not writable; in-process dumps may be unreliable here\"\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not combine docker --init (or any PID-1 reaper) with DOTNET_DbgEnableMiniDump.","Drive createdump from /proc/sys/kernel/core_pattern so waitpid is the kernel's job.","Confirm dumps were actually produced (ls *.dmp); a waitpid false-negative can hide a successful run.","Avoid native dependencies that install global SIGCHLD reapers."],"tags":["dotnet","coreclr","pal","createdump","crash-dump","waitpid","linux","diagnostics"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}