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

[v10.x] backport #26599 (process: add --unhandled-rejections flag) #29036

Closed
wants to merge 2 commits into from

Conversation

BridgeAR
Copy link
Member

@BridgeAR BridgeAR commented Aug 7, 2019

Backporting #26599 was not completely trivial, since there where so many changes that required a work around. Functionality wise it should now be identical.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

This adds a flag to define the default behavior for unhandled
rejections. Three modes exist: `none`, `warn` and `strict`. The first
is going to silence all unhandled rejection warnings. The second
behaves identical to the current default with the excetion that no
deprecation warning will be printed and the last is going to throw
an error for each unhandled rejection, just as regular exceptions do.
It is possible to intercept those with the `uncaughtException` hook
as with all other exceptions as well.

This PR has no influence on the existing `unhandledRejection` hook.
If that is used, it will continue to function as before.

PR-URL: nodejs#26599
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
@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. v10.x labels Aug 7, 2019
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@BridgeAR
Copy link
Member Author

@addaleax would you be so kind and have a look at this? Seems like one test fails when run inside of a worker (in the freestyle test suite) and I am not able to reproduce this locally and I don't see any issue with the code as it is :/.

@addaleax addaleax added the semver-minor PRs that contain new features and should be released in the next minor version. label Sep 24, 2019
@addaleax
Copy link
Member

@BridgeAR The assert.strictEqual(origin, 'unhandledRejection', err); line in the uncaughtException handler is failing because origin === 'unhandledException' in the second call. Having err as the third argument to assert.strictEqual is what’s masking the issue here.

As for reproducing, ./node --experimental-worker --unhandled-rejections=strict tools/run-worker.js test/parallel/test-promise-unhandled-error.js works for me.

@BridgeAR
Copy link
Member Author

@addaleax the test itself should work though. It works fine on v12 and master but fails with this backport while being executed in a worker.

This adds a missing return value for the worker specific fatal
exception handler.
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

BethGriggs pushed a commit that referenced this pull request Oct 15, 2019
This adds a missing return value for the worker specific fatal
exception handler.

PR-URL: #29036
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
@BethGriggs
Copy link
Member

Landed on v10.x-staging

@BethGriggs BethGriggs closed this Oct 15, 2019
@BethGriggs BethGriggs mentioned this pull request Oct 18, 2019
@BridgeAR BridgeAR deleted the v10.x-backport-26599 branch January 20, 2020 12:05
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. semver-minor PRs that contain new features and should be released in the next minor version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants