WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
195354
[iOS] Frequent 1 second IPC deadlocks when showing a paste callout
https://bugs.webkit.org/show_bug.cgi?id=195354
Summary
[iOS] Frequent 1 second IPC deadlocks when showing a paste callout
Wenson Hsieh
Reported
2019-03-05 21:09:47 PST
<
rdar://problem/48624675
>
Attachments
Patch
(22.90 KB, patch)
2019-03-05 21:57 PST
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
Patch for EWS
(24.02 KB, patch)
2019-03-06 08:15 PST
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
Patch for EWS
(24.01 KB, patch)
2019-03-06 08:18 PST
,
Wenson Hsieh
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Wenson Hsieh
Comment 1
2019-03-05 21:57:49 PST
Created
attachment 363731
[details]
Patch
Tim Horton
Comment 2
2019-03-05 23:07:13 PST
Comment on
attachment 363731
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=363731&action=review
> Source/WebKit/UIProcess/PageClient.h:399 > + virtual void handleAutocorrectionContextSync(const WebAutocorrectionContext&) = 0;
This name seems ... odd. Mostly because I think I expect the -Sync suffix on things that block on sync IPC, but this isn't that!
> Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:579 > + m_process->send(Messages::WebPage::RequestAutocorrectionContextSync(), m_pageID);
Oh... Even the request one is named wrong! Get rid of all the -Sync; there's nothing inherently synchronous about this message or functions related to it anymore. This is just request, the other one is just the reply, and we just *happen* to block on the reply in the UI process.
> Source/WebKit/WebProcess/WebPage/WebPage.cpp:6375 > + // FIXME: Computing and sending an autocorrection context is a workaround for the fact that autocorrection context
You know how I feel about this already but it is a clever solution to a problem with no clear alternatives.
> LayoutTests/ChangeLog:10 > + Most of these tests currently encounter and rely on the 1 second IPC timeout to finish. To test this fix, force > + `ignoreSynchronousMessagingTimeouts=true` to make them fail if the processes encounter a deadlock.
Hilarious
Wenson Hsieh
Comment 3
2019-03-06 07:27:43 PST
Comment on
attachment 363731
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=363731&action=review
>> Source/WebKit/UIProcess/PageClient.h:399 >> + virtual void handleAutocorrectionContextSync(const WebAutocorrectionContext&) = 0; > > This name seems ... odd. Mostly because I think I expect the -Sync suffix on things that block on sync IPC, but this isn't that!
Indeed! (see below)
>> Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:579 >> + m_process->send(Messages::WebPage::RequestAutocorrectionContextSync(), m_pageID); > > Oh... Even the request one is named wrong! Get rid of all the -Sync; there's nothing inherently synchronous about this message or functions related to it anymore. > > This is just request, the other one is just the reply, and we just *happen* to block on the reply in the UI process.
That's a good point! We just happen to waitForAndDispatchImmediately when using these two. I had named this RequestAutocorrectionContextSync() to avoid conflicting with an existing RequestAutocorrectionContext() message, but now that I think about it some more, having RequestAutocorrectionContext() is redundant. I'll remove the existing RequestAutocorrectionContext() and then rename what I call RequestAutocorrectionContextSync() here to just RequestAutocorrectionContext().
>> Source/WebKit/WebProcess/WebPage/WebPage.cpp:6375 >> + // FIXME: Computing and sending an autocorrection context is a workaround for the fact that autocorrection context > > You know how I feel about this already but it is a clever solution to a problem with no clear alternatives.
Agreed, this is just a stop gap :( We really ought to push for <
rdar://problem/16207002
> (in reality, <
rdar://problem/48383001
>).
>> LayoutTests/ChangeLog:10 >> + `ignoreSynchronousMessagingTimeouts=true` to make them fail if the processes encounter a deadlock. > > Hilarious
☠️🔒
Wenson Hsieh
Comment 4
2019-03-06 08:15:43 PST
Comment hidden (obsolete)
Created
attachment 363740
[details]
Patch for EWS
Wenson Hsieh
Comment 5
2019-03-06 08:18:15 PST
Created
attachment 363741
[details]
Patch for EWS
WebKit Commit Bot
Comment 6
2019-03-06 09:38:43 PST
Comment on
attachment 363741
[details]
Patch for EWS Clearing flags on attachment: 363741 Committed
r242551
: <
https://trac.webkit.org/changeset/242551
>
WebKit Commit Bot
Comment 7
2019-03-06 09:38:45 PST
All reviewed patches have been landed. Closing bug.
Daniel Bates
Comment 8
2020-05-10 14:16:50 PDT
Comment on
attachment 363741
[details]
Patch for EWS View in context:
https://bugs.webkit.org/attachment.cgi?id=363741&action=review
> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:3613 > + _page->process().connection()->waitForAndDispatchImmediately<Messages::WebPageProxy::HandleAutocorrectionContext>(_page->pageID(), 1_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives); > + [self _invokePendingAutocorrectionContextHandler:WKAutocorrectionContext.emptyAutocorrectionContext];
This makes autocorrection context updating non-deterministic: sometimes UIKit gets valid context data and sometimes it get an empty context, which is indistinguishable from editing an empty element. See <
rdar://problem/62605526
>.
Wenson Hsieh
Comment 9
2020-05-10 16:42:13 PDT
Comment on
attachment 363741
[details]
Patch for EWS View in context:
https://bugs.webkit.org/attachment.cgi?id=363741&action=review
>> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:3613 >> + [self _invokePendingAutocorrectionContextHandler:WKAutocorrectionContext.emptyAutocorrectionContext]; > > This makes autocorrection context updating non-deterministic: sometimes UIKit gets valid context data and sometimes it get an empty context, which is indistinguishable from editing an empty element. See <
rdar://problem/62605526
>.
I assume that the 1 second IPC timeout wasn’t hit while reproducing this bug. If it is, then it seems the real regression is whatever’s causing the web process to deadlock or become otherwise unresponsive while this IPC message is being sent. In the case where the web process is not hosed, it isn’t clear to me how this change result in non-deterministic behavior, unless `waitForAndDispatchImmediately` sometimes returns *before* invoking the IPC receiver. I’ll first try reverting out this change, to verify that it is the cause.
Wenson Hsieh
Comment 10
2020-05-10 20:35:26 PDT
(In reply to Wenson Hsieh from
comment #9
)
> Comment on
attachment 363741
[details]
> Patch for EWS > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=363741&action=review
> > >> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:3613 > >> + [self _invokePendingAutocorrectionContextHandler:WKAutocorrectionContext.emptyAutocorrectionContext]; > > > > This makes autocorrection context updating non-deterministic: sometimes UIKit gets valid context data and sometimes it get an empty context, which is indistinguishable from editing an empty element. See <
rdar://problem/62605526
>. > > I assume that the 1 second IPC timeout wasn’t hit while reproducing this > bug. If it is, then it seems the real regression is whatever’s causing the > web process to deadlock or become otherwise unresponsive while this IPC > message is being sent. > > In the case where the web process is not hosed, it isn’t clear to me how > this change result in non-deterministic behavior, unless > `waitForAndDispatchImmediately` sometimes returns *before* invoking the IPC > receiver. I’ll first try reverting out this change, to verify that it is the > cause.
To follow up — this change does not appear to be the cause of <
rdar://problem/62605526
>.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug