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 early event loop exit on nodejs when H2 sessions are in the verify state #861

Merged
merged 4 commits into from
Oct 4, 2023

Conversation

srikrsna-buf
Copy link
Member

@srikrsna-buf srikrsna-buf commented Oct 3, 2023

Fix early event loop exit on nodejs when H2 sessions are in the verify state. We unref the connections to avoid idle connections stopping the process from exiting. This results in a case where process exits when verification is required (last pinged time elapsed ping interval). We always ref before a manual ping and unref if it succeeds with empty streams.

Used a worker to test the behavior. Not super happy about it but seemed better than a child process.

Fixes #860.

@srikrsna-buf srikrsna-buf marked this pull request as ready for review October 3, 2023 08:17
Copy link
Member

@timostamm timostamm left a comment

Choose a reason for hiding this comment

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

LGTM.

Can you update the PR title description with more details? They are basically our changelog, and we should take the extra couple of minutes it takes to make it really easy to see what's changed from release notes, with a link to a PR providing details.

For example, this PR title:

Fix early event loop exit on Node.js when H2 sessions are in the verify state

... would be more likely to ring a bell for a user who saw an unexpected early exit in their client app.

@@ -2,3 +2,4 @@
/*.json
/dist/*/**/*.spec.js
/dist/*/**/*.spec.d.ts
/dist/*/testdata/
Copy link
Member

Choose a reason for hiding this comment

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

🙏

Comment on lines +171 to +172
it("verify should keep the process alive", async function () {
const worker = new Worker(
Copy link
Member

Choose a reason for hiding this comment

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

Great idea to use a worker instead of a child process. I don't see an alternative to test the actual outcome, and I think it's worth it.

@srikrsna-buf srikrsna-buf changed the title Always ref before ping Fix early event loop exit on node when H2 sessions are in the verify state Oct 4, 2023
@srikrsna-buf srikrsna-buf changed the title Fix early event loop exit on node when H2 sessions are in the verify state Fix early event loop exit on nodejs when H2 sessions are in the verify state Oct 4, 2023
@srikrsna-buf srikrsna-buf merged commit b5a4f3c into main Oct 4, 2023
7 checks passed
@srikrsna-buf srikrsna-buf deleted the sk/fix-unverified-ping branch October 4, 2023 09:20
@srikrsna-buf srikrsna-buf mentioned this pull request Oct 4, 2023
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.

Pinging idle connection before sending request is ignored and node process exits unexpectedly
2 participants