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(ext/node): close upgraded socket when the underlying http connection is closed #25387

Conversation

kt3k
Copy link
Member

@kt3k kt3k commented Sep 3, 2024

This PR fixes the handling of upgraded socket from node:http module.

In op_node_http_fetch_response_upgrade, we create DuplexStream paired with hyper::upgrade::Upgraded. When the connection is closed from the server, the read result from Upgraded becomes 0. However because we don't close the paired DuplexStream at that point, the Socket object in JS side keeps alive even after the server closed. That caused the issue #20179

This change fixes it by closing the paired DuplexStream when the Upgraded stream returns 0 read result.

closes #20179

Copy link
Contributor

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

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

Nice find! Changes look good to me, just two minor linting errors to take care of 👍

@kt3k kt3k marked this pull request as draft September 4, 2024 06:22
@kt3k kt3k added the ci-draft Run the CI on draft PRs. label Sep 4, 2024
@kt3k kt3k marked this pull request as ready for review September 4, 2024 16:32
@kt3k
Copy link
Member Author

kt3k commented Sep 5, 2024

CI doesn't seem flaky now. Landing

@kt3k kt3k changed the title fix(ext/node): close upgraded socket when the connection is closed fix(ext/node): close upgraded socket when the underlying http connection is closed Sep 5, 2024
@kt3k kt3k merged commit 186f748 into denoland:main Sep 5, 2024
33 checks passed
@kt3k kt3k deleted the fix-ext-node-close-upgraded-socket-when-the-connection-closed branch September 5, 2024 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-draft Run the CI on draft PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Puppeteer issues
2 participants