-
Notifications
You must be signed in to change notification settings - Fork 284
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
BackingStore destruction crashes with Debug Addon #2763
Comments
@d3x0r I don’t think there’s an easy way to debug this without having a reproduction or knowing your addon better. If you can’t share more information, I think your only route is to go build a debug build of Node.js, and use |
says bad option --trace-backing-store Edit:
|
@d3x0r Yeah, you need a debug build in order for that option to be available, i.e. you need to build Node.js from source with debugging enabled – that takes quite a while, unfortunately |
I checked out 14.4.0 (so the plugin API would be the same) and built the debug version. It(V14.4 Debug) does not demonstrate the same issue. It(V14.4 Debug) does generate more errors on some of my casts of arguments to functions, but having 'fixed' a few of those, it(v14.4Release) still does the same thing, and crashes.
|
So; What I'm actually assuming is that this BackingStore class seems to be a static reference in my addon code, and that is built against a debug runtime, whereas node is built as a release runtime and somehow the backing store allocate and free are not calling the correct pair of functions; but rather is allocating release and releasing debug. |
@d3x0r So … does the problem go away when you build your addon in Release config for a Node.js binary in Release config? 😬 That would seem like a pretty severe bug with Node.js to me… |
I'm using |
@d3x0r I see … we have an issue on ARM that might resemble yours: nodejs/node#30786 – tl;dr: On ARMv7 and ARMv6, Maybe that’s what happening here as well? Maybe |
Ya... that's not going to help for windows. There are release and debug runtimes (ucrt and ucrtd basically) so even if the front end structures are the same, the end up calling a different runtime. https://gist.github.com/d3x0r/f201f197ab017b643dcb941481b1bca4 This is a simple test. There is a 'download zip' button... although you can also just clone it |
I cannot test/develop with only release mode code... how do I fix the debug allocator to not crash when releasing a backing store created by node and released by my library? (since node is release of course so it's using a different allocator than the one that gets linked) I wonder why the decision to use some native (unportable) pointer container instead of any of the existing ones V8 uses... Oh right; I was supposed to build a debug node and have everything take a long time to run... |
not sure if these are related, but linking those anyways: node-ffi-napi/ref-napi#54 |
This is more when the backing store is garbage collected than on the creation of the backing store. |
in your trace output, can you search and find out whether the |
I'm certain that only one was ever created so it certainly only exists once. This is mixed runtimes on visual studio (debug vs release) or msvcrtd.dll vs msvcrt.dll (ucrt); if Node is compiled with release runtime, than the allocator between ucrtd and ucrt are not compatible, and the release happens in the addon's linked runtime, and is allocated internal to node in release runtime. |
This seems to not be an issue in V16, so seems is just v12-v14 (15?) |
Since V16 this has not been an issue. |
I recently updated to node 14.4.0. (previously 14.0.0), and updated my native addon code to use BackingStore for ArrayBuffer storage; instead of a custom holder object to get a callback on weakreference deletion.
Now, when the buffers are deallocated node is crashing in the backing store destructor.
nodejs/node-v8#115 shows a very similar crash; and I am using worker-threads; although no threads have exited....
The text was updated successfully, but these errors were encountered: