[webkit-changes] [WebKit/WebKit] e06af7: Sync IPC message cancellation is not consistent
Kimmo Kinnunen
noreply at github.com
Wed Oct 2 02:26:40 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e06af74daaf6e21925cd1b73a6cf844e8623ff92
https://github.com/WebKit/WebKit/commit/e06af74daaf6e21925cd1b73a6cf844e8623ff92
Author: Kimmo Kinnunen <kkinnunen at apple.com>
Date: 2024-10-02 (Wed, 02 Oct 2024)
Changed paths:
M Source/WebKit/Platform/IPC/Connection.cpp
M Source/WebKit/Platform/IPC/Connection.h
M Source/WebKit/Platform/IPC/Decoder.cpp
M Source/WebKit/Platform/IPC/Decoder.h
M Source/WebKit/Platform/IPC/Encoder.cpp
M Source/WebKit/Platform/IPC/Encoder.h
M Source/WebKit/Platform/IPC/HandleMessage.h
M Source/WebKit/Platform/IPC/StreamClientConnection.h
M Source/WebKit/Platform/IPC/StreamServerConnection.cpp
M Source/WebKit/Platform/IPC/StreamServerConnection.h
A Source/WebKit/Platform/IPC/SyncRequestID.h
M Source/WebKit/Scripts/webkit/model.py
M Source/WebKit/Scripts/webkit/tests/MessageNames.cpp
M Source/WebKit/Scripts/webkit/tests/MessageNames.h
M Source/WebKit/Shared/IPCStreamTester.cpp
M Source/WebKit/Shared/IPCStreamTester.h
M Source/WebKit/Shared/IPCStreamTester.messages.in
M Source/WebKit/Shared/WTFArgumentCoders.serialization.in
M Source/WebKit/UIProcess/WebProcessProxy.cpp
M Source/WebKit/WebKit.xcodeproj/project.pbxproj
M Source/WebKit/WebProcess/WebPage/IPCTestingAPI.cpp
M Tools/TestWebKitAPI/Tests/IPC/ConnectionTests.cpp
M Tools/TestWebKitAPI/Tests/IPC/StreamConnectionTests.cpp
Log Message:
-----------
Sync IPC message cancellation is not consistent
https://bugs.webkit.org/show_bug.cgi?id=280271
rdar://136584036
Reviewed by Matt Woodrow.
IPC::Connection has a feature where unhandled sync messages are intended
to be be cancelled. This is so that the caller does not hang
indefinitively. The cancel was sync message reply with no parameters.
This would lead to inconsistent behavior: accepted reply if the reply
does not have parameters, decode error if the reply has parameters.
Fix by following steps:
Introduce a new message, CancelSyncMessageReply, to signify that the
message was cancelled.
Replaces SyncMessageDeserializationFailure with sending the
CancelSyncMessageReply. This is used in IPC JS testing API to be able
to send multiple arbitrary incorrect messages, while avoiding timeouts.
The same structure will be used for future to implement the same cancel
feature for asynchronous messages.
This is work towards fixing leaks of asynchronous message handlers,
thread-safe sendSync/waitForAsyncReplyAndDispatchImmediately and
unification of sync/async message receive implementations.
* Source/WebKit/Platform/IPC/Connection.cpp:
(IPC::Connection::dispatchMessageReceiverMessage):
(IPC::Connection::processIncomingMessage):
(IPC::Connection::dispatchSyncMessage):
(IPC::errorAsString):
* Source/WebKit/Platform/IPC/Connection.h:
(IPC::Connection::sendSync):
* Source/WebKit/Platform/IPC/Decoder.cpp:
(IPC::Decoder::hasSyncMessageDeserializationFailure const): Deleted.
* Source/WebKit/Platform/IPC/Decoder.h:
(IPC::Decoder::syncRequestID const):
(IPC::Decoder::isAllowedWhenWaitingForUnboundedSyncReply const):
* Source/WebKit/Platform/IPC/Encoder.cpp:
(IPC::Encoder::setSyncMessageDeserializationFailure): Deleted.
* Source/WebKit/Platform/IPC/Encoder.h:
* Source/WebKit/Platform/IPC/HandleMessage.h:
(IPC::handleMessageSynchronous):
* Source/WebKit/Platform/IPC/StreamClientConnection.h:
(IPC::StreamClientConnection::trySendSyncStream):
* Source/WebKit/Platform/IPC/StreamServerConnection.cpp:
(IPC::StreamServerConnection::didClose):
(IPC::StreamServerConnection::dispatchStreamMessages):
(IPC::StreamServerConnection::processSetStreamDestinationID):
(IPC::StreamServerConnection::processStreamMessage):
(IPC::StreamServerConnection::processOutOfStreamMessage):
(IPC::StreamServerConnection::dispatchStreamMessage):
(IPC::StreamServerConnection::protectedWorkQueue const):
(IPC::StreamServerConnection::dispatchOutOfStreamMessage): Deleted.
(IPC::StreamServerConnection::sendDeserializationErrorSyncReply): Deleted.
* Source/WebKit/Platform/IPC/StreamServerConnection.h:
(IPC::StreamServerConnection::sendSyncReply):
* Source/WebKit/Platform/IPC/SyncRequestID.h: Added.
* Source/WebKit/Scripts/webkit/model.py:
* Source/WebKit/Shared/IPCStreamTester.cpp:
(WebKit::IPCStreamTester::syncMessageNotStreamEncodableBoth):
* Source/WebKit/Shared/IPCStreamTester.h:
* Source/WebKit/Shared/IPCStreamTester.messages.in:
* Source/WebKit/Shared/WTFArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::dispatchSyncMessage):
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/WebPage/IPCTestingAPI.cpp:
(WebKit::IPCTestingAPI::jsResultFromReplyDecoder):
* Tools/TestWebKitAPI/Tests/IPC/ConnectionTests.cpp:
(TestWebKitAPI::MockTestSyncMessage::name):
(TestWebKitAPI::MockTestSyncMessageWithDataReply::name):
(TestWebKitAPI::TEST_P):
* Tools/TestWebKitAPI/Tests/IPC/StreamConnectionTests.cpp:
(TestWebKitAPI::TEST_P):
Canonical link: https://commits.webkit.org/284553@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list