[GLIB] WebProcess critical assertion during D-Bus RequestName completion on process shutdown#60411
Conversation
|
EWS run on previous version of this PR (hash 616bd88) Details |
csaavedra
left a comment
There was a problem hiding this comment.
Just some style comments, not reviewing correctness as I think @GeorgesStavracas should do that.
| if (m_nameOwnerId) { | ||
| g_bus_unown_name(m_nameOwnerId); | ||
| m_nameOwnerId = 0; | ||
| } |
There was a problem hiding this comment.
This could use std::exchange:
| if (m_nameOwnerId) { | |
| g_bus_unown_name(m_nameOwnerId); | |
| m_nameOwnerId = 0; | |
| } | |
| if (auto id = std::exchange(m_nameOwnerId, 0)) | |
| g_bus_unown_name(id); |
| if (m_registry) { | ||
| g_signal_handlers_disconnect_by_data(m_registry.get(), this); | ||
| m_registry = nullptr; | ||
| } |
| if (m_connection) { | ||
| for (auto id : m_clients.values()) | ||
| g_dbus_connection_signal_unsubscribe(m_connection.get(), id); | ||
| m_clients.clear(); | ||
|
|
||
| g_dbus_connection_close_sync(m_connection.get(), nullptr, nullptr); | ||
| m_connection = nullptr; | ||
| } |
| for (auto& pending : m_pendingRootRegistrations) | ||
| pending.completionHandler({ }); | ||
| m_pendingRootRegistrations.clear(); |
There was a problem hiding this comment.
This could also use std::exchange().
616bd88 to
c577e4a
Compare
|
EWS run on previous version of this PR (hash c577e4a) Details |
| g_signal_handlers_disconnect_by_data(registry.get(), this); | ||
|
|
||
| if (auto connection = std::exchange(m_connection, nullptr)) { | ||
| for (auto id : moveToVector(std::exchange(m_clients, { }).values())) |
There was a problem hiding this comment.
Is the moveToVector() call really necessary? That's going to iterate over the elements to fill a vector. IIUC this could just be
| for (auto id : moveToVector(std::exchange(m_clients, { }).values())) | |
| for (auto id : std::exchange(m_clients, { }).values()) |
There was a problem hiding this comment.
That was my first approach, but the compiler warned of dangling-reference. Different from the other cases, here we're iterating through the values() member, which is LIFETIME_BOUND to the result of std::exchange, which in turn is not held alive by the loop.
There was a problem hiding this comment.
Then maybe it's not worth using std:: exchange in this case.
c577e4a to
3fd797f
Compare
|
EWS run on current version of this PR (hash 3fd797f) Details |
…ion on process shutdown https://bugs.webkit.org/show_bug.cgi?id=309693 Reviewed by Claudio Saavedra. While rare, there's a chance that the WebProcess exits while the AccessibilityAtspi dbus name callbacks are still in flight. If we don't close them gracefully, we risk critical errors when the reply arrives. This is likely related to 284894@main, which added the support for well-known bus name to AccessibilityAtspi. This happens, for example, in some WebDriver tests that quickly open and close browsing contexts. A run with release asserts is reporting almost 30 crashes. This commit addresses this issue by adding a graceful cleanup path to AccessibilityAtspi. * Source/WebCore/accessibility/atspi/AccessibilityAtspi.cpp: (WebCore::AccessibilityAtspi::didConnect): (WebCore::AccessibilityAtspi::disconnect): * Source/WebCore/accessibility/atspi/AccessibilityAtspi.h: * Source/WebKit/WebProcess/glib/WebProcessGLib.cpp: (WebKit::WebProcess::stopRunLoop): Canonical link: https://commits.webkit.org/309174@main
3fd797f to
57438b0
Compare
|
Committed 309174@main (57438b0): https://commits.webkit.org/309174@main Reviewed commits have been landed. Closing PR #60411 and removing active labels. |
|
Backported into |
|
Backported into |
57438b0
3fd797f
🛠 win🧪 win-tests🧪 ios-wk2-wpt🧪 api-mac-debug🛠 ios-safer-cpp