[Webkit-unassigned] [Bug 217655] [WPE] PlatformDisplay::shutDownEglDisplays() is never called

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Oct 18 08:46:03 PDT 2021


--- Comment #12 from Claudio Saavedra <csaavedra at igalia.com> ---
What I have learned since my last update on this topic.

- IPCConnection provides two different mechanisms for clients to be made aware of a connection getting closed:

  1. A didClose() client method that gets called from the main thread (via the main loop). This is implemented by AuxilaryProcess and _exit() gets called there.

  2. Also, clients can connect a callback to be called directly from the worker thread *before* the aforementioned didClose() method. This was added to make sure that interested clients can quickly be made aware of disconnection, even if the main thread is stuck for whichever reason. WebProcess (subclass of AuxiliaryProcess) installs this callback and calls _exit() directly so that as soon as disconnection happens, the web process exits.

Both of these cases are problematic for the web process, given that the web process relies on an atexit() handler being called on shutdown to be able to terminate EGL displays properly, via eglTerminate().

Directly replacing _exit() with exit() in those two methods does NOT work straight away, because it is possible to run into concurrency shutdown issues. In particular, calling exit() from a thread different from the main one can conflict with the program terminating concurrently from the main thread (via exiting main() or the exit() call in AuxiliaryProcess), which can cause use-after-free errors and all kind of nasty behavior.

A correct solution for this, preserving the atexit() handler used to call eglTeminate() would involve the following:

- Termination of the web process should always invoke exit handlers. Not only in order to terminate EGL displays, but also because EGL might have its own exit handlers that need to be called.

- This call should always happen from the main thread. Web processes in ports that rely on exit handlers cannot bypass exit handlers via _exit().

A two-fold solution for these ports would be:

1. Do not call


  in WebProcess::initializeConnection() to avoid any handling right in the worker thread, and

2. AuxiliaryProcess::didClose() should use exit() instead of _exit().

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20211018/04dbb5f2/attachment.htm>

More information about the webkit-unassigned mailing list