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: handle TryCatch with empty message #20708

Closed
wants to merge 1 commit into from

Conversation

bnoordhuis
Copy link
Member

@bnoordhuis bnoordhuis commented May 13, 2018

This bug needs a test case with a high goldilocks factor to trigger
but the synopsis is that v8::TryCatch::Message() returns an empty
handle when the TryCatch is declared at a time when an exception is
already pending.

We now recompute the message inside node::ReportException() and
all is well again.

Fixes: #8854
CI: https://ci.nodejs.org/job/node-test-pull-request/14850/
CI: https://ci.nodejs.org/job/node-test-pull-request/14851/
CI: https://ci.nodejs.org/job/node-test-pull-request/14861/ (minor test tweaks)

@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label May 13, 2018
// This test is convoluted because it needs to trigger a callback
// into JS land at just the right time when an exception is pending,
// and does so by exploiting a weakness in the streams infrastructure.
// I won't shed any tears if this test ever becomes invalidated.
Copy link
Member

Choose a reason for hiding this comment

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

I'm sorry if I'm being dense, but can you explain what you mean by this comment? I'm not sure what you mean exactly by "becomes invalidated". Does that mean "becomes unnecessary" in this context? Or maybe it means "stops working"? Or something else?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unnecessary, yes, as in "no longer tests this particular condition because node's internals changed."

Copy link
Member

Choose a reason for hiding this comment

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

Ah, literally invalidated like you wrote initially, just I was thinking about it wrong. I get it now. Thanks.

This bug needs a test case with a high goldilocks factor to trigger
but the synopsis is that `v8::TryCatch::Message()` returns an empty
handle when the TryCatch is declared at a time when an exception is
already pending.

We now recompute the message inside `node::ReportException()` and
all is well again.

Fixes: nodejs#8854
@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 15, 2018
@apapirovski
Copy link
Member

Landed in de4e0d7

apapirovski pushed a commit that referenced this pull request May 16, 2018
This bug needs a test case with a high goldilocks factor to trigger
but the synopsis is that `v8::TryCatch::Message()` returns an empty
handle when the TryCatch is declared at a time when an exception is
already pending.

We now recompute the message inside `node::ReportException()` and
all is well again.

PR-URL: #20708
Fixes: #8854
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
MylesBorins pushed a commit that referenced this pull request May 22, 2018
This bug needs a test case with a high goldilocks factor to trigger
but the synopsis is that `v8::TryCatch::Message()` returns an empty
handle when the TryCatch is declared at a time when an exception is
already pending.

We now recompute the message inside `node::ReportException()` and
all is well again.

PR-URL: #20708
Fixes: #8854
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
@addaleax addaleax mentioned this pull request May 22, 2018
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++.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants