Skip to content

Fix readPIDFromPeer crash when child dies during launch - #1711

Open
lulicdarko wants to merge 1 commit into
WebPlatformForEmbedded:wpe-2.46from
lulicdarko:fix_readpidfrompeer_crash_on_child_death
Open

Fix readPIDFromPeer crash when child dies during launch#1711
lulicdarko wants to merge 1 commit into
WebPlatformForEmbedded:wpe-2.46from
lulicdarko:fix_readpidfrompeer_crash_on_child_death

Conversation

@lulicdarko

@lulicdarko lulicdarko commented Aug 7, 2026

Copy link
Copy Markdown

When a child process (WPEWebProcess) is killed before sending its PID —
e.g. by SIGTERM during container teardown — recvmsg() returns 0 (EOF).
Previously this fell through to g_error("Unexpected short read") which
called abort(), crashing the parent.

readPIDFromPeer now returns 0 on EOF. When it returns 0, the launch
callback calls didFinishLaunchingProcess(0, IPC::Connection::Identifier{}),
which flows into WebProcessProxy::processDidTerminateOrFailedToLaunch(
ProcessTerminationReason::Crash) — the same crash notification path that
fires when a running WebProcess dies. Pages get notified, crash handling
kicks in, no abort. The socket monitor is then removed cleanly.

  • Source/WebKit/Platform/IPC/unix/ConnectionUnix.cpp:
    (IPC::readPIDFromPeer):
  • Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
    (WebKit::ProcessLauncher::launchProcess):
    c5a0bc4
Build-Tests Layout-Tests
✅ 🛠 wpe-246-amd64-build ✅ 🧪 wpe-246-amd64-layout
✅ 🛠 wpe-246-arm32-build ❌ 🧪 wpe-246-arm32-layout

When a child process (WPEWebProcess) is killed before sending its PID —
e.g. by SIGTERM during container teardown — recvmsg() returns 0 (EOF).
Previously this fell through to g_error("Unexpected short read") which
called abort(), crashing the parent.

readPIDFromPeer now returns 0 on EOF. When it returns 0, the launch
callback calls didFinishLaunchingProcess(0, IPC::Connection::Identifier{}),
which flows into WebProcessProxy::processDidTerminateOrFailedToLaunch(
ProcessTerminationReason::Crash) — the same crash notification path that
fires when a running WebProcess dies. Pages get notified, crash handling
kicks in, no abort. The socket monitor is then removed cleanly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants