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

src,http2: ensure cleanup if a frame is not sent #47244

Merged
merged 2 commits into from Mar 30, 2023

Conversation

ywave620
Copy link
Contributor

Fix 41582
Call to JS and close the session if a frame is not sent even there is no frameError listener registered by user.

Call to JS and close the session if a frame is not sent
even there is no frameError listener registered by user.
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/http2
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. http2 Issues or PRs related to the http2 subsystem. needs-ci PRs that need a full CI run. labels Mar 24, 2023
@ywave620
Copy link
Contributor Author

The evidence of the absence of 'frameError' listener is the blame is that if you add such a listener to the http2Session in the server side in the test, client can get a response.
This PR ensures 'onFrameError' in JS, which takes care of cleanup get called even if no user registered 'frameError' listener.

// Called by the native layer when an error has occurred sending a
// frame. This should be exceedingly rare.
function onFrameError(id, type, code) {
const session = this[kOwner];
if (session.destroyed)
return;
debugSessionObj(session, 'error sending frame type %d on stream %d, code: %d',
type, id, code);
const emitter = session[kState].streams.get(id) || session;
emitter[kUpdateTimer]();
emitter.emit('frameError', type, code, id);
session[kState].streams.get(id).close(code);
session.close();
}

@RafaelGSS RafaelGSS added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 24, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 24, 2023
@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@ywave620
Copy link
Contributor Author

Don't know what was going on, many tests ended up with no report generated, likes
image

Could anyone re-run the CI?

@nodejs-github-bot
Copy link
Collaborator

@ywave620
Copy link
Contributor Author

@mcollina are we ready to merge this? :)

Copy link
Member

@RafaelGSS RafaelGSS left a comment

Choose a reason for hiding this comment

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

I was afraid it would revert the memory leak fix I did a while ago. But, the since the CI is green I think we are good. LGTM.

@RafaelGSS RafaelGSS added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 30, 2023
@mcollina mcollina added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Mar 30, 2023
@mcollina
Copy link
Member

@RafaelGSS could you reopen that issue?

@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 30, 2023
@nodejs-github-bot nodejs-github-bot merged commit 18e1f3c into nodejs:main Mar 30, 2023
61 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 18e1f3c

@RafaelGSS
Copy link
Member

@RafaelGSS could you reopen that issue?

Why? I meant I didn't approve this PR before because I was waiting for the CI to run to guarantee this won't bring back the memory leak issue.

RafaelGSS pushed a commit that referenced this pull request Apr 5, 2023
Call to JS and close the session if a frame is not sent
even there is no frameError listener registered by user.

PR-URL: #47244
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
@RafaelGSS RafaelGSS mentioned this pull request Apr 6, 2023
RafaelGSS pushed a commit that referenced this pull request Apr 6, 2023
Call to JS and close the session if a frame is not sent
even there is no frameError listener registered by user.

PR-URL: #47244
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
RafaelGSS pushed a commit that referenced this pull request Apr 7, 2023
Call to JS and close the session if a frame is not sent
even there is no frameError listener registered by user.

PR-URL: #47244
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
danielleadams pushed a commit that referenced this pull request Jul 6, 2023
Call to JS and close the session if a frame is not sent
even there is no frameError listener registered by user.

PR-URL: #47244
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. http2 Issues or PRs related to the http2 subsystem. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

http2: receiving a request with a header exceeding the max threshold hangs indefinitely
4 participants