Callback is still getting garbage collected.
See original GitHub issueOur macOS electron app uses nodobjc with ffi, and we have been getting “ffi: callback has been garbage collected” errors. To detect the error, I added test code to our app that will loop forever making async calls from javascript, one at a time, waiting for completion each time. Somewhere between 0 and 200 iterations, we get the error, usually at 50 to 100, but it does seem randomish.
Last week I created a local “nodobjc-napi” on my machine, that uses ffi-napi 2.4.0, which has the workaround of Callback is garbage collected
.
My test code still sees the same error with the same frequency. I searched my node_modules and app/node_modules for the original ffi, but all I see is ffi-napi, so as far as I can tell the workaround is active.
We use nodobjc for our authentication flow, and if it doesn’t work, then about 2% of our customers (randomishly distributed) won’t be able to sign in at any given time.
Is there some way I can help to diagnose this, or to be a test bed if anyone wants to experiment? I can try adding delays, additional logging, other code, I can stay up late and spend some time on weekends. What I can’t do is actually solve the problem, because I lack the skill set. Help!
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
https://github.com/node-ffi-napi/node-ffi-napi/pull/56 might be a fix for this.
@stuartbrussell-intuit It is a weak reference because it cannot know how long C is going to need access to it; so the alternative would be storing it forever, which would always lead to a memory leak.