Skip to content

fix: ensure callNodeListener resolves after res.end() is called #1028

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

Open
wants to merge 1 commit into
base: v1
Choose a base branch
from

Conversation

kricsleo
Copy link
Member

resolves #779

This is a minimal quick fix for h3@v1. (I'm not sure if it still needs fixing, though 🤔)

The res.once binding was happening too late. Sometimes, res.end() would be called and the events would have already fired, preventing the callbacks from firing. This would cause the response to hang indefinitely.

The WIP h3@2 doesn't need this fix because it binds earlier:

h3/src/adapters.ts

Lines 75 to 80 in ac609aa

return new Promise((resolve, reject) => {
res.once("close", () => resolve(kHandled));
res.once("finish", () => resolve(kHandled));
res.once("pipe", () => resolve(kHandled));
res.once("error", (error) => reject(error));
try {

@pi0 pi0 added the v1 label Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants