questions about background threads
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 15/100
- Type d'issue
- Bug
- Clarté
- À clarifier
- Activité
- À l'abandon
- Stack technique
- android, java, javascript
- Domaine
- mobile-dev
Piste de recherche
Commencez par test-app/runtime/src/main/java/com/tns/Runtime.java vers la ligne 1152 et par l’entrée dispatchCallJSMethodNative à la ligne 1162. Reproduisez l’appel depuis un thread d’arrière-plan et comparez la récursion de ActivityCallbacksImplementation.onStart qui en résulte avec la trace de pile signalée ; le travail sera considéré comme terminé lorsque la cause aura été identifiée et que le comportement de thread pris en charge aura été documenté ou corrigé.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
I know you already said here that all JS runs in UI Thread but i would like to have another look at this.
The reason is that i found out that on IOS the Js code will run on the the thread in has been triggered.
This is actually an amazing feature. Thanks to that i managed to create an OpenCV module that can do live camera processing. In native the image processing is triggered from a background thread, then i call a JS delegate that modifies the image and returns it. All that happens in the background thread!.
It works amazingly. Imagine all the possibilities!
Now obviously i want to look at this on android. I immediately faced a wall on android as the runtime will always make sure the call to v8 JS will be done on the "worker" thread.
I wanted to try things so i decided to debug the runtime and modify the code so that it runs the v8 JS in the thread it is in.
To do that i simply modified the code to make it believe it is always in the worker thread
Now i get a weird error that i dont get. I end with a maximum call stack exceeded:
Process: org.nativescript.demovueopencv, PID: 2587
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:354)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Caused by: com.tns.NativeScriptException:
Calling js method doInBackground failed
RangeError: Maximum call stack size exceeded
File: "file:///data/data/org.nativescript.demovueopencv/files/app/vendor.js, line: 39669, column: 14
StackTrace:
Frame: function:'ActivityCallbacksImplementation.onStart', file:'file:///data/data/org.nativescript.demovueopencv/files/app/vendor.js', line: 39669, column: 15
Frame: function:'NativeScriptActivity.onStart', file:'file:///data/data/org.nativescript.demovueopencv/files/app/vendor.js', line: 37027, column: 21
at com.tns.Runtime.callJSMethodNative(Native Method)
at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1162)
at com.tns.Runtime.callJSMethodImpl(Runtime.java:1041)
at com.tns.Runtime.callJSMethod(Runtime.java:1028)
at com.tns.Runtime.callJSMethod(Runtime.java:1008)
at com.tns.Runtime.callJSMethod(Runtime.java:1000)
at android.os.AsyncTask_bundle_283_42_AsyncTaskRunner.doInBackground(Unknown Source:20)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
... 4 more
It seems to appear in the native side which i dont get.
Can someone guide me on this?
- Langage dominant
- C++
- Étoiles
- 563
- Forks
- 144
- Merge moyen
- 10 h 46 min
- PR mergées (30 j)
- 14
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de NativeScript/android
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 38/100
NativeScript/android#2039 · 1 commentaire ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
NativeScript/android#2024 ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 20/100
NativeScript/android#2020 ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 42/100
NativeScript/android#2019 ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 55/100
NativeScript/android#1986 ·
Toutes les issues de NativeScript/android
Issues similaires
-
Website Doc Typo Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 92/100
-
Difficulté 1/5 1-3 heures Accessibilité débutants 92/100
autowarefoundation/autoware_universe#13413 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
-
automated-analysis bug memory-safety
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100