-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
LibCore+LibWebView: Prevent UI process crashes when child processes crash on Windows #6909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ayeteadoe
wants to merge
4
commits into
LadybirdBrowser:master
Choose a base branch
from
ayeteadoe:processmanager-exit-refactor
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
LibCore+LibWebView: Prevent UI process crashes when child processes crash on Windows #6909
ayeteadoe
wants to merge
4
commits into
LadybirdBrowser:master
from
ayeteadoe:processmanager-exit-refactor
+228
−26
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
unsubscribe Sent from my iPhoneOn Nov 22, 2025, at 8:15 PM, ayeteadoe ***@***.***> wrote: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
https://github.com/user-attachments/assets/85750bb7-159d-4e3b-a9bf-29291fb1d555
After
https://github.com/user-attachments/assets/54819204-fd45-44d4-9ac6-1f741e156912
Ladybird (Qt Windows Event Loop)
Before
https://github.com/user-attachments/assets/14111d6d-15e9-4f82-abd1-006c926f11d8
After
https://github.com/user-attachments/assets/4010f734-8df2-4099-bc4a-082553936b95
You can view, comment on, or merge this pull request online at:
#6909
Commit Summary
1444113 LibWebView: Abstract process exit monitoring into ProcessMonitor
a339c4e LibCore: Expose register_process and implement for Windows event loop
4dda455 LibWebView: Implement register_process for Qt Windows event loop
da84976 LibWebView: Support process exit handling on Windows
File Changes (12 files)
M
Libraries/LibCore/EventLoop.cpp
(10)
M
Libraries/LibCore/EventLoop.h
(4)
M
Libraries/LibCore/EventLoopImplementation.h
(3)
M
Libraries/LibCore/EventLoopImplementationWindows.cpp
(66)
M
Libraries/LibCore/EventLoopImplementationWindows.h
(4)
M
Libraries/LibWebView/CMakeLists.txt
(1)
M
Libraries/LibWebView/EventLoop/EventLoopImplementationQt.cpp
(45)
M
Libraries/LibWebView/EventLoop/EventLoopImplementationQt.h
(5)
M
Libraries/LibWebView/ProcessManager.cpp
(30)
M
Libraries/LibWebView/ProcessManager.h
(4)
A
Libraries/LibWebView/ProcessMonitor.cpp
(56)
A
Libraries/LibWebView/ProcessMonitor.h
(27)
Patch Links:
https://github.com/LadybirdBrowser/ladybird/pull/6909.patch
https://github.com/LadybirdBrowser/ladybird/pull/6909.diff
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
R-Goc
reviewed
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.
da84976 to
052c016
Compare
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.
052c016 to
78c9190
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On Windows a scenario one will see is a
Trying to post_message during IPC shutdownVERIFY 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
LibWebViewand/orLibIPCto ensure theViewImplementationis not trying to post messages to a server after itsTransportSocketWindowsconnection 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