<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>215771</bug_id>
          
          <creation_ts>2020-08-24 09:59:28 -0700</creation_ts>
          <short_desc>Unhandled Promise Rejection: Abort Error: Fetch is aborted</short_desc>
          <delta_ts>2023-03-23 07:53:15 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>Safari 13</version>
          <rep_platform>All</rep_platform>
          <op_sys>macOS 10.15</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P1</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>sobue</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>anna.peery</cc>
    
    <cc>asheem.mamoowala</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>youennf</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1682358</commentid>
    <comment_count>0</comment_count>
    <who name="">sobue</who>
    <bug_when>2020-08-24 09:59:28 -0700</bug_when>
    <thetext>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 = &apos;https://...&apos;; // URL which takes more than 1 second to download
function test(url) {
  const abortController = new AbortController();
  window.setTimeout(() =&gt; {
    abortController.abort();
  }, 1000);
  window.fetch(url, { signal: abortController.signal }).then(response =&gt; {
    const reader = response.body.getReader();
    reader.read().then(function processData({ value, done}) {
      if (done) {
        return;
      }
      return reader.read().then(processData);
    })
    .catch(error =&gt; console.error(&apos;reader error handled gracefully&apos;, error));
  });
}

test(url);
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1682362</commentid>
    <comment_count>1</comment_count>
    <who name="">sobue</who>
    <bug_when>2020-08-24 10:07:15 -0700</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1682588</commentid>
    <comment_count>2</comment_count>
    <who name="youenn fablet">youennf</who>
    <bug_when>2020-08-24 23:37:51 -0700</bug_when>
    <thetext>Right, we should add @promiseFlagsIsHandled to the promises.
In general, we should update the ReadableStream implementation up to spec.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1684160</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-08-31 10:00:32 -0700</bug_when>
    <thetext>&lt;rdar://problem/68082772&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1727958</commentid>
    <comment_count>4</comment_count>
    <who name="Asheem">asheem.mamoowala</who>
    <bug_when>2021-02-10 21:43:26 -0800</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1921403</commentid>
    <comment_count>5</comment_count>
    <who name="Anna">anna.peery</who>
    <bug_when>2022-12-22 09:56:38 -0800</bug_when>
    <thetext>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!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1921464</commentid>
    <comment_count>6</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2022-12-22 13:08:39 -0800</bug_when>
    <thetext>*** Bug 249784 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1943363</commentid>
    <comment_count>7</comment_count>
    <who name="youenn fablet">youennf</who>
    <bug_when>2023-03-23 07:53:15 -0700</bug_when>
    <thetext>I cannot reproduce with the snippet, closing as configuration changed.
I&apos;ll fix https://bugs.webkit.org/show_bug.cgi?id=251463 which is still an issue.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>