Bug 221920 - [GPUP] Ignore an IPC message if the message receiver has been destroyed
Summary: [GPUP] Ignore an IPC message if the message receiver has been destroyed
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Peng Liu
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-02-15 13:24 PST by Peng Liu
Modified: 2021-03-05 11:28 PST (History)
6 users (show)

See Also:


Attachments
Patch (5.82 KB, patch)
2021-02-15 13:27 PST, Peng Liu
eric.carlson: review+
Details | Formatted Diff | Diff
Revise the patch based on Eric's comment (4.17 KB, patch)
2021-02-15 14:36 PST, Peng Liu
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peng Liu 2021-02-15 13:24:56 PST
[GPUP] Ignore an IPC message if the message receiver has been destroyed
Comment 1 Peng Liu 2021-02-15 13:27:09 PST
Created attachment 420358 [details]
Patch
Comment 2 Eric Carlson 2021-02-15 14:04:33 PST
Comment on attachment 420358 [details]
Patch

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

> Source/WebKit/WebProcess/GPU/GPUProcessConnection.cpp:110
> +Logger& GPUProcessConnection::logger()
> +{
> +    if (!m_logger)
> +        m_logger = Logger::create(this);
> +
> +    return *m_logger;
> +}
> +

It looks like this is unused, `RELEASE_LOG_ERROR` does not use a Logger.
Comment 3 Peng Liu 2021-02-15 14:32:02 PST
Comment on attachment 420358 [details]
Patch

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

>> Source/WebKit/WebProcess/GPU/GPUProcessConnection.cpp:110
>> +
> 
> It looks like this is unused, `RELEASE_LOG_ERROR` does not use a Logger.

Right, will fix it. Thanks!
Comment 4 Peng Liu 2021-02-15 14:36:53 PST
Created attachment 420374 [details]
Revise the patch based on Eric's comment
Comment 5 EWS 2021-02-15 15:49:07 PST
Committed r272887: <https://commits.webkit.org/r272887>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 420374 [details].
Comment 6 Radar WebKit Bug Importer 2021-02-15 15:50:15 PST
<rdar://problem/74369181>
Comment 7 Truitt Savell 2021-02-17 10:37:04 PST
We are still seeing these two tests crashing even after this change:
imported/w3c/web-platform-tests/html/canvas/element/imagebitmap/createImageBitmap-origin.sub.html
http/tests/navigation/parsed-iframe-dynamic-form-back-entry.html

history:
https://results.webkit.org/?suite=layout-tests&suite=layout-tests&test=http%2Ftests%2Fnavigation%2Fparsed-iframe-dynamic-form-back-entry.html&test=imported%2Fw3c%2Fweb-platform-tests%2Fhtml%2Fcanvas%2Felement%2Fimagebitmap%2FcreateImageBitmap-origin.sub.html
Comment 8 Truitt Savell 2021-02-17 10:39:13 PST
Crash log for imported/w3c/web-platform-tests/html/canvas/element/imagebitmap/createImageBitmap-origin.sub.html

https://build.webkit.org/results/Apple-BigSur-Debug-WK2-Tests/r272998%20(200)/imported/w3c/web-platform-tests/html/canvas/element/imagebitmap/createImageBitmap-origin.sub-crash-log.txt


Crash log for http/tests/navigation/parsed-iframe-dynamic-form-back-entry.html

https://build.webkit.org/results/Apple-BigSur-Debug-WK2-Tests/r272998%20(200)/http/tests/navigation/parsed-iframe-dynamic-form-back-entry-crash-log.txt
Comment 9 Truitt Savell 2021-02-17 10:39:31 PST
Reopening for continuing issues
Comment 10 Peng Liu 2021-02-17 11:04:52 PST
(In reply to Truitt Savell from comment #8)
> Crash log for
> imported/w3c/web-platform-tests/html/canvas/element/imagebitmap/
> createImageBitmap-origin.sub.html
> 
> https://build.webkit.org/results/Apple-BigSur-Debug-WK2-Tests/
> r272998%20(200)/imported/w3c/web-platform-tests/html/canvas/element/
> imagebitmap/createImageBitmap-origin.sub-crash-log.txt
> 
> 
> Crash log for
> http/tests/navigation/parsed-iframe-dynamic-form-back-entry.html
> 
> https://build.webkit.org/results/Apple-BigSur-Debug-WK2-Tests/
> r272998%20(200)/http/tests/navigation/parsed-iframe-dynamic-form-back-entry-
> crash-log.txt

These are GPU Process crashes.
Comment 11 Peng Liu 2021-02-17 15:30:05 PST
Filed bug 222079 to fix the crash of http/tests/navigation/parsed-iframe-dynamic-form-back-entry.html.
Comment 12 Peng Liu 2021-02-20 10:28:41 PST
Bug 221989 tracks the crash of imported/w3c/web-platform-tests/html/canvas/element/imagebitmap/createImageBitmap-origin.sub.html.
Comment 13 Peng Liu 2021-02-20 10:29:03 PST
Let's close this bug.
Comment 14 Kimmo Kinnunen 2021-03-05 01:57:55 PST
Comment on attachment 420374 [details]
Revise the patch based on Eric's comment

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

> Source/WebKit/WebProcess/GPU/GPUProcessConnection.cpp:181
> +        RELEASE_LOG_ERROR(WebGL, "The RemoteGraphicsContextGLProxy object has beed destroyed");

From WebGL perspective this is incorrect.
This is not an error. This is expected, the sender cannot know when the receiver decides to stop listening.
Comment 15 Peng Liu 2021-03-05 10:26:16 PST
Comment on attachment 420374 [details]
Revise the patch based on Eric's comment

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

>> Source/WebKit/WebProcess/GPU/GPUProcessConnection.cpp:181
>> +        RELEASE_LOG_ERROR(WebGL, "The RemoteGraphicsContextGLProxy object has beed destroyed");
> 
> From WebGL perspective this is incorrect.
> This is not an error. This is expected, the sender cannot know when the receiver decides to stop listening.

Hmm, but this log message is from GPUProcessConnection's perspective?
Comment 16 Jer Noble 2021-03-05 10:36:14 PST
(In reply to Kimmo Kinnunen from comment #14)
> Comment on attachment 420374 [details]
> Revise the patch based on Eric's comment
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=420374&action=review
> 
> > Source/WebKit/WebProcess/GPU/GPUProcessConnection.cpp:181
> > +        RELEASE_LOG_ERROR(WebGL, "The RemoteGraphicsContextGLProxy object has beed destroyed");
> 
> From WebGL perspective this is incorrect.
> This is not an error. This is expected, the sender cannot know when the
> receiver decides to stop listening.

This is immaterial to whether the receiver is a WebGL object or not; this is a bug in our XPC implementation.  And it's not true that the sender cannot know when the receiver decides to stop listening. The receiver can send an async message to the remote process and wait for a response before stopping listening.
Comment 17 Kimmo Kinnunen 2021-03-05 11:12:05 PST
(In reply to Jer Noble from comment #16)
> And it's not true that the sender cannot
> know when the receiver decides to stop listening. The receiver can send an
> async message to the remote process and wait for a response before stopping
> listening.

Web process sends "do something"  for destination id 7.
GPU process receives "do something".
GPU process sends "something done".
Web process sends "do something" else for destination id 7.
Web process notices GPU process timed out.
Web process removes all references to anything related to id 7.
Web process receives "something done" for id 7.

In general, in asynchronous communication you cannot know if the other party will get the message you send.
Comment 18 Kimmo Kinnunen 2021-03-05 11:23:19 PST
> The receiver can send an
> async message to the remote process and wait for a response before stopping
> listening.

The destruction is not a sync operation. Would it be useful as as sync operation?

Here's a sequence that might trigger the error message

WebContent:
Send CreateRemoteGraphicsContextGL id 7
Send ReleaseRemoteGraphicsContextGL id 7

GPU Process:
Got CreateRemoteGraphicsContextGL id 7
Send WasCreated id 7
Got ReleaseRemoteGraphicsContextGL id 7
Comment 19 Kimmo Kinnunen 2021-03-05 11:28:46 PST
(In reply to Kimmo Kinnunen from comment #18)
> The destruction is not a sync operation. Would it be useful as as sync
> operation?

Sync or async with a reply would fit here better -- does not matter. 

Destruction is not usually something you compute a result with.