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

Fix express responses dying early #18080

Merged
merged 2 commits into from
Mar 12, 2025
Merged

Fix express responses dying early #18080

merged 2 commits into from
Mar 12, 2025

Conversation

heimskr
Copy link
Member

@heimskr heimskr commented Mar 11, 2025

What does this PR do?

Fixes ServerResponse.finished not being initialized to false on construction. This (sometimes) caused Express responses to never complete. (Fixed version of #18078)

  • Documentation or TypeScript types
  • Code changes

How did you verify your code works?

In addition to running the node:http tests, I ran this reproduction provided on Discord by @Lillious and spammed refresh with cache disabled on a simple index.html page that includes an image:

import express from "express";
import path from "path";
import http from "http";
const port = process.env.WEB_PORT || 8081;

const webserver = express();
webserver.use(express.json());
webserver.use(express.urlencoded({ extended: true }));
webserver.disable("x-powered-by");

webserver.use(express.static(path.join(import.meta.dir, "www")));

const server = http.createServer(webserver);

server.listen(port, () => {
  console.log(`Webserver is running on port ${port}`);
});

server.on("error", (error) => {
  console.error(error);
});

Before this fix, it would sometimes fail to load the image or the page itself. Now it always succeeds.

@robobun
Copy link

robobun commented Mar 11, 2025

Updated 8:58 PM PT - Mar 11th, 2025

@heimskr, your commit 8ccdc4bc6428c3d650f223f62307ca738ef7a745 passed in Build #13078! 🎉


🧪   try this PR locally:

bunx bun-pr 18080

@heimskr heimskr requested review from a team and zackradisic and removed request for a team March 11, 2025 22:35
Copy link
Member

@nektro nektro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node doesnt use a symbol but otherwise LGTM
a test would be nice but not strictly necessary to unblock

@Jarred-Sumner Jarred-Sumner merged commit 2e01007 into main Mar 12, 2025
14 of 31 checks passed
@Jarred-Sumner Jarred-Sumner deleted the kai/http-2 branch March 12, 2025 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants