-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Cocoa] Temporarily wake up remote process if outgoing IPC message queue becomes too large #13340
[Cocoa] Temporarily wake up remote process if outgoing IPC message queue becomes too large #13340
Conversation
EWS run on previous version of this PR (hash 17a41bd) |
17a41bd
to
9e5d96d
Compare
EWS run on previous version of this PR (hash 9e5d96d) |
#endif | ||
|
||
constexpr size_t largeOutgoingMessageQueueCountThreshold { 500 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest picking 1024 to match MACH_PORT_QLIMIT_LARGE
. So basically in the worst case this will trigger after ~2048 messages if the receiver process is suspended (1024 will be stuck in the Mach IPC queue and 1024 will be stuck in m_outgoingMessages
.
I also realize this only applies to UIProcess at the moment, but when running some LocalStorage benchmarks, I was easily able to see message queues of size ~3k-4k in NetworkProcess even without the receiver process being suspended. So we may need to consider upping this limit so that it doesn't become too noisy. But I think we can start with this limit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will up to 1024 for now. We can up if we becomes too noisy later. But it won't be more than once every 30 seconds so I am not too worried about noise at the moment.
, 0 | ||
#endif | ||
); | ||
m_outgoingMessageQueueIsGrowingLargeCallback(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be called outside of the block that holds the lock?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
9e5d96d
to
7ad9257
Compare
EWS run on previous version of this PR (hash 7ad9257) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
} | ||
|
||
if (shouldNotifyOfQueueGrowingLarge) { | ||
RELEASE_LOG_ERROR(IPC, "Connection::sendMessage(): Too many messages (%lu) in the queue to remote PID: %d, notifying client", outgoingMessagesCount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: %zu
for size_t
7ad9257
to
966aea0
Compare
EWS run on current version of this PR (hash 966aea0) |
β¦eue becomes too large https://bugs.webkit.org/show_bug.cgi?id=256181 Reviewed by Ben Nham. Temporarily wake up remote process if outgoing IPC message queue becomes too large, to avoid potentially bad memory growth when the remote process is suspended. This currently only works for AuxiliaryProcessProxy, so IPC from the UIProcess to child processes. However, we may want to consider extending this to IPC from the network process to WebProcesses in a follow-up. In the current proposal, we wake up the destination process for 3 seconds when its outgoing message queue has reached 1024 messages. We do so at most once every 30 seconds. * Source/WebKit/Platform/IPC/Connection.cpp: (IPC::Connection::setOutgoingMessageQueueIsGrowingLargeCallback): (IPC::Connection::invalidate): (IPC::Connection::sendMessage): * Source/WebKit/Platform/IPC/Connection.h: * Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp: (WebKit::AuxiliaryProcessProxy::AuxiliaryProcessProxy): (WebKit::AuxiliaryProcessProxy::didFinishLaunching): (WebKit::AuxiliaryProcessProxy::outgoingMessageQueueIsGrowingLarge): * Source/WebKit/UIProcess/AuxiliaryProcessProxy.h: Canonical link: https://commits.webkit.org/263570@main
966aea0
to
5183343
Compare
Committed 263570@main (5183343): https://commits.webkit.org/263570@main Reviewed commits have been landed. Closing PR #13340 and removing active labels. |
5183343
966aea0
π§ͺ gtk-wk2