Bug 201871 - AbortSignal does not always emit the abort signal
Summary: AbortSignal does not always emit the abort signal
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari 12
Hardware: Mac macOS 10.14
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-09-17 06:32 PDT by Jesse van den Kieboom
Modified: 2019-10-04 09:31 PDT (History)
12 users (show)

See Also:


Attachments
Abort signal appears evicted under GC pressure (649 bytes, text/javascript)
2019-09-17 06:42 PDT, Jesse van den Kieboom
no flags Details
Patch (14.70 KB, patch)
2019-10-04 07:26 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse van den Kieboom 2019-09-17 06:32:03 PDT
This problem occurs in a large code base and I am having trouble setting up a simple reproducible test case outside of our application. It looks like when using an AbortController, calling abort on it may in certain circumstances not emit the abort event on the corresponding signal. It feels like this is problem of premature garbage collection because if I plug the corresponding signal on another object that is kept alive, I do receive the abort event correctly. In addition, the problem in our application does not appear if I use an AbortController/AbortSignal shim (further indicating that this is a problem in the native implementation somehow). I'll try to come up with an isolated test case, but I'm having a hard time doing so.
Comment 1 Jesse van den Kieboom 2019-09-17 06:42:26 PDT
Created attachment 378960 [details]
Abort signal appears evicted under GC pressure

I'm not confident this is the smallest repro case, and it doesn't appear to _always_ reproduce the problem. For me this seems to trigger the issue one out of three times or so.
Comment 2 Alexey Proskuryakov 2019-09-17 13:09:16 PDT
This seems like it's most likely an issue in AbortController, which is not part of WebKit. I think that your hunch is correct, and this is related to garbage collection. So perhaps AbortController needs to protect its properties from collection.

Please feel free to re-open if you find evidence of this being a WebKit bug. We'll almost certainly need a reproducible test case to work on this.
Comment 3 Dasa Paddock 2019-09-17 13:30:10 PDT
Can this be reopened with the Component set to WebCore since the code is at: https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/dom/AbortController.cpp
Comment 4 Alexey Proskuryakov 2019-09-17 13:37:25 PDT
Apologies, turns out that I didn't know what I was taking about.
Comment 5 Radar WebKit Bug Importer 2019-09-17 13:37:42 PDT
<rdar://problem/55451712>
Comment 6 youenn fablet 2019-10-04 07:26:11 PDT
Created attachment 380219 [details]
Patch
Comment 7 WebKit Commit Bot 2019-10-04 09:31:28 PDT
Comment on attachment 380219 [details]
Patch

Clearing flags on attachment: 380219

Committed r250727: <https://trac.webkit.org/changeset/250727>
Comment 8 WebKit Commit Bot 2019-10-04 09:31:30 PDT
All reviewed patches have been landed.  Closing bug.