RESOLVED FIXED 132144
Don't use DispatchMessageEvenWhenWaitingForSyncReply for messages from NetworkProcess
https://bugs.webkit.org/show_bug.cgi?id=132144
Summary Don't use DispatchMessageEvenWhenWaitingForSyncReply for messages from Networ...
Alexey Proskuryakov
Reported 2014-04-24 14:11:06 PDT
void AsynchronousNetworkLoaderClient::willSendRequest(NetworkResourceLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse) { // This message is DispatchMessageEvenWhenWaitingForSyncReply to avoid a situation where the NetworkProcess is deadlocked // waiting for 6 connections to complete while the WebProcess is waiting for a 7th (Synchronous XHR) to complete. loader->sendAbortingOnFailure(Messages::WebResourceLoader::WillSendRequest(request, redirectResponse), IPC::DispatchMessageEvenWhenWaitingForSyncReply); } There are several confusing things here: 1. If we send messages with IPC::DispatchMessageEvenWhenWaitingForSyncReply from NetworkProcess, they can be handled during sync XHR, causing undesirable reentrancy. That's dangerous. 2. But IPC::DispatchMessageEvenWhenWaitingForSyncReply doesn't really work in NetworkProcess, because the connection uses setOnlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage(true), so the flag is usually ignored. When it's not ignored, see the above. 3. The comment claims that we need this because otherwise we would have a deadlock. It's not accurate - we would happily load sync requests even if there are 6 async ones stuck. We disable connection limits for sync requests, even when pipelining is not in use. This is probably difficult to reproduce in practice.
Attachments
proposed patch (4.63 KB, patch)
2014-04-24 14:13 PDT, Alexey Proskuryakov
no flags
Alexey Proskuryakov
Comment 1 2014-04-24 14:13:49 PDT
Created attachment 230105 [details] proposed patch
WebKit Commit Bot
Comment 2 2014-04-27 18:56:03 PDT
Comment on attachment 230105 [details] proposed patch Clearing flags on attachment: 230105 Committed r167866: <http://trac.webkit.org/changeset/167866>
WebKit Commit Bot
Comment 3 2014-04-27 18:56:06 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.