Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
n-api: handle reference delete before finalize#24494
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
mhdawson commented Nov 19, 2018 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot commented Nov 19, 2018
@mhdawson sadly an error occured when I tried to trigger a build :( |
mhdawson commented Nov 19, 2018
@hashseed would be good to get somebody from the V8 team to comment on the issue as well since it new gc behaviour seems to be the trigger for us finding the issue. @gabrielschulhof I know you had run into some issues that resulted in the original code to handle the Reference being deleted in the callback. Would be good to get your review as well. |
addaleax commented Nov 19, 2018
This looks like it already needs a rebase? Plus, it might be nice to have a test for this or so… |
mhdawson commented Nov 19, 2018
Rebasing as we speak... |
2d127df to e4cb28eComparemhdawson commented Nov 19, 2018
Rebased. Was planning to look at a test but I likely won't get to that later in the week. |
sam-github commented Nov 19, 2018
@mhdawson commit message has deletion misspelled as "deleteion" |
Crashes were reported during finalization due to the memory for a reference being deleted and the finalizer running after the deletion. This change ensures the deletion of the memory for the reference only occurs after the finalizer has run. Fixes: nodejs/node-addon-api#393
e4cb28e to af87a67Comparemhdawson commented Nov 19, 2018
@sam-github, thanks fixed. |
gabrielschulhof commented Nov 22, 2018
mhdawson commented Nov 22, 2018
@gabrielschulhof that might help me with the test :) |
mhdawson commented Nov 22, 2018
Ok, test added. Validated that the test fails consistently without the fix and passes with it :) @addaleax should be good to go now. |
mhdawson commented Nov 22, 2018
mhdawson commented Nov 22, 2018 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
and thanks to @toddwong for the basis of the test. I'm surprised it was straightforward to have a test that recreates relatively easily and that runs in a short time period. |
mhdawson commented Nov 22, 2018
CI run was good, will plan to land tomorrow unless there are any additional comments/objections. |
refack commented Nov 23, 2018
@mhdawson I'm assuming you didn't mean to close this? |
toddwong commented Nov 23, 2018
@mhdawson Ahh! Pleased to know that was helping 😄 And thanks for the fix! |
codebytere commented Jan 13, 2019
@mhdawson could you potentially backport this to |
Crashes were reported during finalization due to the memory for a reference being deleted and the finalizer running after the deletion. This change ensures the deletion of the memory for the reference only occurs after the finalizer has run. Fixes: nodejs/node-addon-api#393 PR-URL: nodejs#24494 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
mhdawson commented Jan 17, 2019
@codebytere will add to my TODO list. |
Crashes were reported during finalization due to the memory for a reference being deleted and the finalizer running after the deletion. This change ensures the deletion of the memory for the reference only occurs after the finalizer has run. Fixes: nodejs/node-addon-api#393 Backport-PR-URL: nodejs#25572 PR-URL: nodejs#24494 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
mhdawson commented Jan 18, 2019
@codebytere backport PR as requested: #25574 |
mhdawson commented Jan 18, 2019
@codebytere thanks for reminding me on this one, it is important to get back to 10.x and I should have thought of getting it done earlier. |
mhdawson commented Jan 22, 2019
@codebytere PR for backport as requested: #25574 |
Crashes were reported during finalization due to the memory for a reference being deleted and the finalizer running after the deletion. This change ensures the deletion of the memory for the reference only occurs after the finalizer has run. Fixes: nodejs/node-addon-api#393 Backport-PR-URL: nodejs#25574 PR-URL: nodejs#24494 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
Crashes were reported during finalization due to the memory for a reference being deleted and the finalizer running after the deletion. This change ensures the deletion of the memory for the reference only occurs after the finalizer has run. Fixes: nodejs/node-addon-api#393 Backport-PR-URL: #25574 PR-URL: #24494 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
Crashes were reported during finalization due to the memory for a reference being deleted and the finalizer running after the deletion. This change ensures the deletion of the memory for the reference only occurs after the finalizer has run. Fixes: nodejs/node-addon-api#393 Backport-PR-URL: #25574 PR-URL: #24494 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
nodejs#24494 fixed a crash but resulted in increased stress on gc finalization. A leak was reported in nodejs#26667 which we are still investigating. As part of this investigation I realized we can optimize to reduce amount of deferred finalization. Regardless of the root cause of the leak this should be a good optimization. It also resolves the leak for the case being reported in nodejs#26667. The OP in 26667 has confirmed that he can still recreate the original problem that 24494 fixed and that the fix still works with this optimization
#24494 fixed a crash but resulted in increased stress on gc finalization. A leak was reported in #26667 which we are still investigating. As part of this investigation I realized we can optimize to reduce amount of deferred finalization. Regardless of the root cause of the leak this should be a good optimization. It also resolves the leak for the case being reported in #26667. The OP in 26667 has confirmed that he can still recreate the original problem that 24494 fixed and that the fix still works with this optimization PR-URL: #27085 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Crashes were reported during finalization due to
the memory for a reference being deleted and the
finalizer running after the deletion.
This change ensures the deletion of the memory for
the reference only occurs after the finalizer has run.
Fixes: nodejs/node-addon-api#393
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes