dotnet/runtime · error

Problem waiting for createdump: waitpid() FAILED result %d w

Error message

Problem waiting for createdump: waitpid() FAILED result %d wstatus %08x errno %s (%d)\n

What it means

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.

Source

Thrown at src/coreclr/pal/src/thread/process.cpp:1617

            int count = 0;
            while ((count = read(parent_read_pipe, errorMessageBuffer + bytesRead, cbErrorMessageBuffer - bytesRead)) > 0)
            {
                bytesRead += count;
            }
            errorMessageBuffer[bytesRead] = 0;
            if (bytesRead > 0)
            {
                fputs(errorMessageBuffer, stderr);
            }
        }
        close(parent_read_pipe);

        // Parent waits until the child process is done
        int wstatus = 0;
        int result = waitpid(childpid, &wstatus, 0);
        if (result != childpid)
        {
            fprintf(stderr, "Problem waiting for createdump: waitpid() FAILED result %d wstatus %08x errno %s (%d)\n",
                result, wstatus, strerror(errno), errno);
            return false;
        }
        else
        {
#ifdef _DEBUG
            fprintf(stderr, "waitpid() returned successfully (wstatus %08x) WEXITSTATUS %x WTERMSIG %x\n", wstatus, WEXITSTATUS(wstatus), WTERMSIG(wstatus));
#endif
            return !WIFEXITED(wstatus) || WEXITSTATUS(wstatus) == 0;
        }
    }
    return true;
#endif // !TARGET_IOS && !TARGET_TVOS && !TARGET_WASM
}

/*++
Function:
  PROCCreateCrashDump

View on GitHub (pinned to 290d5ab72c)

Solutions

  1. Stop a PID-1 reaper from claiming the createdump child: drop --init from docker, or use a reaper that only harvests orphans.
  2. 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`.
  3. Identify and neutralize any global SIGCHLD waiter installed by a loaded native library.
  4. Confirm whether createdump actually finished despite the waitpid error by enabling DOTNET_CreateDumpVerboseDiagnostics=1 and checking for the output dump file.
  5. Where the environment makes reliable waitpid impossible, treat OS-level coredumps as the source of truth.

Example fix

# before: --init installs tini which reaps the createdump child
$ docker run --init myapp   # waitpid() FAILED ECHILD

# after: no reaper, or kernel-driven core_pattern
$ docker run myapp
$ echo '|/usr/share/dotnet/createdump %p %e' > /proc/sys/kernel/core_pattern
$ ulimit -c unlimited && ./app
Defensive patterns

Strategy: validation

Validate before calling

# Detect environmental causes of waitpid failure before relying on in-process minidumps.
ps -o pid,comm -p 1 | grep -Eqi 'tini|dumb-init|init|systemd' && echo "WARN: PID 1 reaper may break waitpid"
if [ -w /proc/sys/kernel/core_pattern ]; then
  echo '|/usr/share/dotnet/createdump %p %e' > /proc/sys/kernel/core_pattern
  ulimit -c unlimited
else
  echo "core_pattern not writable; in-process dumps may be unreliable here"
fi

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06). Data as JSON: /api/errors/3ef00e7b1c9a4163. Report an issue: GitHub.