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

local fatal error for test/js-native-api/test_object/test.js #38040

Closed
targos opened this issue Apr 2, 2021 · 10 comments
Closed

local fatal error for test/js-native-api/test_object/test.js #38040

targos opened this issue Apr 2, 2021 · 10 comments
Labels
node-api Issues and PRs related to the Node-API. test Issues and PRs related to the tests.

Comments

@targos
Copy link
Member

targos commented Apr 2, 2021

Platform: macOS arm64

I don't know when it started exactly.

$  out/Release/node test/js-native-api/test_object/test.js
node(1489,0x1095dfd40) malloc: *** error for object 0x13cf049e0: pointer being freed was not allocated
node(1489,0x1095dfd40) malloc: *** set a breakpoint in malloc_error_break to debug
[1]    1489 abort      out/Release/node

Sometimes it fails with this abort, other times with a segmentation fault.

@targos targos added the test Issues and PRs related to the tests. label Apr 2, 2021
@targos
Copy link
Member Author

targos commented Apr 2, 2021

Process 31710 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
    frame #0: 0x0000000100180fe4 node`v8impl::(anonymous namespace)::Reference::SecondPassCallback(data=0x000000016fdf62e0)::Reference> const&) at js_native_api_v8.cc:405:26
   402    }
   403 
   404    static void SecondPassCallback(const v8::WeakCallbackInfo<Reference>& data) {
-> 405      data.GetParameter()->Finalize();
   406    }
   407 
   408    v8impl::Persistent<v8::Value> _persistent;
Target 0: (node) stopped.

@targos
Copy link
Member Author

targos commented Apr 2, 2021

@nodejs/node-api

@gabrielschulhof gabrielschulhof added the node-api Issues and PRs related to the Node-API. label Apr 2, 2021
@gabrielschulhof
Copy link
Contributor

This may be an indication that V8 is not removing the weak callback once queued, even though we are calling ClearWeak() from the environment teardown-induced finalization loop. We may want to consider the alternative solution mentioned in #37616 (comment) to see if that prevents this problem.

@mhdawson
Copy link
Member

mhdawson commented Apr 9, 2021

This may be related: #38000

@legendecas
Copy link
Member

@targos it will be helpful to share the node version that you are testing against. thanks!

@gabrielschulhof the tricky thing is that the ClearWeak() is expected to be called during the first pass callback. So that is the API contract that ClearWeak() will not clear the second pass callback. I've submitted an issue to v8 to discuss this https://bugs.chromium.org/p/v8/issues/detail?id=11608 . And as a fix from node when the cancellation of second pass callback is not available, I've submitted #38000 to address the issue.

@targos
Copy link
Member Author

targos commented Apr 11, 2021

@legendecas I'm testing with the master branch.

@targos
Copy link
Member Author

targos commented Apr 14, 2021

Saw it crash in a GitHub workflow too: https://github.com/nodejs/node/runs/2338974533

@richardlau
Copy link
Member

The GitHub Actions build-tarball workflow has been consistently failing due to this test crashing after 78343bb / #37263: https://github.com/nodejs/node/actions/workflows/build-tarball.yml?query=branch%3Amaster
image

@BethGriggs
Copy link
Member

Does it make sense to temporarily revert 78343bb / #37263 to see if that brings us back to passing actions runs?

cc: @ExE-Boss, @aduh95

@jasnell
Copy link
Member

jasnell commented Apr 15, 2021

It looks like #38250 may fix this.

targos pushed a commit that referenced this issue May 1, 2021
PR-URL: #38250
Fixes: #38040
Reviewed-By: Beth Griggs <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
danielleadams pushed a commit that referenced this issue May 8, 2021
PR-URL: #38250
Fixes: #38040
Reviewed-By: Beth Griggs <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
legendecas pushed a commit to legendecas/node that referenced this issue Mar 29, 2022
PR-URL: nodejs#38250
Fixes: nodejs#38040
Reviewed-By: Beth Griggs <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
richardlau pushed a commit that referenced this issue Mar 30, 2022
PR-URL: #38250
Backport-PR-URL: #42512
Fixes: #38040
Reviewed-By: Beth Griggs <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
node-api Issues and PRs related to the Node-API. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants