-
Notifications
You must be signed in to change notification settings - Fork 174
"FinalizationRegistry" bug #367
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
Comments
Can you paste the backtrace? I suspect it as to do with the object being global so it will be collected in the final stage when the context is being destroyed... |
ok! backtrace: 1 find_own_property quickjs.c 5167 0x55e10f6ef04f |
Alright, I dug a bit and I see the problem: The reference cycle is not broken and thus the objects live after I tried to run GC towards the end of the Thanks for the report! |
Hum, not quite. Thanks to some "autoinit" logic the call to I suppose that my original assesment still stands though: eventually the context is going to be freed and when it's the turn to free the global object we cannot call the function because the context is gone. |
In the pathological case shown in #367 both the object and the registry will be destroyed as part of the GC phase of JS_FreeRuntime. When the GC sweep happens it's possible we are holding on to a corpse so avoid calling the registry callback in that case. This is similar to how Weak{Map,Set} deal with iterators being freed as part of a cycle. Fixes: #367
Scratch that. The problem was that the held object was freed before the finrec, because it was part of a cycle. Fixed in #371 |
There's another GC issue, also present in the mentioned link below:bellard/quickjs#218 (comment), which is not fixed in the quickjs-ng version |
I'll take a look at porting the patch, thanks! |
In the pathological case shown in #367 both the object and the registry will be destroyed as part of the GC phase of JS_FreeRuntime. When the GC sweep happens it's possible we are holding on to a corpse so avoid calling the registry callback in that case. This is similar to how Weak{Map,Set} deal with iterators being freed as part of a cycle. Fixes: #367
In the pathological case shown in quickjs-ng/quickjs#367 both the object and the registry will be destroyed as part of the GC phase of JS_FreeRuntime. When the GC sweep happens it's possible we are holding on to a corpse so avoid calling the registry callback in that case. This is similar to how Weak{Map,Set} deal with iterators being freed as part of a cycle. Fixes: quickjs-ng/quickjs#367
Uh oh!
There was an error while loading. Please reload this page.
Running the above code will crash。
The text was updated successfully, but these errors were encountered: