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

quic: use Check instead of FromJust in node_quic.cc #33937

Closed
wants to merge 1 commit into from

Conversation

danbev
Copy link
Contributor

@danbev danbev commented Jun 18, 2020

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Jun 18, 2020
@danbev
Copy link
Contributor Author

danbev commented Jun 18, 2020

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.

LGTM

@danbev Since you’re opening quite a few PRs of that kind … would you be interested in helping us move away from .Check()/.FromJust()/.ToLocalChecked() in places where those calls aren’t valid? So far I’ve mostly been trying to avoid that new code uses those inaccurately, but it would of course be nice to also make this work for code like this, where neither .FromJust() nor .Check() are really correct :)

@addaleax addaleax added quic Issues and PRs related to the QUIC implementation / HTTP/3. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Jun 19, 2020
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Jun 19, 2020

@jasnell jasnell added the experimental Issues and PRs related to experimental features. label Jun 19, 2020
@danbev
Copy link
Contributor Author

danbev commented Jun 21, 2020

would you be interested in helping us move away from .Check()/.FromJust()/.ToLocalChecked() in places where those calls aren’t valid?

I'd be happy to. Could you give me an example of where these calls are not valid so I understand the reason for them not being valid?

@addaleax
Copy link
Member

@danbev I think the description in https://github.com/nodejs/node/blob/master/src/README.md#checked-conversion might be helpful? The tl;dr is that anything that potentially runs JS code, including built-in V8 JS code or getters/setters on built-in object’s prototypes, can fail and thus result in a crash.

For example, in this particular case:

$ node -e 'Object.defineProperty(Object.prototype, "sessionConfig", {set() { throw new Error(); }}); net.createQuicSocket()'
FATAL ERROR: v8::FromJust Maybe value is Nothing.
[...]

(I know that these .Check()/.FromJust()/.ToLocalChecked() patterns are pervasive in our code base, but eventually, I would like to remove all the ones that can make Node.js crash hard.)

@danbev
Copy link
Contributor Author

danbev commented Jun 22, 2020

Re-run of failing node-test-commit-arm-fanned ✔️

@danbev
Copy link
Contributor Author

danbev commented Jun 22, 2020

@addaleax Thanks, I'll try to take a closer look this week.

danbev added a commit that referenced this pull request Jun 22, 2020
PR-URL: #33937
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@danbev
Copy link
Contributor Author

danbev commented Jun 22, 2020

Landed in 013cd1a.

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++. experimental Issues and PRs related to experimental features. quic Issues and PRs related to the QUIC implementation / HTTP/3.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants