Merged
Conversation
KhafraDev
requested changes
Oct 21, 2024
Member
KhafraDev
left a comment
There was a problem hiding this comment.
This is missing a test and is replacing one issue for another. I will take a look in a few days.
Member
|
I need a test case that doesn't use a third party endpoint to work on it. The case you provided doesn't abort in node or Deno, and I cannot test in browsers because of CSP. The correct fix, afaict, is to remove the previous listener if > 1 exists (such that 1 listener always exists) or to only add a listener if there are none. |
Contributor
Author
import * as http from "http"
const abortStream = async () => {
const abortController = new AbortController
const readStream = (await fetch("http://localhost", { signal: abortController.signal })).arrayBuffer()
abortController.abort()
console.log(await readStream)
}
http.createServer((request, response) => {
if (request.url?.[1]) {
response.setHeader("content-type", "text/html")
response.end(`<!doctypehtml>
<html>
<body>
<script>
(${abortStream})()
</script>
</body>
</html>
`)
} else {
response.end(new Uint8Array(20000))
}
}).listen(80, abortStream) |
KhafraDev
approved these changes
Oct 29, 2024
Member
|
Thank you! |
Merged
This was referenced Jan 9, 2025
Closed
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This relates to...
#1711
Rationale
The simple fix to the memory issue caused a worse issue. Common patterns that involve catching AbortErrors, such as retrying slow requests, silently fail if the signal unluckily happens to be aborted during the read. A proper fix to the memory issue will likely be more involved.
Changes
revert 49e33a8
Bug Fixes
Aborting a Stream doesn't throw.
Status