Bug 190884 - REGRESSION (WEBPROCESS_WINDOWSERVER_BLOCKING): requestAnimationFrame Stops Completing
Summary: REGRESSION (WEBPROCESS_WINDOWSERVER_BLOCKING): requestAnimationFrame Stops Co...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari 12
Hardware: Unspecified macOS 10.14
: P2 Major
Assignee: Per Arne Vollan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-10-24 11:21 PDT by Daniel James
Modified: 2019-02-06 09:18 PST (History)
11 users (show)

See Also:


Attachments
Minimal Reproducible Example (1.16 KB, application/zip)
2018-10-24 11:21 PDT, Daniel James
no flags Details
Patch (20.28 KB, patch)
2018-11-09 14:29 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (20.33 KB, patch)
2018-11-09 14:47 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (23.94 KB, patch)
2018-11-13 09:42 PST, Per Arne Vollan
dino: review+
ews-watchlist: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews121 for ios-simulator-wk2 (2.33 MB, application/zip)
2018-11-13 11:26 PST, EWS Watchlist
no flags Details
Patch (23.88 KB, patch)
2018-11-14 09:27 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (25.88 KB, patch)
2018-11-14 09:41 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel James 2018-10-24 11:21:36 PDT
Created attachment 353045 [details]
Minimal Reproducible Example

The gist is that since Safari 12, it's possible to "break" requestAnimationFrame for every page in a grouped process. This makes our application practically unusable in  Safari.

I have attached a minimal reproducible example. I have verified that Safari 11 / Chrome / etc.. does not have this problem, and that this problem still occurs in the latest Safari Technology Preview (68)

Instructions:
Open index.html
Notice an incrementing counter.
Click the link to take you to loop.html
Notice the incrementing counter begins after some delay.
Without going back to the first page, close loop.html, taking you back to index.html

Expected:
The counters should continually increment while viewing the pages.

Actual:
Both: The counter in no longer incrementing. 
Safari 12: Other pages spawned by this page appear to get 0 or 1 completions to requestAnimationFrame and no more. (Additionally, interacting with the dev tools open in this state tends to crash the process, but I can't reproduce this reliably.)
Preview 68: Opening a new page tends to fix the counter. 


Example website:
Opening a document at www.lucidchart.com will put Safari 12 into this state.
Comment 1 Radar WebKit Bug Importer 2018-10-25 09:48:23 PDT
<rdar://problem/45556367>
Comment 2 Daniel James 2018-10-25 16:03:58 PDT
This appears at least partially OS dependent. We could not reproduce this in Safari 12 on High Sierra.
Comment 3 Chris Dumez 2018-11-05 16:25:26 PST
This is related to Per's sandboxing of the WebProcess on Mojave to that the WebProcess no longer has access to the Window server.

Before https://trac.webkit.org/changeset/232879/webkit:
- rAF keeps incrementing in index.html when closing loop.html
but
- rAF fails to increment in loop.html

After https://trac.webkit.org/changeset/232879/webkit:
- rAF is no longer incrementing in index.html when closing loop.html
but
- rAF is incrementing in loop.html when opening it.
Comment 4 Chris Dumez 2018-11-05 16:46:25 PST
As a quick hack, I tried:
diff --git a/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm b/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm
index b55ce9e8f39..4c877511ca1 100644
--- a/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm
+++ b/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm
@@ -695,8 +695,8 @@ void WebPageProxy::stopDisplayLink(unsigned observerID)
         return;
     
     m_displayLink->removeObserver(observerID);
-    if (!m_displayLink->hasObservers())
-        m_displayLink = nullptr;
+    /*if (!m_displayLink->hasObservers())
+        m_displayLink = nullptr;*/
 }
 #endif


It seems to fix the problem. Sending over to Per since he wrote this code and I am not familiar with it.
Comment 5 Per Arne Vollan 2018-11-09 14:29:52 PST
Created attachment 354387 [details]
Patch
Comment 6 Per Arne Vollan 2018-11-09 14:30:19 PST
(In reply to Per Arne Vollan from comment #5)
> Created attachment 354387 [details]
> Patch

WIP.
Comment 7 Per Arne Vollan 2018-11-09 14:47:31 PST
Created attachment 354388 [details]
Patch
Comment 8 EWS Watchlist 2018-11-09 14:49:40 PST
Attachment 354388 [details] did not pass style-queue:


ERROR: Source/WebCore/ChangeLog:8:  You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible.  [changelog/nonewtests] [5]
Total errors found: 1 in 13 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Per Arne Vollan 2018-11-13 09:42:53 PST
Created attachment 354677 [details]
Patch
Comment 10 Dean Jackson 2018-11-13 10:12:04 PST
Comment on attachment 354677 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=354677&action=review

> Source/WebKit/ChangeLog:8
> +        Since the Web page currently ownes the display link on the UI process side, the display link will be

Typo: owns
Comment 11 EWS Watchlist 2018-11-13 11:26:03 PST
Comment on attachment 354677 [details]
Patch

Attachment 354677 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/9974944

New failing tests:
fast/animation/request-animation-frame-in-two-pages.html
Comment 12 EWS Watchlist 2018-11-13 11:26:04 PST
Created attachment 354686 [details]
Archive of layout-test-results from ews121 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews121  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.6
Comment 13 Per Arne Vollan 2018-11-14 09:27:33 PST
Created attachment 354819 [details]
Patch
Comment 14 Per Arne Vollan 2018-11-14 09:41:10 PST
Created attachment 354823 [details]
Patch
Comment 15 Per Arne Vollan 2018-11-14 09:42:20 PST
(In reply to Dean Jackson from comment #10)
> Comment on attachment 354677 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=354677&action=review
> 
> > Source/WebKit/ChangeLog:8
> > +        Since the Web page currently ownes the display link on the UI process side, the display link will be
> 
> Typo: owns

Thanks for reviewing!
Comment 16 WebKit Commit Bot 2018-11-14 10:43:28 PST
Comment on attachment 354823 [details]
Patch

Clearing flags on attachment: 354823

Committed r238184: <https://trac.webkit.org/changeset/238184>
Comment 17 Lucas Forschler 2019-02-06 09:18:52 PST
Mass move bugs into the DOM component.