-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
[8.x] n-api: backport changes from master #19265
[8.x] n-api: backport changes from master #19265
Conversation
d26ba32
to
afcc935
Compare
b4c9b34
to
b1223b3
Compare
Fixes nodejs/abi-stable-node#297. |
This also fails on an unrelated test: |
@gabrielschulhof we have generally backported every commit individually... that makes it easier to audit in the future and stop tooling from breaking @nodejs/lts thoughts on landing a single commit comprising of many patches? |
I'd rather backport each commit individually, although I'm +1 on it being in one PR (i.e. this one). @gabrielschulhof if you could split this into the individual commits that would be good. You don't need to change any commit metadata, so it should just be a case of cherry-picking and fixing merge conflicts. |
Can do.
…On Thu, Mar 22, 2018 at 11:45 AM, Gibson Fahnestock < ***@***.***> wrote:
@nodejs/lts <https://github.com/orgs/nodejs/teams/lts> thoughts on
landing a single commit comprising of many patches?
I'd rather backport each commit individually, although I'm +1 on it being
in one PR (i.e. this one). @gabrielschulhof
<https://github.com/gabrielschulhof> if you could split this into the
individual commits that would be good. You don't need to change any commit
metadata, so it should just be a case of cherry-picking and fixing merge
conflicts.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19265 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AA7k0UYxc8Ju-XtmJ8yYplmjJ0YArQK-ks5tg8c0gaJpZM4Sksat>
.
|
@gibfahn there are some commits where I've intentionally not applied parts of it even though they would've applied cleanly, because those parts were not related to N-API. |
b1223b3
to
c0b089c
Compare
@gibfahn @MylesBorins I have now replaced the single commit with the sometimes-partially cherry-picked individual commits. |
The same unrelated failure has reoccurred. |
So if you think those changes should be applied to 8.x then you should leave them in, we try to backport whole commits where possible, otherwise understanding what's been backported becomes even harder. If they don't need to go back to 8.x at all, then leaving them out is fine. Sorry to keep complaining about this PR, I really appreciate you doing this work! |
@gibfahn NP. We have to do things right. I'll do the cherry-picking again, being more inclusive. Any decisions I make I will document in a subsequent comment here. |
c0b089c
to
7ea7a32
Compare
@MylesBorins @gibfahn the list of commits from master: These are the places where I made a judgement call:
|
I'll close and open another because this needs to go on top of v8.x-staging. |
@gabrielschulhof Not sure if that’s what you mean by your last comment, but using the same button that you’d use to change a PR title, you can also change its base branch :) |
Backport-PR-URL: #19265 PR-URL: #18498 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Missing the length argument in napi_create_function. Backport-PR-URL: #19265 PR-URL: #18661 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
The timer in NAPI's test_callback_scope/test-resolve-async.js can be removed. If the test fails, it will timeout on its own. The extra timer increases the chances of the test being flaky. Backport-PR-URL: #19265 PR-URL: #18719 Fixes: #18702 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Documentation for N-API Custom Asynchronous Operations incorrectly stated that async execution happens on the main event loop. Added details to napi_create_async_work about which threads are used to invoke the execute and complete callbacks. Changed 'async' to 'asynchronous' in the documentation for Custom Asynchronous Operations. Changed "executes in parallel" to "can execute in parallel" for the documentation of napi_create_async_work execute parameter. Backport-PR-URL: #19265 PR-URL: #19073 Fixes: #19071 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Remove the necessity for allocating on the heap, and assert that the correct pointer gets passed to the finalizer. Backport-PR-URL: #19265 PR-URL: #19086 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Document which APIs work while an exception is pending. This is the list of all APIs which do not start with `NAPI_PREAMBLE(env)`. Fixes: nodejs/abi-stable-node#257 Backport-PR-URL: #19265 PR-URL: #19078 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
The last promise created by the test for the purposes of making sure that its type is indeed a promise needs to be resolved so as to avoid having it left in the pending state at the end of the test. Backport-PR-URL: #19265 PR-URL: #19245 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Added some simple tests to verify that the int64 API is correctly handling numbers greater than 32-bits. This is a basic test, but verifies that an implementer hasn't truncated back to 32-bits. Refs: nodejs/node-chakracore#496 Backport-PR-URL: #19265 PR-URL: #19309 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Backport-PR-URL: #19265 PR-URL: #19385 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Add checks for a pending exception in napi_make_callback after the callback has been invoked. If there is a pending exception then we need to avoid checking the result as that will not be able to complete properly. Add additional checks to the unit test for napi_make_callback to catch this case. Backport-PR-URL: #19265 PR-URL: #19362 Fixes: nodejs/node-addon-api#235 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Add function to trigger and uncaught exception. Useful if an async callback throws an exception with no way to recover. Backport-PR-URL: #19265 PR-URL: #19337 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This re-writes the test in C by dropping std::vector<napi_value> in favour of a C99 variable length array, and by dropping the anonymous namespace in favour of static function declarations. Backport-PR-URL: #19265 PR-URL: #19448 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Whenever we call into an addon, whether it is for a callback, for module init, or for async work-related reasons, we should make sure that * the last error is cleared, * the scopes before the call are the same as after, and * if an exception was thrown and captured inside the module, then it is re-thrown after the call. Therefore we should call into the module in a unified fashion. This change introduces the macro NAPI_CALL_INTO_MODULE() which should be used whenever invoking a callback provided by the module. Fixes: #19437 Backport-PR-URL: #19265 PR-URL: #19537 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
* Updated tests for `Number` and `int32_t` * Added new tests for `int64_t` * Updated N-API `int64_t` behavior to return zero for all non-finite numbers * Clarified the documentation for these calls. Backport-PR-URL: #19265 PR-URL: #19402 Refs: nodejs/node-chakracore#500 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
landed in 3225601...07a6770 edit: automated adding the backport-pr-url labels with the following command gitfilter-branch --msg-filter 'perl -pe "s/PR-URL/Backport-PR-URL: https://github.com//pull/19265\nPR-URL/g"' upstream/v8.x-staging..v8.x-staging |
It seems like e15f577 was only a partial backport of a test from a semver-minor commit... this will make it impossible for us to audit that semver-minor commit in the future if we wanted to land it. Were there any other commits / prs that were partially backported? |
@MylesBorins 2838f9b doesn't modify test/parallel/test-console-assign-undefined.js whereas the original does. I used git log --oneline 3225601...07a6770 | \
while read id message; do \
echo $id; \
diff -u \
<(git show --stat=99 $id | grep -vE '^commit|files changed' | grep '|') \
<(git log --oneline master | grep "$message" | awk '{print $1;}' | xargs \
git show --stat=99 | grep -vE '^commit|files changed' | grep '|'); \
done to check whether the files touched by the backported commits differ from the files touched by the commits on master. |
@gabrielf did that script identify Perhaps we should consider putting this into node-core-utils to help us with reviewing backports /cc @nodejs/automation |
@MylesBorins you are asking the wrong Gabriel... |
@gabrielf sorry! @MylesBorins it did. This was the output:
I didn't mention 4d43607 because there are two commits with the same message on master. |
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes