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

zlib: throw brotli initialization error from c++ #54698

Closed
wants to merge 1 commit into from

Conversation

anonrig
Copy link
Member

@anonrig anonrig commented Sep 1, 2024

Completes a 6 year old TODO by @addaleax introduced at 73753d4

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Sep 1, 2024
@anonrig anonrig force-pushed the yagiz/zlib-throw-err branch 3 times, most recently from 899e914 to 25d076f Compare September 1, 2024 16:53
Copy link

codecov bot commented Sep 1, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 88.07%. Comparing base (a65105e) to head (fef6ffc).
Report is 98 commits behind head on main.

Files with missing lines Patch % Lines
src/node_zlib.cc 66.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #54698   +/-   ##
=======================================
  Coverage   88.07%   88.07%           
=======================================
  Files         651      651           
  Lines      183538   183530    -8     
  Branches    35862    35862           
=======================================
- Hits       161647   161645    -2     
+ Misses      15136    15135    -1     
+ Partials     6755     6750    -5     
Files with missing lines Coverage Δ
lib/internal/errors.js 94.91% <ø> (-0.01%) ⬇️
lib/zlib.js 98.40% <100.00%> (-0.02%) ⬇️
src/node_errors.h 84.21% <ø> (ø)
src/node_zlib.cc 78.49% <66.66%> (ø)

... and 34 files with indirect coverage changes

@anonrig
Copy link
Member Author

anonrig commented Sep 1, 2024

cc @nodejs/cpp-reviewers

@RedYetiDev RedYetiDev added the zlib Issues and PRs related to the zlib subsystem. label Sep 1, 2024
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

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

@nodejs-github-bot

This comment was marked as outdated.

Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

No strong feelings about the code being moved around, but the TODO comment here is about the error codes themselves, not where they are thrown, so it should be moved as well

@@ -816,14 +815,8 @@ function Brotli(opts, mode) {
new binding.BrotliDecoder(mode) : new binding.BrotliEncoder(mode);

this._writeState = new Uint32Array(2);
// TODO(addaleax): Sometimes we generate better error codes in C++ land,
// e.g. ERR_BROTLI_PARAM_SET_FAILED -- it's hard to access them with
// the current bindings setup, though.
Copy link
Member

Choose a reason for hiding this comment

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

Please don't remove this TODO comment until it's actually addressed :)

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I misunderstood the TODO in here. Can you explain if you don't mind?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, the TODO is about surfacing the actual error codes we get from the underlying library, instead of a generic "initialization failed" error code – ERR_BROTLI_PARAM_SET_FAILED being one example of that

Copy link
Member Author

Choose a reason for hiding this comment

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

I reverted the change. Thank you for the review.

Copy link
Member

@addaleax addaleax Sep 11, 2024

Choose a reason for hiding this comment

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

Do you want to move the TODO comment along to the new throw sites?

Copy link
Member Author

Choose a reason for hiding this comment

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

I moved it. There is 2 occurrences where we throw the error on C++. For the sake of reducability, I just kept the TODO on one of them.

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@anonrig anonrig added the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 11, 2024
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Sep 11, 2024
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/54698
✔  Done loading data for nodejs/node/pull/54698
----------------------------------- PR info ------------------------------------
Title      zlib: throw brotli initialization error from c++ (#54698)
Author     Yagiz Nizipli <[email protected]> (@anonrig)
Branch     anonrig:yagiz/zlib-throw-err -> nodejs:main
Labels     c++, zlib, lib / src, needs-ci
Commits    1
 - zlib: throw brotli initialization error from c++
Committers 1
 - Yagiz Nizipli <[email protected]>
PR-URL: https://github.com/nodejs/node/pull/54698
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: James M Snell <[email protected]>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/54698
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: James M Snell <[email protected]>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Sun, 01 Sep 2024 16:50:17 GMT
   ✘  Requested Changes: 1
   ✘  - Anna Henningsen (@addaleax): https://github.com/nodejs/node/pull/54698#pullrequestreview-2278408395
   ✔  Approvals: 3
   ✔  - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/54698#pullrequestreview-2275983863
   ✔  - Gerhard Stöbich (@Flarna): https://github.com/nodejs/node/pull/54698#pullrequestreview-2297007257
   ✔  - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/54698#pullrequestreview-2277663481
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2024-09-11T02:55:54Z: https://ci.nodejs.org/job/node-test-pull-request/62297/
- Querying data for job/node-test-pull-request/62297/
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/10812657737

@addaleax
Copy link
Member

@anonrig feel free to dismiss my review if you think the TODO comment should remain where it is (it doesn't make sense to me in its current location where it's pretty unclear now what kind of error it's talking about)

@anonrig
Copy link
Member Author

anonrig commented Sep 12, 2024

@anonrig feel free to dismiss my review if you think the TODO comment should remain where it is (it doesn't make sense to me in its current location where it's pretty unclear now what kind of error it's talking about)

I'll move the comment location, just didn't had any time yet.

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@RedYetiDev RedYetiDev removed the commit-queue-failed An error occurred while landing this pull request using GitHub Actions. label Sep 19, 2024
jasnell pushed a commit that referenced this pull request Sep 21, 2024
PR-URL: #54698
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@jasnell
Copy link
Member

jasnell commented Sep 21, 2024

Landed in 5b3f3c5

@jasnell jasnell closed this Sep 21, 2024
targos pushed a commit that referenced this pull request Oct 4, 2024
PR-URL: #54698
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@aduh95 aduh95 mentioned this pull request Oct 9, 2024
louwers pushed a commit to louwers/node that referenced this pull request Nov 2, 2024
PR-URL: nodejs#54698
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. zlib Issues and PRs related to the zlib subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants