{"record":{"id":"9259436de4fab075","repo":"dotnet/runtime","slug":"problem-writing-to-createdump-parent-write-pipe-925943","errorCode":null,"errorMessage":"Problem writing to createdump parent_write_pipe: %s (%d)\\n","messagePattern":"Problem writing to createdump parent_write_pipe: (.+?) \\((.+?)\\)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/coreclr/pal/src/thread/process.cpp","lineNumber":1585,"sourceCode":"        close(child_read_pipe);\n        close(child_write_pipe);\n#if HAVE_PRCTL_H && HAVE_PR_SET_PTRACER\n        // Gives the child process permission to use /proc/<pid>/mem and ptrace\n        if (prctl(PR_SET_PTRACER, childpid, 0, 0, 0) == -1)\n        {\n            // Ignore any error because on some CentOS and OpenSUSE distros, it isn't\n            // supported but createdump works just fine.\n            ERROR(\"PROCCreateCrashDump: prctl() FAILED %s (%d)\\n\", strerror(errno), errno);\n        }\n#endif // HAVE_PRCTL_H && HAVE_PR_SET_PTRACER\n        // Signal child that prctl(PR_SET_PTRACER, childpid) is done\n        int bytesWritten;\n        while((bytesWritten = write(parent_write_pipe, \"S\", 1)) < 0 && errno == EINTR);\n        close(parent_write_pipe);\n\n        if (bytesWritten != 1)\n        {\n            fprintf(stderr, \"Problem writing to createdump parent_write_pipe: %s (%d)\\n\", strerror(errno), errno);\n            close(parent_read_pipe);\n            if (errorMessageBuffer != nullptr)\n            {\n                errorMessageBuffer[0] = 0;\n            }\n            return false;\n        }\n\n        // Read createdump's stderr messages (if any)\n        if (errorMessageBuffer != nullptr)\n        {\n            // Read createdump's stderr\n            int bytesRead = 0;\n            int count = 0;\n            while ((count = read(parent_read_pipe, errorMessageBuffer + bytesRead, cbErrorMessageBuffer - bytesRead)) > 0)\n            {\n                bytesRead += count;\n            }","sourceCodeStart":1567,"sourceCodeEnd":1603,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/coreclr/pal/src/thread/process.cpp#L1567-L1603","documentation":"Emitted by the CoreCLR parent process in PROCLaunchCreateDump (process.cpp:1585). After prctl(PR_SET_PTRACER, childpid) the parent writes one 'S' byte to parent_write_pipe (retried on EINTR only); if the written count is not 1 the parent prints this, clears errorMessageBuffer, closes parent_read_pipe and returns false, aborting dump capture. As with error 241 the typical cause is EPIPE: the child already closed its read end (e.g. it hit error 243 and exit(-1)) before the parent wrote.","triggerScenarios":"Full CoreCLR runtime crash-dump path: the forked child died or closed child_read_pipe before the parent's write(parent_write_pipe,'S',1) at line 1580 completed, so write() returns -1/EPIPE (or 0). The subsequent bytesWritten != 1 check at line 1583 trips this message.","commonSituations":"Child exited first via the 'Problem reading from createdump child_read_pipe' branch (parent died in prctl, was OOM-killed, or pipe broken); signal storm interrupting the parent before the write; fd exhaustion; a SIGCHLD reaper racing the handshake; PR_SET_PTRACER failure cascading into the child giving up.","solutions":["Turn on verbose createdump logging (DOTNET_CreateDumpDiagnostics=1 DOTNET_CreateDumpVerboseDiagnostics=1) and look for the child's preceding 'Problem reading ... child_read_pipe' message — that is the real cause.","Rule out external termination of the parent during the handshake (OOM killer, container reaper): check `dmesg -T` and the container runtime events.","Raise fd and memory limits on the crash path (ulimit -n, cgroup memory).","Verify kernel ptrace policy is not blocking the parent's prctl step: read /proc/sys/kernel/yama/ptrace_scope and relax if needed.","If dumps remain unreliable, switch to kernel core_pattern-based capture so no parent/child pipe handshake is required."],"exampleFix":"# before\n$ DOTNET_DbgEnableMiniDump=1 ./app\n# Problem writing to createdump parent_write_pipe: Broken pipe (32)\n\n# after: surface the root cause and relax constraints\n$ DOTNET_DbgEnableMiniDump=1 \\\n  DOTNET_CreateDumpDiagnostics=1 DOTNET_CreateDumpVerboseDiagnostics=1 \\\n  ./app\n$ cat /proc/sys/kernel/yama/ptrace_scope   # if 2/3, set to 0/1","handlingStrategy":"validation","validationCode":"# Same preconditions as the child-read failure: ensure parent survives to the signal write.\ncat /proc/sys/kernel/yama/ptrace_scope 2>/dev/null | grep -Eq '^[01]$' || echo \"WARN: relax ptrace_scope so parent completes prctl\"\n[ \"$(ulimit -n)\" -ge 1024 ] || ulimit -n 65536\n# Smoke-test the dump path verbosely once:\nDOTNET_DbgEnableMiniDump=1 DOTNET_CreateDumpVerboseDiagnostics=1 \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enable verbose createdump diagnostics to reveal the upstream child_read_pipe failure that causes the broken-pipe write.","Prevent external kills (OOM, reapers) during crash handling via adequate cgroup memory and no PID-1 reaper.","Relax ptrace_scope so the parent's PR_SET_PTRACER step succeeds before the write.","Raise fd limits; the handshake needs four pipe fds.","Treat kernel core_pattern as the production dump mechanism."],"tags":["dotnet","coreclr","pal","createdump","crash-dump","pipe","diagnostics","linux"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}