-
-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] BrokenPipe Crash #102
Comments
Hey @techtastet 👋 So Opine is designed currently to catch some errors that are thrown from Deno's Http std lib as you can see here --> https://github.com/asos-craigmorten/opine/blob/main/src/response.ts#L256, namely instances of Other than that, the responsibility of error handling lies with your code to add appropriate error handling, either by adding an error middleware to your application, or adding try {
await res.end();
} catch(e) {
// ... do something with the error.
} Check out the error examples and the Let me know if need further assistance. If you believe it is an issue with Opine, please provide a reproduce-able code example 😄 |
This appears to originate from a bug in the std library which has since been fixed. See:
And was fixed in: denoland/deno#8365 Please re-open if you are finding it still happens and provide a reproduceable example 😄 |
The issue still exist and it happens when the request is cancelled. I use OpineHttpProxy in this case too. |
It seems that deno also can throw |
Yeah, looks like closed this in error. We will need to handle TBC if can wrap the response or if need to catch at the top-level loop It sounds like we would benefit from moving from the async interator to a while loop where call // ... rest of code
while (!closed) {
try {
const request = await server.next();
} catch (e) {
// handle Deno.errors.BrokenPipe and other errors
}
this(request as Request);
// ... rest of code
}
// ... rest of code |
Thanks for the fast reply! For future reference, I could reproduce it by app.get("/", function(req, res) {
res.send("a ".repeat(9999999));
}); and spamming |
Ah nice @Tc-001 that will be useful for repro + figuring out if fix. Can probably add a "racing server" like integration test similar to what the std/http module has for these kind of edge cases in real world apps. |
Issue
Setup:
deno 1.6.3 (release, x86_64-unknown-linux-gnu)
v8 8.8.294
typescript 4.1.3
Details
The text was updated successfully, but these errors were encountered: