Skip to content
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

ANR happens #16

Open
pahenator opened this issue Nov 13, 2023 · 3 comments
Open

ANR happens #16

pahenator opened this issue Nov 13, 2023 · 3 comments

Comments

@pahenator
Copy link

Provide a general summary of the issue.

Your Environment

  • Plugin version: 0.1.4
  • Platform: Android
  • OS version: Android 10 (SDK 29)
  • Device manufacturer / model: Nokia PDA_sprout (Nokia 5.1 Plus)
  • Cordova version (cordova -v): 12.0.0
  • Cordova platform version (cordova platform ls): android 12.0.1
  • Plugin config
  • "cordova-plugin-local-notification-12": {
    "ANDROID_SUPPORT_V4_VERSION": "26.+",
    "ANDROIDX_VERSION": "1.2.0",
    "ANDROIDX_APPCOMPAT_VERSION": "1.3.1"
    }

Expected Behavior

No ANRs

Actual Behavior

In google panel there is ANR reports from this plugin.

Steps to Reproduce

Reproduce this issue; include code to reproduce, if relevant

Context

Debug logs

#00 pc 0x000000000008043c /apex/com.android.runtime/lib64/bionic/libc.so (syscall+28) #1 pc 0x000000000014c094 /apex/com.android.runtime/lib64/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+148) #2 pc 0x00000000003828ac /apex/com.android.runtime/lib64/libart.so (art::JNI::FindClass(_JNIEnv*, char const*)+852) #3 pc 0x000000000001a988 /apex/com.android.conscrypt/lib64/libjavacrypto.so (conscrypt::jniutil::jniGetFDFromFileDescriptor(_JNIEnv*, _jobject*)+40) #4 pc 0x000000000003cca0 /apex/com.android.conscrypt/lib64/libjavacrypto.so (conscrypt::AppData::setCallbackState(_JNIEnv*, _jobject*, _jobject*)+72) #5 pc 0x000000000003d164 /apex/com.android.conscrypt/lib64/libjavacrypto.so (sslRead(_JNIEnv*, ssl_st*, _jobject*, _jobject*, char*, int, conscrypt::SslError*, int)+404) #6 pc 0x0000000000032b58 /apex/com.android.conscrypt/lib64/libjavacrypto.so (NativeCrypto_SSL_read(_JNIEnv*, _jclass*, long, _jobject*, _jobject*, _jobject*, _jbyteArray*, int, int, int)+816) #7 pc 0x0000000000140350 /apex/com.android.runtime/lib64/libart.so (art_quick_generic_jni_trampoline+144) #8 pc 0x0000000002007c04 /memfd:/jit-cache (com.android.org.conscrypt.NativeSsl.read+244) #9 pc 0x000000000200b2fc /memfd:/jit-cache (com.android.org.conscrypt.ConscryptFileDescriptorSocket$SSLInputStream.read+604) at com.android.org.conscrypt.NativeCrypto.SSL_read (Native method) at com.android.org.conscrypt.NativeSsl.read (NativeSsl.java:411) at com.android.org.conscrypt.ConscryptFileDescriptorSocket$SSLInputStream.read (ConscryptFileDescriptorSocket.java:549) at com.android.okhttp.okio.Okio$2.read (Okio.java:138) at com.android.okhttp.okio.AsyncTimeout$2.read (AsyncTimeout.java:213) at com.android.okhttp.okio.RealBufferedSource.read (RealBufferedSource.java:51) at com.android.okhttp.internal.http.Http1xStream$FixedLengthSource.read (Http1xStream.java:395) at com.android.okhttp.okio.RealBufferedSource$1.read (RealBufferedSource.java:372) at java.io.InputStream.read (InputStream.java:101) at de.appplant.cordova.plugin.notification.util.AssetUtil.copyFile (AssetUtil.java:232) at de.appplant.cordova.plugin.notification.util.AssetUtil.getUriFromRemote (AssetUtil.java:205) at de.appplant.cordova.plugin.notification.util.AssetUtil.parse (AssetUtil.java:93) at de.appplant.cordova.plugin.notification.Options.getLargeIcon (Options.java:429) at de.appplant.cordova.plugin.notification.Builder.build (Builder.java:169) at de.appplant.cordova.plugin.localnotification.RestoreReceiver.buildNotification (RestoreReceiver.java:94) at de.appplant.cordova.plugin.notification.receiver.AbstractRestoreReceiver.onReceive (AbstractRestoreReceiver.java:73) at android.app.ActivityThread.handleReceiver (ActivityThread.java:3876) at android.app.ActivityThread.access$1600 (ActivityThread.java:233) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1925) at android.os.Handler.dispatchMessage (Handler.java:107) at android.os.Looper.loop (Looper.java:224) at android.app.ActivityThread.main (ActivityThread.java:7561) at java.lang.reflect.Method.invoke (Native method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:995) Thread 7 "Signal Catcher" tid=7 Runnable Thread 2 "Jit thread pool worker thread 0" tid=2 Native Thread 8 "HeapTaskDaemon" tid=8 Waiting Thread 9 "ReferenceQueueDaemon" tid=9 Waiting Thread 10 "FinalizerDaemon" tid=10 Waiting Thread 11 "FinalizerWatchdogDaemon" tid=11 Waiting Thread 12 "Binder:6276_1" tid=12 Native Thread 13 "Binder:6276_2" tid=13 Native Thread 14 "Profile Saver" tid=14 Native Thread 15 "WM.task-1" tid=15 Waiting Thread 16 "RenderThread" tid=16 Native Thread 17 "WM.task-2" tid=17 Waiting Thread 18 "Binder:6276_3" tid=18 Native Thread 19 "WM.task-3" tid=19 Waiting Thread 20 "WM.task-4" tid=20 Waiting Thread 22 "Chrome_ProcessLauncherThread" tid=22 Native Thread 24 "GoogleApiHandler" tid=24 Native Thread 25 "Chrome_IOThread" tid=25 Native Thread 26 "ThreadPoolForeg" tid=26 Native Thread 27 "ThreadPoolSingl" tid=27 Native Thread 28 "PlatformServiceBridgeHandlerThread" tid=28 Native Thread 29 "CleanupReference" tid=29 Waiting Thread 30 "pool-1-thread-1" tid=30 Timed Waiting Thread 31 "Chrome_InProcGpuThread" tid=31 Native Thread 32 "AudioThread" tid=32 Native Thread 33 "ThreadPoolForeg" tid=33 Native Thread 34 "ThreadPoolForeg" tid=34 Native Thread 35 "androidx.work-1" tid=35 Waiting Thread 36 "OSH_WritePrefs" tid=36 Native

@pahenator
Copy link
Author

it seems that problem appears when notifications are restored and because of remote file but I didn't use remote files in my app, only local resource "res://" . How to fix this? ANR critical, but there is no alternative for this plugin

` add = (config: LocalNotifyAddConfig) => {
if (!this.manager) return;

this.manager.schedule({
  id: +config.id,
  title: config.title,
  text: config.text,
  trigger: { in: +config.time, unit: config.timespan },
  icon: 'res://mp_icon_big.png',
  smallIcon: 'res://mp_icon.png',
});

}`

  at de.appplant.cordova.plugin.notification.util.AssetUtil.getUriFromRemote (AssetUtil.java:203)
  at de.appplant.cordova.plugin.notification.util.AssetUtil.parse (AssetUtil.java:93)
  at de.appplant.cordova.plugin.notification.Options.getLargeIcon (Options.java:429)
  at de.appplant.cordova.plugin.notification.Builder.build (Builder.java:169)
  at de.appplant.cordova.plugin.localnotification.RestoreReceiver.buildNotification (RestoreReceiver.java:94)
  at de.appplant.cordova.plugin.notification.receiver.AbstractRestoreReceiver.onReceive (AbstractRestoreReceiver.java:73)

@pahenator
Copy link
Author

May be it's possible to find out somehow which path string causes this error?

@pahenator
Copy link
Author

The reason of this error that RestoreReceiver uses AssetsUtil.getUriFromRemote in sync threading way so in some cases this causes ANR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant