-
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
Possible crash related to Weak refs #33459
Comments
( This also looks very similar to nodejs/node-addon-api#393 ) |
I think the problem here is not Node, it’s Nan – the |
Are you saying that my call to callbacks[callbackID]->Reset(); is superfluous in the callbackDestroyed method? At what stage does the persistent get automatically reset? |
@TomMettam Yes, it’s what’s causing the crash and it’s not needed if you’re using Nan (but unfortunately only when you’re using Nan).
That would be https://github.com/nodejs/nan/blob/eaae2683a3df542376797a11385b87b9c0d071c5/nan_weak.h#L120 |
Alright! Thank you very much for your time, I appreciate it! |
I've created a simple test case to reproduce this issue. I'm not certain if it's a bug in my code, Nan, V8 or Node.
https://github.com/CasperTech/NanWeakFunctionTest
How often does it reproduce? Is there a required condition?
100% reproduction - tested on Windows and Linux
What do you see instead?
The test app registers 10,000 callbacks, then clears them and forces a GC clear, then registers them again, every 5 seconds. After the second or third run the app crashes:
After the second global.gc, not all the Weak references are released, but I understand that GC is unpredictable so this may or may not be related.
Process memory usage only rises to about ~15mb on my system and the system has plenty to spare.
The text was updated successfully, but these errors were encountered: