{"record":{"id":"05a42149ff1d8e4a","repo":"dotnet/runtime","slug":"problem-reading-from-createdump-child-read-pipe","errorCode":null,"errorMessage":"Problem reading from createdump child_read_pipe: %s (%d)\\n","messagePattern":"Problem reading from createdump child_read_pipe: (.+?) \\((.+?)\\)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/coreclr/nativeaot/Runtime/unix/PalCreateDump.cpp","lineNumber":258,"sourceCode":"        {\n            close(pipe_descs[i]);\n        }\n        return false;\n    }\n    else if (childpid == 0)\n    {\n        close(parent_read_pipe);\n        close(parent_write_pipe);\n\n        // Wait for prctl(PR_SET_PTRACER, childpid) in parent\n        char buffer;\n        int bytesRead;\n        while((bytesRead = read(child_read_pipe, &buffer, 1)) < 0 && errno == EINTR);\n        close(child_read_pipe);\n\n        if (bytesRead != 1)\n        {\n            fprintf(stderr, \"Problem reading from createdump child_read_pipe: %s (%d)\\n\", strerror(errno), errno);\n            close(child_write_pipe);\n            exit(-1);\n        }\n\n        // Only dup the child's stderr if there is error buffer\n        if (errorMessageBuffer != nullptr)\n        {\n            dup2(child_write_pipe, STDERR_FILENO);\n        }\n        // Execute the createdump program\n        if (execv(argv[0], (char* const *)argv) == -1)\n        {\n            if (errno == ENOENT)\n            {\n                fprintf(stderr, \"DOTNET_DbgEnableMiniDump is set and the createdump binary does not exist: %s\\n\", argv[0]);\n            }\n            else\n            {","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/coreclr/nativeaot/Runtime/unix/PalCreateDump.cpp#L240-L276","documentation":"In the createdump child process (PalCreateDump.cpp:253-260), after the parent signals readiness via the pipe, the child performs `read(child_read_pipe, &buffer, 1)`. If bytesRead != 1 (the parent did not write the expected single byte — e.g. it died, closed early, or the write failed) the child prints this with the errno and exits. It indicates the parent/child coordination handshake broke down.","triggerScenarios":"The parent process crashing or being killed between fork and the `write(parent_write_pipe,...)`; the parent failing the prctl/ptracer step and closing the pipe; a race where the pipe is closed before the byte is written.","commonSituations":"The crashing process exits before createdump is fully primed; system restrictions on ptrace (Yama LSM) killing the parent; resource exhaustion closing file descriptors.","solutions":["Check the parent-side logs/stderr for the preceding failure (often the prctl or write error).","On Linux, ensure ptrace scope permits the operation (e.g. `/proc/sys/kernel/yama/ptrace_scope`).","Update to a current .NET build where the handshake is hardened.","If reproducible, capture strace of the parent to see why the byte was never written."],"exampleFix":"# before: createdump spawned but parent died / blocked by ptrace_scope=3\n# after: allow ptrace\nsudo sysctl kernel.yama.ptrace_scope=2","handlingStrategy":"retry","validationCode":"// In the parent, ensure the write completes; surface the real failure.\nssize_t w;\ndo { w = write(parent_write_pipe, \"S\", 1); } while (w < 0 && errno == EINTR);\nif (w != 1) { fprintf(stderr, \"parent write to createdump pipe failed: %s\\n\", strerror(errno)); }","typeGuard":null,"tryCatchPattern":"// Around the createdump spawn in the parent; treat EINTR as retry, others as fatal.\nfor (;;) {\n  rc = spawn_createdump(...);\n  if (rc == 0) break;\n  if (errno != EINTR) { log_and_disable_minidump(); break; }\n}","preventionTips":["Relax ptrace_scope if Yama LSM blocks the parent/child ptrace handshake.","Keep .NET updated; the pipe handshake has been hardened over releases.","Capture stderr from the parent alongside createdump to see the originating failure."],"tags":["nativeaot","createdump","pipe","unix","diagnostics"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}