Android jsi + QuickJS: worker close() from its message handler aborts in JS_FreeRuntime (gc_obj_list not empty)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Start from the Android worker teardown path used when close() is called inside onmessage, then compare it with the parent terminate() path and the napi worker teardown. Trace which runtime-owned JSValues or native caches remain when JS_FreeRuntime runs. Done means the reproduced Java class, gc(), and self-close sequence exits cleanly with QuickJS and jsi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
With the jsi binding layer on QuickJS, the app aborts when a worker calls close() from inside its onmessage handler after it has used Java classes. QuickJS asserts in JS_FreeRuntime:
Assertion failed: list_empty(&rt->gc_obj_list)
That means GC objects are still alive when the worker's runtime is freed. Something still holds JSValues owned by that runtime, such as a native cache or object map that isn't released before the runtime is freed. Other combinations don't hit it:
| Combination | Result |
|---|---|
| napi + QuickJS, same test | pass |
jsi + QuickJS, terminate() from the parent |
pass |
Reproduce
- Build
platforms/android/test-appwith QuickJS and the jsi layer:
./gradlew :app:assembleDebug -Pengine=QUICKJS -Pns_engine=QUICKJS -PbindingLayer=jsi -PonlyArm64 -PuseKotlin=true - Use a worker that touches a Java class, forces a collection, and then closes itself from the handler:
onmessage = () => { new java.lang.Object(); gc(); close(); }; - From the main runtime, create the worker and
postMessageto it. - The app aborts in
JS_FreeRuntimeon every run. A collection inside the handler is required; withoutgc(), it depends on the heap state.
This was found while testing #92. It reproduced in 3 of 3 runs with #92 applied and in 2 of 2 runs on the unmodified base branch, so #92 does not cause it.
Expected
A worker that closes itself is torn down cleanly. Every value NativeScript holds in the runtime is released before the runtime is freed, as it is when the parent calls terminate() and in the napi tree.
Environment
- Branch:
android-react-nativeat 64c7fed0 - Emulator: Android API 36, arm64
- Engine: QuickJS (quickjs-ng), with the jsi binding layer
- Lingua principale
- C++
- Stelle
- 27
- Fork
- 4
- Merge medio
- 16h 48m
- PR unite (30g)
- 4
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di NativeScript/runtimes
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
NativeScript/runtimes#100 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
NativeScript/runtimes#99 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 4/5 1-2 giorni Idoneità per principianti 55/100
NativeScript/runtimes#98 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 53/100
NativeScript/runtimes#97 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
NativeScript/runtimes#93 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di NativeScript/runtimes
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
elf-alchemist/elfbsp#113 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
patrick-hudson/put.gd-desktop#979 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Dao-AILab/flash-attention#3097 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
Niko1221/Strata#4779 · 2 commenti ·
I maintainer di solito rispondono entro 3 giorni