cloudflare / cloudflare/workerd
When a promise is aborted using AbortSignal, the reason of the abort is not preserved
- Dominant language
- C++
- Stars
- 8.7k
- Forks
- 739
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 174
Description
When a promise is aborted using AbortSignal, the `reason` of the abort is not preserved - it becomes a generic error object instead. This caused a number of new WPT test failures (#7021):
* Aborting rejects with abort reason when aborted after fetch() called
* response.arrayBuffer() rejects with abort reason if already aborted
* response.blob() rejects with abort reason if already aborted
* response.bytes() rejects with abort reason if already aborted
* response.formData() rejects with abort reason if already aborted
* response.json() rejects with abort reason if already aborted
* response.text() rejects with abort reason if already aborted
* Stream errors once aborted with abort reason. Underlying connection closed.
There are also several tests that predate #7021 and are marked as expected failures, for the same reasons:
- Aborting rejects with AbortError
- Aborting rejects with abort reason
- Already aborted signal rejects immediately
This is probably due to exception tunneling.
Contributor guide
Research direction
Start by running the WPT cases listed in the issue, including the expected failures, then trace exception tunneling through the fetch and stream abort paths. The work is done when AbortSignal preserves its supplied abort reason across fetch responses, body methods, and stream errors, and the listed tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, javascript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100