-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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 <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Backport-PR-URL: #19265 PR-URL: #18581 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
Missing the length argument in napi_create_function. Backport-PR-URL: #19265 PR-URL: #18661 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
Backport-PR-URL: #19265 PR-URL: #18697 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
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 <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
Passing a pointer to a static integer is sufficient for the test. Backport-PR-URL: #19265 PR-URL: #19039 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Hitesh Kanwathirtha <[email protected]>
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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
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 <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
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 <[email protected]>
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 <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Added a N-API test to verify new.target behavior. Backport-PR-URL: #19265 PR-URL: #19236 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
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 <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: James M Snell <[email protected]>
Backport-PR-URL: #19265 PR-URL: #19385 Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
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 <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Place the test_make_callback async_hooks-related test into its own file. Backport-PR-URL: #19265 PR-URL: #19392 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
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 <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
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 <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Backport-PR-URL: #19265 PR-URL: #19555 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
Bump the version due to additions to the api. Backport-PR-URL: #19265 PR-URL: #19497 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
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 <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Heed the comment to not use fields of a Reference after calling its finalize callback, because such a call may destroy the Reference. Fixes: #19673 Backport-PR-URL: #19265 PR-URL: #19718 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
* 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 <[email protected]> Reviewed-By: James M Snell <[email protected]>
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