Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upn-api: back up env before async work finalize #21129
Conversation
nodejs-github-bot
added
C++
dont-land-on-v4.x
dont-land-on-v6.x
n-api
labels
Jun 4, 2018
This comment has been minimized.
This comment has been minimized.
|
I'm not sure if it makes any sense to add a test like this one, but finite. |
gabrielschulhof
requested a review
from
addaleax
Jun 4, 2018
This comment has been minimized.
This comment has been minimized.
|
Considering this fixes a regression, I'd say a test should be added. |
This comment has been minimized.
This comment has been minimized.
|
@MayhemYDG the problem is it's a memory corruption regression, so a 100% reliable test is hard to create. After all, when c072057 introduced the regression, the async work test which we already have should have segfaulted but didn't. My only thought with the above comment was to add a second test which essentially runs the first test over and over and over, because that's what I used for reproducing. But you're right - I think I'll add a test like the one in the gist, with, say, 500 iterations. Hopefully in that many iterations it will crash if we ever again have such a bug. |
gabrielschulhof
force-pushed the
gabrielschulhof:napi-delete-async-work
branch
from
18a98d9
to
2853b40
Jun 5, 2018
This comment has been minimized.
This comment has been minimized.
|
Well, the test I added crashes before the fix and passes after the fix, so FWIW, it captures the fix. |
This comment has been minimized.
This comment has been minimized.
gabrielschulhof
force-pushed the
gabrielschulhof:napi-delete-async-work
branch
from
2853b40
to
a3b4c9e
Jun 5, 2018
This comment has been minimized.
This comment has been minimized.
gabrielschulhof
force-pushed the
gabrielschulhof:napi-delete-async-work
branch
from
a3b4c9e
to
c7b1950
Jun 6, 2018
This comment has been minimized.
This comment has been minimized.
|
sigh ... forgot to set the name of the async context - weird that it did not throw in debug mode O_o Here's another CI: https://ci.nodejs.org/job/node-test-pull-request/15273/ |
apapirovski
approved these changes
Jun 6, 2018
This comment has been minimized.
This comment has been minimized.
|
@gabrielschulhof |
refack
approved these changes
Jun 6, 2018
This comment has been minimized.
This comment has been minimized.
|
I'm +1 to land this after only 40h so it make it into 10.4.0, since the most significant stakeholders are aware of this. |
This comment has been minimized.
This comment has been minimized.
|
@refack OK, landing it then. |
gabrielschulhof
added a commit
that referenced
this pull request
Jun 6, 2018
This comment has been minimized.
This comment has been minimized.
|
landed in 991f406 |
MylesBorins
closed this
Jun 6, 2018
gabrielschulhof
deleted the
gabrielschulhof:napi-delete-async-work
branch
Jun 6, 2018
targos
added a commit
that referenced
this pull request
Jun 7, 2018
shisama
added a commit
to shisama/node
that referenced
this pull request
Jun 9, 2018
shisama
added a commit
to shisama/node
that referenced
this pull request
Jun 11, 2018
shisama
added a commit
to shisama/node
that referenced
this pull request
Jun 12, 2018
shisama
added a commit
to shisama/node
that referenced
this pull request
Jun 17, 2018
MylesBorins
added
the
backport-requested-v8.x
label
Jul 9, 2018
This comment has been minimized.
This comment has been minimized.
|
Should this be backported to |
This comment has been minimized.
This comment has been minimized.
|
@MylesBorins this actually fixes a regression introduced by c072057, so, unless we backport that commit too, we need not backport this commit. As it stands, it doesn't look like that commit was backported to v8.x. |
gabrielschulhof commentedJun 4, 2018
We must back up the value of
_envbefore calling the async workcomplete callback, because the complete callback may delete the
instance in which
_envis stored by callingnapi_delete_async_work,and because we need to use it after the complete callback has
completed.
Fixes: #20966
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes