-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 simplify reply sent monitoring #3079
Fix simplify reply sent monitoring #3079
Conversation
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.
Why weren't any tests failing in CI before this change?
There is this PR that is failing #2862 on that test file. I was trying it locally but it passes so I was really confused about that tho I don't know why my pipeline was failing and the other one no 😞 |
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.
lgtm
@Eomm I don't understand, do you approve this change? |
They were, but due to unrelated reason https://github.com/fastify/fastify/actions/runs/846451395. CI should be manually re-run I guess. |
No, I didn't get the chance to check this PR deeply, I was pointing out that this PR should fix the other one pipeline 🤞🏽 |
GitHub Actions was having some issues at the time the initial PR was being considered. Unfortunately, we merged without waiting for those to be resolved and re-running the jobs to make sure everything was green. I just re-ran them, and sure enough, the HTTP2 tests fail -- https://github.com/fastify/fastify/pull/3072/checks?check_run_id=2600626970#step:6:9795 |
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.
Looks good to me.
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Checklist
npm run test
andnpm run benchmark
and the Code of conduct
After another review, I noticed a problem with my previous PR #3072.
I figured out that when http2 is used and the request method is "HEAD",
response.finished
will be always true (my understanding after reading https://nodejs.org/api/http2.html#http2_response_finished was that it behaves the same way asresponse.writableEnded
, since that is suggested as a replacement). This is problematic with Node.js versions prior to 12.9.0 whereresponse.writableEnded
does not exist.#2233 was made to cope with this problem, but it relied on
response.writable
, which by my testing will stay true even after the response has ended, so we cannot use it as an indicator.Therefore, I added additional check, so now both
response.finished
as well asresponse.headersSent
has to be true in order for reply to be considered sent. This change only applies for Node.js versions prior to 12.9.0 because newer versions will be usingresponse.writableEnded
which works correctly.I also removed additional checks from
preValidationCallback
andpreHandlerCallback
that I missed, which were introduced by #2233. They are not needed any more with the new way that thereply.sent
works.PS: The
test/http2/head.test.js
was supposed to fail before on node10, but I only noticed that in my local environment today. Therefore I didn't include any new tests, since the part that this PR targets is already covered by an existing test.I'm sorry for any inconvenience caused.