NativeScript / NativeScript/nativescript-cli

TNS majority of output missing on Android

Đang mở
#3,854 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

os: android to-be-checked
Ngôn ngữ chính
JavaScript
Star
1.1k
Fork
204
Merge trung bình
1 ngày 9 giờ
Pull request đã merge (30 ngày)
8

Mô tả

Did you verify this is a real problem by searching the

Searched the issues in the repo.

Tell us about the problem

If the Android App crashes with a thread dump; it only logs a small amount (useless part) of the log of why it crashed.

TOTAL Log TNS outputted:

08-29 20:20:25.013  5080  5080 F art     : art/runtime/java_vm_ext.cc:410]     from java.lang.Object
 com.tns.Runtime.callJSMethodNative(int, int, java.lang.String, int, boolean, java.lang.Object[])
08-29 20:20:25.014  5080  5080 F art     : art/runtime/java_vm_ext.cc:410]   native: #40 pc 000dda38
  /data/app/org.nativescript.demo-1/lib/x86/libNativeScript.so (Java_com_tns_Runtime_callJSMethodNat
ive+152)
08-29 20:20:25.014  5080  5080 F art     : art/runtime/java_vm_ext.cc:410]   native: #41 pc 002c29a4
  /data/app/org.nativescript.demo-1/oat/x86/base.odex (java.lang.Object com.tns.Runtime.callJSMethod
Native(int, int, java.lang.String, int, boolean, java.lang.Object[])+200)
08-29 20:20:25.014  5080  5080 F art     : art/runtime/java_vm_ext.cc:410]   native: #42 pc 002c39ab
  /data/app/org.nativescript.demo-1/oat/x86/base.odex (java.lang.Object com.tns.Runtime.dispatchCall
JSMethodNative(int, java.lang.String, boolean, long, java.lang.Class, java.lang.Object[])+607)
08-29 20:20:25.014  5080  5080 F art     : art/runtime/java_vm_ext.cc:410]   native: #43 pc 002c2838
  /data/app/org.nativescript.demo-1/oat/x86/base.odex (java.lang.Object com.tns.Runtime.callJSMethod
Impl(java.lang.Object, java.lang.String, java.lang.Class, boolean, long, java.lang.Object[])+1212)
08-29 20:20:25.014  5080  5080 F art     : art/runtime/java_vm_ext.cc:410]   native: #44 pc 002c20aa
  /data/app/org.nativescript.demo-1/oat/x86/base.odex (java.lang.Object com.tns.Runtime.callJSMethod
(java.lang.Object, java.lang.String, java.lang.Class, boolean, long, java.lang.Object[])+254)
08-29 20:20:25.014  5080  5080 F art     : art/runtime/java_vm_ext.cc:410]   native: #45 pc 002c218a
  /data/app/org.nativescript.demo-1/oat/x86/base.odex (java.lang.Object com.tns.Runtime.callJSMethod
(java.lang.Object, java.lang.String, java.lang.Class, boolean, java.lang.Object[])+158)
08-29 20:20:25.014  5080  5080 F art     : art/runtime/java_vm_ext.cc:410]   native: #46 pc 002c2226
  /data/app/org.nativescript.demo-1/oat/x86/base.odex (java.lang.Object com.tns.Runtime.callJSMethod
(java.lang.Object, java.lang.String, java.lang.Class, java.lang.Object[])+90)
08-29 20:20:25.014  5080  5080 F art     : art/runtime/java_vm_ext.cc:410]   at com.tns.Runtime.call
JSMethodNative(Native method)
08-29 20:20:25.014  5080  5080 F art     : art/runtime/java_vm_ext.cc:410]   at com.tns.Runtime.disp
atchCallJSMethodNative(Runtime.java:1116)
08-29 20:20:25.014  5080  5080 F art     : art/runtime/java_vm_ext.cc:410]   at com.tns.Runtime.call
JSMethodImpl(Runtime.java:996)
08-29 20:20:25.014  5080  5080 F art     : art/runtime/java_vm_ext.cc:410]   at com.tns.Runtime.call
JSMethod(Runtime.java:983)
08-29 20:20:25.014  5080  5080 F art     : art/runtime/java_vm_ext.cc:410]   at com.tns.Runtime.call
JSMethod(Runtime.java:967)
08-29 20:20:25.014  5080  5080 F art     : art/runtime/java_vm_ext.cc:410]   at com.tns.Runtime.call
JSMethod(Runtime.java:959)
08-29 20:20:25.244  5080  5080 F art     : art/runtime/runtime.cc:372]   native: #42 pc 000dda38  /d
ata/app/org.nativescript.demo-1/lib/x86/libNativeScript.so (Java_com_tns_Runtime_callJSMethodNative+
152)
08-29 20:20:25.244  5080  5080 F art     : art/runtime/runtime.cc:372]   native: #43 pc 002c29a4  /d
ata/app/org.nativescript.demo-1/oat/x86/base.odex (java.lang.Object com.tns.Runtime.callJSMethodNati
ve(int, int, java.lang.String, int, boolean, java.lang.Object[])+200)
08-29 20:20:25.244  5080  5080 F art     : art/runtime/runtime.cc:372]   native: #44 pc 002c39ab  /d
ata/app/org.nativescript.demo-1/oat/x86/base.odex (java.lang.Object com.tns.Runtime.dispatchCallJSMe
thodNative(int, java.lang.String, boolean, long, java.lang.Class, java.lang.Object[])+607)
08-29 20:20:25.244  5080  5080 F art     : art/runtime/runtime.cc:372]   native: #45 pc 002c2838  /d
ata/app/org.nativescript.demo-1/oat/x86/base.odex (java.lang.Object com.tns.Runtime.callJSMethodImpl
(java.lang.Object, java.lang.String, java.lang.Class, boolean, long, java.lang.Object[])+1212)
08-29 20:20:25.244  5080  5080 F art     : art/runtime/runtime.cc:372]   native: #46 pc 002c20aa  /d
ata/app/org.nativescript.demo-1/oat/x86/base.odex (java.lang.Object com.tns.Runtime.callJSMethod(jav
a.lang.Object, java.lang.String, java.lang.Class, boolean, long, java.lang.Object[])+254)
08-29 20:20:25.244  5080  5080 F art     : art/runtime/runtime.cc:372]   native: #47 pc 002c218a  /d
ata/app/org.nativescript.demo-1/oat/x86/base.odex (java.lang.Object com.tns.Runtime.callJSMethod(jav
a.lang.Object, java.lang.String, java.lang.Class, boolean, java.lang.Object[])+158)
08-29 20:20:25.244  5080  5080 F art     : art/runtime/runtime.cc:372]   native: #48 pc 002c2226  /d
ata/app/org.nativescript.demo-1/oat/x86/base.odex (java.lang.Object com.tns.Runtime.callJSMethod(jav
a.lang.Object, java.lang.String, java.lang.Class, java.lang.Object[])+90)
08-29 20:20:25.244  5080  5080 F art     : art/runtime/runtime.cc:372]   at com.tns.Runtime.callJSMe
thodNative(Native method)
08-29 20:20:25.244  5080  5080 F art     : art/runtime/runtime.cc:372]   at com.tns.Runtime.dispatch
CallJSMethodNative(Runtime.java:1116)
08-29 20:20:25.244  5080  5080 F art     : art/runtime/runtime.cc:372]   at com.tns.Runtime.callJSMe
thodImpl(Runtime.java:996)
08-29 20:20:25.244  5080  5080 F art     : art/runtime/runtime.cc:372]   at com.tns.Runtime.callJSMe
thod(Runtime.java:983)
08-29 20:20:25.244  5080  5080 F art     : art/runtime/runtime.cc:372]   at com.tns.Runtime.callJSMe
thod(Runtime.java:967)
08-29 20:20:25.244  5080  5080 F art     : art/runtime/runtime.cc:372]   at com.tns.Runtime.callJSMe
thod(Runtime.java:959)
08-29 20:20:25.245  5080  5080 F art     : art/runtime/runtime.cc:372]   native: #45 pc 000dda38  /d
ata/app/org.nativescript.demo-1/lib/x86/libNativeScript.so (Java_com_tns_Runtime_callJSMethodNative+
152)
08-29 20:20:25.245  5080  5080 F art     : art/runtime/runtime.cc:372]   native: #46 pc 002c29a4  /d
ata/app/org.nativescript.demo-1/oat/x86/base.odex (java.lang.Object com.tns.Runtime.callJSMethodNati
ve(int, int, java.lang.String, int, boolean, java.lang.Object[])+200)
08-29 20:20:25.245  5080  5080 F art     : art/runtime/runtime.cc:372]   native: #47 pc 002c39ab  /d
ata/app/org.nativescript.demo-1/oat/x86/base.odex (java.lang.Object com.tns.Runtime.dispatchCallJSMe
thodNative(int, java.lang.String, boolean, long, java.lang.Class, java.lang.Object[])+607)
08-29 20:20:25.245  5080  5080 F art     : art/runtime/runtime.cc:372]   native: #48 pc 002c2838  /d
ata/app/org.nativescript.demo-1/oat/x86/base.odex (java.lang.Object com.tns.Runtime.callJSMethodImpl
(java.lang.Object, java.lang.String, java.lang.Class, boolean, long, java.lang.Object[])+1212)
08-29 20:20:25.245  5080  5080 F art     : art/runtime/runtime.cc:372]   native: #49 pc 002c20aa  /d
ata/app/org.nativescript.demo-1/oat/x86/base.odex (java.lang.Object com.tns.Runtime.callJSMethod(jav
a.lang.Object, java.lang.String, java.lang.Class, boolean, long, java.lang.Object[])+254)
08-29 20:20:25.245  5080  5080 F art     : art/runtime/runtime.cc:372]   native: #50 pc 002c218a  /d
ata/app/org.nativescript.demo-1/oat/x86/base.odex (java.lang.Object com.tns.Runtime.callJSMethod(jav
a.lang.Object, java.lang.String, java.lang.Class, boolean, java.lang.Object[])+158)
08-29 20:20:25.245  5080  5080 F art     : art/runtime/runtime.cc:372]   native: #51 pc 002c2226  /d
ata/app/org.nativescript.demo-1/oat/x86/base.odex (java.lang.Object com.tns.Runtime.callJSMethod(jav
a.lang.Object, java.lang.String, java.lang.Class, java.lang.Object[])+90)
08-29 20:20:25.245  5080  5080 F art     : art/runtime/runtime.cc:372]   at com.tns.Runtime.callJSMe
thodNative(Native method)
08-29 20:20:25.245  5080  5080 F art     : art/runtime/runtime.cc:372]   at com.tns.Runtime.dispatch
CallJSMethodNative(Runtime.java:1116)
08-29 20:20:25.245  5080  5080 F art     : art/runtime/runtime.cc:372]   at com.tns.Runtime.callJSMe
thodImpl(Runtime.java:996)
08-29 20:20:25.245  5080  5080 F art     : art/runtime/runtime.cc:372]   at com.tns.Runtime.callJSMe
thod(Runtime.java:983)
08-29 20:20:25.245  5080  5080 F art     : art/runtime/runtime.cc:372]   at com.tns.Runtime.callJSMe
thod(Runtime.java:967)
08-29 20:20:25.245  5080  5080 F art     : art/runtime/runtime.cc:372]   at com.tns.Runtime.callJSMe
thod(Runtime.java:959)
ActivityManager: Process org.nativescript.demo (pid 5080) has died

You can see from the log; all the important parts of the log is missing. In fact what it does currently print is completely worthless as it is always missing the actual cause which is typically partially explained in the last thread and fully explained in the first thread dump. Which then requires me to open another terminal and do a adb logcat to actually get the log I need which produced:

08-29 20:20:24.985  5080  5080 E art     : JNI ERROR (app bug): attempt to pass an instance of javax
.net.ssl.TrustManager[] as argument 2 to okhttp3.OkHttpClient$Builder okhttp3.OkHttpClient$Builder.s
slSocketFactory(javax.net.ssl.SSLSocketFactory, javax.net.ssl.X509TrustManager)
08-29 20:20:25.013  5080  5080 F art     : art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APP
LICATION: bad arguments passed to okhttp3.OkHttpClient$Builder okhttp3.OkHttpClient$Builder.sslSocke
tFactory(javax.net.ssl.SSLSocketFactory, javax.net.ssl.X509TrustManager) (see above for details)

(many many thread dump lines deleted)

08-29 20:20:25.355   243   243 F DEBUG   : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr ------
--
08-29 20:20:25.373   243   243 F DEBUG   : Abort message: 'art/runtime/java_vm_ext.cc:410] JNI DETEC
TED ERROR IN APPLICATION: bad arguments passed to okhttp3.OkHttpClient$Builder okhttp3.OkHttpClient$
Builder.sslSocketFactory(javax.net.ssl.SSLSocketFactory, javax.net.ssl.X509TrustManager) (see above
for details)'

Both parts of the error messages are actually in the logging gotten by ADB; but neither show up from TNS...

Which platform(s) does your issue occur on?

Android

Please provide the following version numbers that your issue occurs with:
  • CLI: 4.2.0
  • Cross-platform modules: 4.2.0
  • Plugin(s): Theme-Core
Please tell us how to recreate the issue in as much detail as possible.

I'm in the process of creating a new plugin; Basically anything that causes the engine to abort out where the engine outputs all the thread backtraces. The Backtraces and error messages that are output at the top are missing, and all that is output is just a very tiny part of the stack trace (it appears only the middle of one thread, TNS logs).

Is there code involved?

In my case I duplicated it a many times as the docs weren't real clear on what was expected. So the error in the logs above actually is slightly different than the code below. The code below produces the same type of error but it is a much smaller code sample for you to easily duplicate. 😀

var loadKeystore = function(keyStoreName, keyStorePassword, type) {
    var keyStoreType = type || java.security.KeyStore.getDefaultType();
    var _keystore = java.security.KeyStore.getInstance(keyStoreType);
 
        var keyStorePath = keyStoreName;
        if (keyStoreName.indexOf("~/") === 0) {
            keyStorePath = keyStorePath.replace("~/", fs.knownFolders.currentApp().path + "/");
        }

        var readStream = new java.io.FileInputStream(keyStorePath);
        _keystore.load(readStream, keyStorePassword);
 };

loadKeystore("~/client.p12", "test", "PKCS12");

(Client.p12 certificate in zip file)
client.zip
This is a test generated client.p12 unused by anything. So that you don't have to create one.

The crash is caused by the _keystore.load, because it expects the keyStorePassword to actually be an array of characters, not a string. So it will crash out with a JNI variable exception...

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện việc engine Android abort với ví dụ keystore JavaScript được cung cấp, sau đó so sánh output của TNS với toàn bộ output adb logcat được hiển thị trong issue. Truy vết cách TNS chọn và in output crash; hoàn tất khi thông báo lỗi ở đầu và thread dump liên quan được giữ lại thay vì chỉ có một đoạn ở giữa.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
android, javascript
Lĩnh vực
cli, mobile-dev, observability
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.