WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED CONFIGURATION CHANGED
215771
Unhandled Promise Rejection: Abort Error: Fetch is aborted
https://bugs.webkit.org/show_bug.cgi?id=215771
Summary
Unhandled Promise Rejection: Abort Error: Fetch is aborted
sobue
Reported
2020-08-24 09:59:28 PDT
Lots of `Unhandled Promise Rejection: Abort Error: Fetch is aborted` error is being displayed in console, when network is disconnected while data from `ReadableStream` is being read. The sample code below will abort stream data reading after 1 second. Chrome browser does not throw an error and ends stream reading gracefully, however Safari and WkWebView threw lots of error in console. -- ``` const url = 'https://...'; // URL which takes more than 1 second to download function test(url) { const abortController = new AbortController(); window.setTimeout(() => { abortController.abort(); }, 1000); window.fetch(url, { signal: abortController.signal }).then(response => { const reader = response.body.getReader(); reader.read().then(function processData({ value, done}) { if (done) { return; } return reader.read().then(processData); }) .catch(error => console.error('reader error handled gracefully', error)); }); } test(url); ```
Attachments
Add attachment
proposed patch, testcase, etc.
sobue
Comment 1
2020-08-24 10:07:15 PDT
This line of the code seems throwing those errors.
https://github.com/WebKit/webkit/blob/950143da027e80924b4bb86defa8a3f21fd3fb1e/Source/WebCore/Modules/streams/ReadableStreamInternals.js#L302
I guess there are lots of internal requests being queued to buffer incoming data for efficient reading. Those requests being cancelled should not be revealed to consumer in console pane.
youenn fablet
Comment 2
2020-08-24 23:37:51 PDT
Right, we should add @promiseFlagsIsHandled to the promises. In general, we should update the ReadableStream implementation up to spec.
Radar WebKit Bug Importer
Comment 3
2020-08-31 10:00:32 PDT
<
rdar://problem/68082772
>
Asheem
Comment 4
2021-02-10 21:43:26 PST
This is a problem in Mapbox-GL-JS that is being faced by a number of users of the library. Reference:
https://github.com/mapbox/mapbox-gl-js/issues/8480
Whether using a nested promise or a chained promise, this error is logged to the console when a fetch request is cancelled while reading the response data. Link to the code in question:
https://github.com/mapbox/mapbox-gl-js/blob/0102e52123fc66df98853620ced6e0e3195fa9a4/src/util/ajax.js#L144-L157
This problem affects our customers who are using logged errors for production applications, and have to handle a large number of these spurious errors.
Anna
Comment 5
2022-12-22 09:56:38 PST
Any update on this? I opened a new ticket to bump up this issue as it seems to be a continued problem:
https://bugs.webkit.org/show_bug.cgi?id=249784
Thanks!
Alexey Proskuryakov
Comment 6
2022-12-22 13:08:39 PST
***
Bug 249784
has been marked as a duplicate of this bug. ***
youenn fablet
Comment 7
2023-03-23 07:53:15 PDT
I cannot reproduce with the snippet, closing as configuration changed. I'll fix
https://bugs.webkit.org/show_bug.cgi?id=251463
which is still an issue.
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