-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
test: http2 rstStream duplicate call #16217
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -15,12 +15,15 @@ server.on('listening', common.mustCall(() => { | |||||||||||||||||||||
const client = h2.connect(`http://localhost:${server.address().port}`); | ||||||||||||||||||||||
|
||||||||||||||||||||||
const req = client.request({ ':path': '/' }); | ||||||||||||||||||||||
// make sure that destroy is called twice | ||||||||||||||||||||||
req._destroy = common.mustCall(req._destroy.bind(req), 2); | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am a bit lost in how this is possible, in theory it is protected from running There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was confusing for me too.
This might translate to two calls of I've run the test on repeat 100 times to confirm that it it succeeds using the following command:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe @mcollina is right. I think what's happening is that this line is accounting for the 2 triggers of _destroy: node/lib/internal/http2/core.js Lines 1494 to 1498 in ff747e3
The reason that it's different than before is because the declaration was moved before ping @jasnell — any thoughts re: whether that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@trivikr the test might be passing, but I'm wondering if the actual behavior is correct. I don't think that calling node/lib/internal/http2/core.js Lines 929 to 931 in ff747e3
cc @jasnell There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll dig in on this a bit more later on today |
||||||||||||||||||||||
|
||||||||||||||||||||||
client.rstStream(req, 0); | ||||||||||||||||||||||
// redundant call to rstStream with new code | ||||||||||||||||||||||
client.rstStream(req, 1); | ||||||||||||||||||||||
// confirm that rstCode is from the first call to rstStream | ||||||||||||||||||||||
assert.strictEqual(req.rstCode, 0); | ||||||||||||||||||||||
|
||||||||||||||||||||||
// make sure that destroy is called | ||||||||||||||||||||||
req._destroy = common.mustCall(req._destroy.bind(req)); | ||||||||||||||||||||||
|
||||||||||||||||||||||
req.on('streamClosed', common.mustCall((code) => { | ||||||||||||||||||||||
assert.strictEqual(req.destroyed, true); | ||||||||||||||||||||||
assert.strictEqual(code, 0); | ||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! :-)