Skip to content

Conversation

@ayeteadoe
Copy link
Contributor

On Windows a scenario one will see is a Trying to post_message during IPC shutdown VERIFY failure followed by the crash of the UI process. It turns out when had not yet implemented the child process exit handling on Windows.

Note that this does not solve all of the scenarios where the UI process crashes due to that message, so there is still some investigation to be done in LibWebView and/or LibIPC to ensure the ViewImplementation is not trying to post messages to a server after its TransportSocketWindows connection has been severed.

Headless Ladybird (Core Windows Event Loop)

Before

ladybird_windows_crash_headless_unhandled.mp4

After

ladybird_windows_crash_headless_handled.mp4

Ladybird (Qt Windows Event Loop)

Before

ladybird_windows_crash_unhandled.mp4

After

ladybird_windows_crash_handled.mp4

@acmebully-stack
Copy link

acmebully-stack commented Nov 23, 2025 via email

@gmta gmta added the windows Related to the Windows platform; on PRs this triggers a Windows CI build label Nov 23, 2025
There is no direct equivalent to SIGCHILD on Windows. The closest we
can get is monitoring a specific process, given a known pid. On Unix
there is no single solution to be able to do that in LibCore's
EventLoopImplementationUnix. For Linux there's a SYS_pidfd_open syscall
that can integrate into poll(), but on macOS a kqueue would be needed.
Given macOS uses EventLoopImplementationUnix for the headless view
implementation, we currently can't create a fully cross-platform
abstaction at the Event Loop level to match what Windows needs to do.

ProcessMonitor's purpose is to abstract away the Unix vs Windows
behaviour avoiding more inlined ifdef soup in ProcessManager.
@ayeteadoe ayeteadoe force-pushed the processmanager-exit-refactor branch from da84976 to 052c016 Compare November 23, 2025 14:15
This is the closest Windows equivalent to integrating process exit
handlers into the event loop.

Linux could also integrate register_process() into the poll() based
Unix event loop via the SYS_pidfd_open syscall; however, macOS requires
a kqueue. So for now register_process will only be used by Windows to
implement WebView::ProcessMonitor.
Qt does not use IOCP's in their underlying Windows event loop
implementation; however, QWinEventNotifier allows us to register a wait
on a process handle that has SYNCHRONIZE access rights. This means an
event will be signalled when that process terminates which emits the
QWinEventNotifier::activated signal.
Now that we detect and handle child processes exiting, we should see
less "Trying to post_message during IPC shutdown" VERIFY failures that
crash the UI process.
@ayeteadoe ayeteadoe force-pushed the processmanager-exit-refactor branch from 052c016 to 78c9190 Compare November 23, 2025 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

windows Related to the Windows platform; on PRs this triggers a Windows CI build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants