While playing with workers, I noticed that if the worker was "busy" that switching back and forth on two tabs, will eventually crash the app. This one actually is inside the Worker thread..
App crashes
nativescript │ 2.3.0
tns-core-modules │ 2.4.0-2016-10-17-4410
tns-android │ 2.4.0-next-2016-10-14-1253
tns-ios │
Attached the full log.
crash2.zip
Start a worker doing some work (mine got into a loop where it was running several setTimeouts that would occur every 100ms on the worker -- a bug of my own :grinning: that I need to figure out). Occasionally when I switch tabs (this is the key, the UI has to be doing something, it only appears to crash when I switch tabs. The TWO Tabs are very simple tabs, each tab has a simple TextEntry, a label, and a listview. The ListView uses a GridLayout and two label fields.. These are all bound to data in an observable. Switching tabs does NOT trigger any user defined events, so this is purely NS code re-drawing the other tab...
This is duplicatable; however it can take sometimes take several switches before it dies. I see the other Crash (on main thread: #593) more often than this one; but this one does occasionally occur with pretty much the exact same steps. However, to make this occur more offen, switch between tabs and actually type/delete character then switch to the other tab. This will cause more setTimeouts to be queued so the worker has a LOT more going on...
Callstack:
D/TNS.Java( 938): Uncaught Exception Message=An uncaught Exception occurred on "W0: ./contacts.worker.js" thread.
W/System.err( 938): com.tns.NativeScriptException: Cannot find method 'get' implementation
W/System.err( 938): at com.tns.Runtime.callJSMethodNative(Native Method)
W/System.err( 938): at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1010)
W/System.err( 938): at com.tns.Runtime.callJSMethodImpl(Runtime.java:895)
W/System.err( 938): at com.tns.Runtime.callJSMethod(Runtime.java:883)
W/System.err( 938): at com.tns.Runtime.callJSMethod(Runtime.java:867)
W/System.err( 938): at com.tns.Runtime.callJSMethod(Runtime.java:859)
W/System.err( 938): at com.tns.gen.java.lang.Runnable.run(java.lang.Runnable.java)
W/System.err( 938): at android.os.Handler.handleCallback(Handler.java:733)
W/System.err( 938): at android.os.Handler.dispatchMessage(Handler.java:95)
W/System.err( 938): at android.os.Looper.loop(Looper.java:136)
W/System.err( 938): at android.os.HandlerThread.run(HandlerThread.java:61)
I have sent you access creds to the repo via email @Pip3r4o - You just have to clone the repo, then checkout the “CrashingTest” branch...
The two issues are very likely related and a result of the same bug, I'd expect to experience even more crashes when calling java methods through JS at the same time.
@NathanaelA good news, @slavchev helped me troubleshoot the issue, and it turned out to be a bug in our java string to c++ string conversion logic. The fix should be in the master branch in a couple of hours
Awesome news guys! Glad that I was able to give you a test case that allowed you to trace this down, always nice to fix a low level issue. :+1: