cloudflare / cloudflare/workerd
Investigate flaky and broken WPT fetch/api/abort tests
- Dominant language
- C++
- Stars
- 8.7k
- Forks
- 739
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 174
Description
The test [fetch/api/abort/general.any.js](https://github.com/web-platform-tests/wpt/blob/master/fetch/api/abort/general.any.js) contains a number of flaky and failing subtests.
## Flaky tests
- Stream errors once aborted, after reading. Underlying connection closed
- Stream errors once aborted. Underlying connection closed.
An example log of them flaking: https://github.com/cloudflare/workerd/actions/runs/15562755101/job/43819049604?pr=4272#step:11:7935
The relevant part is this, which isn't very helpful:
```
[AggregateError: Stream errors once aborted, after reading. Underlying connection closed.] {
[errors]: [
Error: Timed out
at PromiseTest. (eval:536:43)
at async Promise.all (index 48)
at async RunnerState.validate (harness/harness:59:9)
at async runTest (harness/harness:258:5)
]
}
The following tests unexpectedly failed: [
"Stream errors once aborted, after reading. Underlying connection closed."
]
```
## Incorrect behaviour (needs investigating)
- Aborting rejects with AbortError
- Aborting rejects with abort reason
- Already aborted signal rejects immediately
- Already aborted signal rejects immediately
- Readable stream synchronously cancels with AbortError if aborted before reading
## Signal cloning when a request is cloned
- Signal state is cloned
- Signal on request object should also have abort reason
- Signal on request object
These ones might be improved by enabling `request_signal_passthrough` and/or `enable_request_signal` but our behaviour around cloning Requests with abort signals might still be wrong
## Error type change
- response.formData() rejects if already aborted
Should be easy but might need a compat flag
## The "rejects if already aborted" tests
- response.arrayBuffer() rejects if already aborted
- response.blob() rejects if already aborted
- response.bytes() rejects if already aborted
- response.json() rejects if already aborted
- response.text() rejects if already aborted
- response.formData() rejects if already aborted
- Call text() twice on aborted response
These probably all have the same underlying cause.
Contributor guide
Assessment
This issue has not been assessed yet.