Skip to content
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: Express errors when sending big file #23912

Open
marvinhagemeister opened this issue May 21, 2024 · 2 comments
Open

Bug: Express errors when sending big file #23912

marvinhagemeister opened this issue May 21, 2024 · 2 comments
Labels
bug Something isn't working correctly node compat node:http Issues with `node:http` module - to be fixed with a rewrite

Comments

@marvinhagemeister
Copy link
Contributor

Steps to reproduce

  1. Create a new directory and cd into it
  2. Run npm init -y && npm i express && deno init
  3. Create file server.mjs with these contents:
import express from "express";

const app = express();

app.get("/", (_req, res) => {
  res.sendFile("home.html", {
    root: import.meta.dirname,
  });
});

const port = 3000;
app.listen(port, () => {
  console.log(`Server listening on port ${port}`);
});
  1. Create file home.html with the contents from here (too big to put as inline snippet) https://gist.github.com/marvinhagemeister/2b1cde3a3527637d12332550ab65eae4 . Alternative any other big (>3MB) html file should work
  2. Run deno run -A server.mjs
  3. Run wrk -d 10 --latency http://localhost:3000/

Error

error: Uncaught (in promise) TypeError: The stream controller cannot close or enqueue.
    at ReadableStreamDefaultController.enqueue (ext:deno_web/06_streams.js:6057:13)
    at Function.#enqueue (node:http:917:18)
    at ServerResponse.write [as _write] (node:http:949:32)
    at writeOrBuffer (ext:deno_node/_stream.mjs:3947:16)
    at _write (ext:deno_node/_stream.mjs:3892:14)
    at ServerResponse.Writable.write (ext:deno_node/_stream.mjs:3895:14)
    at ReadStream.ondata (ext:deno_node/_stream.mjs:3179:26)
    at ReadStream.emit (ext:deno_node/_stream.mjs:1851:9)
    at addChunk (ext:deno_node/_stream.mjs:2873:16)
    at readableAddChunk (ext:deno_node/_stream.mjs:2852:13)

Version: Deno 1.43.5

@marvinhagemeister marvinhagemeister added the bug Something isn't working correctly label May 21, 2024
@bartlomieju bartlomieju added the node:http Issues with `node:http` module - to be fixed with a rewrite label Jul 1, 2024
@yazan-abdalrahman
Copy link
Contributor

image

Hello, I tried reproducing it at the latest version and I didn't get the error.

@marvinhagemeister
Copy link
Contributor Author

I can still reproduce it with 1.44.4 or with git from today (2024-06-05)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly node compat node:http Issues with `node:http` module - to be fixed with a rewrite
Projects
None yet
Development

No branches or pull requests

4 participants