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

App freezes, DeadObjectException #925

Closed
hannta opened this issue Jan 5, 2018 · 35 comments
Closed

App freezes, DeadObjectException #925

hannta opened this issue Jan 5, 2018 · 35 comments

Comments

@hannta
Copy link

hannta commented Jan 5, 2018

On android im getting following app freezes, DeadObjectException, on some older Android devices.

I think this is similar issue, already reported on mapbox android sdk mapbox/mapbox-navigation-android#522

At least in my case, this issue is reproducing only on react-native-mapbox-gl: 6.0.2, not 6.01.

01-04 16:49:48.866 7875-7875/com.my.app:lost E/FusedLocationProviderServiceDelegate: Error occurred trying to report a new Location
	 android.os.DeadObjectException
		 at android.os.BinderProxy.transactNative(Native Method)
		 at android.os.BinderProxy.transact(Binder.java:501)
		 at com.mapzen.android.lost.internal.IFusedLocationProviderCallback$Stub$Proxy.onLocationChanged(IFusedLocationProviderCallback.java:129)
		 at com.mapzen.android.lost.internal.FusedLocationProviderServiceDelegate.reportLocation(FusedLocationProviderServiceDelegate.java:95)
		 at com.mapzen.android.lost.internal.FusionEngine.onLocationChanged(FusionEngine.java:191)
		 at android.location.LocationManager$ListenerTransport._handleMessage(LocationManager.java:281)
		 at android.location.LocationManager$ListenerTransport.access$000(LocationManager.java:210)
		 at android.location.LocationManager$ListenerTransport$2.handleMessage(LocationManager.java:233)
		 at android.os.Handler.dispatchMessage(Handler.java:102)
		 at android.os.Looper.loop(Looper.java:135)
		 at android.app.ActivityThread.main(ActivityThread.java:5319)
		 at java.lang.reflect.Method.invoke(Native Method)
		 at java.lang.reflect.Method.invoke(Method.java:372)
		 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1016)
		 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811)

react-native-mapbox-gl: 6.0.2
react-native: 0.51.0
device: android

@vpavlushkov
Copy link

More details on the phone that experiences the issue:

  • device: Sony XPERIA M4 Aqua (E2303)
  • firmware: 26.1.A.3.111
  • Android version: 5.0

@nitaliano
Copy link
Owner

nitaliano commented Jan 5, 2018

Thanks for the info will look into it. @hannta the reason why it does not happen on 6.0.1 is we were not on 5.2.+ of the Mapbox Android SDK that made changes to it's location provider deps

@henrikra
Copy link
Contributor

henrikra commented Jan 8, 2018

This is bug blocking our next release :/

@nitaliano
Copy link
Owner

Is this happening on more than just the Sony XPERIA?

@hannta
Copy link
Author

hannta commented Jan 9, 2018

@nitaliano actually it looks like it happens only on this Sony XPERIA device, but we have very limited test device set atmo.

@nitaliano
Copy link
Owner

I was able to get my hands on an Xperia running 5.1.1, I'll see if I can reproduce the issue

@henrikra
Copy link
Contributor

Great news!

@nitaliano
Copy link
Owner

I can't reproduce this issue with my Xperia. Are there any specific steps I need to take in order to get this error?

@henrikra
Copy link
Contributor

We also tested on Android Huawei ALE-L21 and we got it freeze like with Sony.

@vpavlushkov
Copy link

Probably worth mentioning that the issue gets reproduced on XPERIA phone in question every time while on Huawei it happens every 2nd-3rd time. It looks like the root cause is some raise condition that takes place more often on a slower phone.

@henrikra
Copy link
Contributor

I am doing repro repo so you can try it also @nitaliano
Here are new logs that we get after the app is stuck

01-18 15:25:20.207 887-912/? E/ActivityManager: ANR in com.mapboxfreeezebug (com.mapboxfreeezebug/com.reactnativenavigation.controllers.NavigationActivity)
                                                PID: 2349
                                                Reason: Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago.  Wait queue length: 32.  Wait queue head age: 20518.0ms.)
                                                Load: 5.22 / 5.41 / 5.9
                                                CPU usage from 0ms to 7659ms later:
                                                  59% 887/system_server: 19% user + 40% kernel / faults: 10002 minor 1 major
                                                  3.1% 2349/com.mapboxfreeezebug: 1.5% user + 1.5% kernel / faults: 2507 minor
                                                  2.7% 1809/com.android.phone: 1% user + 1.6% kernel / faults: 3872 minor 1 major
                                                  8.2% 26753/com.android.bluetooth: 4.4% user + 3.7% kernel / faults: 2734 minor
                                                  7.1% 25503/com.android.systemui: 3.3% user + 3.7% kernel / faults: 3022 minor
                                                  5.7% 308/sensord: 0.9% user + 4.8% kernel
                                                  5.4% 1532/com.garmin.android.apps.connectmobile: 1.8% user + 3.6% kernel / faults: 932 minor
                                                  0.4% 299/debuggerd: 0.1% user + 0.2% kernel / faults: 1373 minor
                                                  0.4% 300/debuggerd64: 0% user + 0.4% kernel / faults: 2497 minor
                                                  0.8% 1718/com.android.nfc: 0.4% user + 0.3% kernel / faults: 1907 minor
                                                  0.2% 1788/com.sonymobile.cameracommon: 0.1% user + 0.1% kernel / faults: 1722 minor
                                                  0.2% 1695/com.android.server.telecom: 0% user + 0.1% kernel / faults: 1699 minor
                                                  0.2% 1762/com.sonyericsson.devicemonitor: 0.1% user + 0.1% kernel / faults: 1822 minor
                                                  1.8% 419/adbd: 0.1% user + 1.6% kernel / faults: 46 minor
                                                  1.8% 31421/com.sonyericsson.conversations: 0.6% user + 1.1% kernel / faults: 2233 minor 460 major
                                                  0.1% 1674/com.sonymobile.mx.android: 0% user + 0.1% kernel / faults: 1551 minor
                                                  0.1% 1741/com.android.incallui: 0% user + 0.1% kernel / faults: 1542 minor
                                                  1.4% 285/logd: 0.6% user + 0.7% kernel / faults: 8 minor 2 major
                                                  0.9% 6/kworker/u16:0: 0% user + 0.9% kernel
                                                  0.3% 155/irq/13-main_tts: 0% user + 0.3% kernel
                                                  0.7% 165/cfinteractive: 0% user + 0.7% kernel
                                                  0.6% 19844/kworker/7:1: 0% user + 0.6% kernel
                                                  0.5% 117/ksmd: 0% user + 0.5% kernel
                                                  0.5% 290/surfaceflinger: 0.3% user + 0.1% kernel
                                                  0.2% 8/rcu_preempt: 0% user + 0.2% kernel
                                                  0.2% 29/kworker/u17:0: 0% user + 0.2% kernel
                                                  0.1% 168/mmcqd/0: 0% user + 0.1% kernel
                                                  0.2% 2770/ksoftirqd/7: 0% user + 0.2% kernel
                                                  0.2% 3519/com.sonymobile.phoneusage: 0.2% user + 0% kernel / faults: 54 minor
                                                  0.2% 4573/kworker/u16:4: 0% user + 0.2% kernel
                                                  0.2% 8021/kworker/4:1: 0% user + 0.2% kernel
                                                  0.2% 26748/kworker/u16:6: 0% user + 0.2% kernel
                                                  0% 1//init: 0% user + 0% kernel / faults: 41 minor
                                                  0% 3/ksoftirqd/0: 0% user + 0% kernel
                                                  0% 304/mediaserver: 0% user + 0% kernel
                                                  0% 2400/com.google.android.gms.persistent: 0% user + 0% kernel / faults: 30 minor
                                                  0.1% 2592/kworker/6:2: 0% user + 0.1% kernel
                                                  0% 24258/kworker/0:0: 0% user + 0% kernel
                                                 +0% 2603/logcat: 0% user + 0% kernel
                                                17% TOTAL: 6.2% user + 10% kernel + 0.1% iowait + 0% softirq
                                                CPU usage from 6600ms to 7147ms later:
                                                  21% 887/system_server: 7.2% user + 14% kernel / faults: 14 minor
                                                    9% 912/ActivityManager: 0% user + 9% kernel
                                                    3.6% 915/android.ui: 1.8% user + 1.8% kernel
                                                    1.8% 902/FinalizerDaemon: 1.8% user + 0% kernel
                                                    1.8% 917/android.display: 1.8% user + 0% kernel
                                                    1.8% 1080/Binder_3: 1.8% user + 0% kernel
                                                    1.8% 1086/InputReader: 0% user + 1.8% kernel
                                                  5.4% 308/sensord: 0% user + 5.4% kernel
                                                  3.7% 155/irq/13-main_tts: 0% user + 3.7% kernel
                                                  3.6% 26753/com.android.bluetooth: 1.8% user + 1.8% kernel / faults: 1 minor
                                                    1.8% 26779/BT Service Call: 0% user + 1.8% kernel
                                                    1.8% 26780/Binder_3: 0% user + 1.8% kernel
                                                  1.8% 285/logd: 0% user + 1.8% kernel
                                                    3.6% 384/logd.writer: 0% user + 3.6% kernel
                                                  0.8% 290/surfaceflinger: 0.8% user + 0% kernel
                                                  1.8% 419/adbd: 0% user + 1.8% kernel
                                                  1.8% 1532/com.garmin.android.apps.connectmobile: 1.8% user + 0% kernel / faults: 3 minor
                                                    1.8% 1638/GFDI_GoogleBle_: 0% user + 1.8% kernel
                                                    1.8% 10207/GFDI_InitiatorR: 1.8% user + 0% kernel
                                                    1.8% 10231/Binder_3: 0% user + 1.8% kernel
                                                  1.1% 2592/kworker/6:2: 0% user + 1.1% kernel
                                                  1.8% 2

@henrikra
Copy link
Contributor

I got this freeze reproduced in small repo! 🎉 It is here: https://github.com/henrikra/mapboxFreeezeBug
I have also made video of the freeze with repro repo: https://drive.google.com/open?id=1bI00rZ8NqZAGB32xKllLytHbO_DDodmF

Steps to repro the freeze:

  1. Press red button to open new screen as modal
  2. Press android back button rapidly to go back to previous screen
  3. move Home screen map with out finger to notice if app has crashed
  4. repeat this until you get the freeze

If you look closely to the video I get crash on 3rd time. And on 3rd time when the modal starts to animate from bottom it does not have black background. It map initializing when there is quick black background?

Does this help you?

I recorded the video on:
device: Sony XPERIA M4 Aqua (E2303)
firmware: 26.1.A.3.111
Android version: 5.0

@nitaliano
Copy link
Owner

@henrikra thanks I will check it out with my Xperia

@nitaliano
Copy link
Owner

@henrikra I needed to request access to see the video, let me know when you grant it

@nitaliano
Copy link
Owner

nitaliano commented Jan 18, 2018

I can reproduce it now, not the DeadObjectException but the error that @henrikra posted

Update: I can reproduce both errors

@nitaliano
Copy link
Owner

nitaliano commented Jan 19, 2018

Commenting out Lost stops the DeadObjectException from happening, but the NavigationActivity from react-native-navigation is still creating the ANR. It looks like it happens when the NavigationActivity is not completely disposed of by the time we push a new NavigationActivity

Update:
Try putting the map into textureMode I can't reproduce it anymore, if that works for others then I can add a built in check for Android into the SDK that defaults to textureMode for older Android versions. I'm worried that putting the map into textureMode just changes the timing slightly so other phones might have issues

@SamiPatanen
Copy link

SamiPatanen commented Jan 26, 2018

@nitaliano Hi! I'm having a similar issue. The application crashes with DeadObjectException:

01-26 15:21:41.055 2389-2517/? W/InputDispatcher: channel ~ Consumer closed input channel or an error occurred.  events=0x9
01-26 15:21:41.055 2389-2517/? E/InputDispatcher: channel ~ Channel is unrecoverably broken and will be disposed!
01-26 15:21:41.070 2389-2832/? W/InputDispatcher: Attempted to unregister already unregistered input channel
01-26 15:21:41.475 24237-24237/? W/dalvikvm: VFY: unable to resolve static field 967 (PR_SET_DUMPABLE) in Landroid/system/OsConstants;
01-26 15:21:41.515 24227-24227/? W/ActivityThread: ClassLoader.getResources: The class loader returned by Thread.getContextClassLoader() may fail for processes that host multiple applications. You should explicitly specify a context class loader. For example: Thread.setContextClassLoader(getClass().getClassLoader());
01-26 15:21:41.545 24237-24237/? W/dalvikvm: VFY: unable to find class referenced in signature (Laras;)
01-26 15:21:41.545 24237-24237/? W/dalvikvm: VFY: unable to find class referenced in signature (Laras;)
01-26 15:21:41.545 24237-24237/? W/dalvikvm: VFY: unable to find class referenced in signature (Laras;)
01-26 15:21:41.545 24237-24237/? W/dalvikvm: VFY: unable to find class referenced in signature (Laras;)
01-26 15:21:41.550 24237-24237/? W/dalvikvm: VFY: unable to resolve virtual method 1750: Landroid/content/Context;.getSystemService (Ljava/lang/Class;)Ljava/lang/Object;
01-26 15:21:41.550 2389-2470/? W/InputMethodManagerService: Session failed to close due to remote exception
                                                            android.os.DeadObjectException
                                                                at android.os.BinderProxy.transact(Native Method)
                                                                at com.android.internal.view.IInputMethodSession$Stub$Proxy.finishSession(IInputMethodSession.java:314)
                                                                at com.android.server.InputMethodManagerService.finishSessionLocked(InputMethodManagerService.java:1986)
                                                                at com.android.server.InputMethodManagerService.clearClientSessionLocked(InputMethodManagerService.java:1977)
                                                                at com.android.server.InputMethodManagerService.clearCurMethodLocked(InputMethodManagerService.java:2003)
                                                                at com.android.server.InputMethodManagerService.onServiceDisconnected(InputMethodManagerService.java:2022)
                                                                at android.app.LoadedApk$ServiceDispatcher.doDeath(LoadedApk.java:1116)
                                                                at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1130)
                                                                at android.os.Handler.handleCallback(Handler.java:730)
                                                                at android.os.Handler.dispatchMessage(Handler.java:92)
                                                                at android.os.Looper.loop(Looper.java:176)
                                                                at com.android.server.ServerThread.run(SystemServer.java:1905)
01-26 15:21:41.560 24237-24237/? W/dalvikvm: VFY: unable to resolve virtual method 1725: Landroid/content/Context;.createDeviceProtectedStorageContext ()Landroid/content/Context;
01-26 15:21:41.565 24237-24237/? W/dalvikvm: VFY: unable to resolve virtual method 1750: Landroid/content/Context;.getSystemService (Ljava/lang/Class;)Ljava/lang/Object;
01-26 15:21:41.570 24237-24237/? W/dalvikvm: VFY: unable to resolve virtual method 1755: Landroid/content/Context;.isDeviceProtectedStorage ()Z
01-26 15:21:41.570 24237-24237/? W/dalvikvm: VFY: unable to resolve virtual method 1755: Landroid/content/Context;.isDeviceProtectedStorage ()Z
01-26 15:21:41.575 24237-24237/? W/dalvikvm: VFY: unable to resolve virtual method 1755: Landroid/content/Context;.isDeviceProtectedStorage ()Z
01-26 15:21:41.575 24237-24237/? W/dalvikvm: VFY: unable to resolve virtual method 1755: Landroid/content/Context;.isDeviceProtectedStorage ()Z
01-26 15:21:41.580 24237-24237/? W/dalvikvm: VFY: unable to resolve virtual method 2324: Landroid/os/PowerManager;.isInteractive ()Z
01-26 15:21:41.580 24237-24237/? W/dalvikvm: VFY: unable to resolve static method 12255: Ljava/util/Objects;.equals (Ljava/lang/Object;Ljava/lang/Object;)Z
01-26 15:21:41.625 24237-24237/? W/dalvikvm: VFY: unable to resolve virtual method 1774: Landroid/content/ContextWrapper;.createCredentialProtectedStorageContext ()Landroid/content/Context;
01-26 15:21:41.625 24237-24237/? W/dalvikvm: VFY: unable to resolve virtual method 1775: Landroid/content/ContextWrapper;.createDeviceProtectedStorageContext ()Landroid/content/Context;
01-26 15:21:41.630 24237-24237/? W/dalvikvm: VFY: unable to resolve virtual method 1754: Landroid/content/Context;.isCredentialProtectedStorage ()Z
01-26 15:21:41.630 24237-24237/? W/dalvikvm: VFY: unable to resolve virtual method 2377: Landroid/os/UserManager;.isUserUnlocked ()Z
01-26 15:21:41.630 24237-24237/? W/dalvikvm: VFY: unable to resolve virtual method 1755: Landroid/content/Context;.isDeviceProtectedStorage ()Z
01-26 15:21:41.630 24237-24237/? W/dalvikvm: VFY: unable to resolve virtual method 1755: Landroid/content/Context;.isDeviceProtectedStorage ()Z
01-26 15:21:41.775 24237-24237/? W/dalvikvm: VFY: unable to resolve virtual method 1671: Landroid/content/ContentProvider;.canonicalize (Landroid/net/Uri;)Landroid/net/Uri;
01-26 15:21:41.775 24237-24237/? W/dalvikvm: VFY: unable to resolve virtual method 1681: Landroid/content/ContentProvider;.openAssetFile (Landroid/net/Uri;Ljava/lang/String;Landroid/os/CancellationSignal;)Landroid/content/res/AssetFileDescriptor;
01-26 15:21:41.775 24237-24237/? W/dalvikvm: VFY: unable to resolve virtual method 1683: Landroid/content/ContentProvider;.openFile (Landroid/net/Uri;Ljava/lang/String;Landroid/os/CancellationSignal;)Landroid/os/ParcelFileDescriptor;
01-26 15:21:41.775 24237-24237/? W/dalvikvm: VFY: unable to resolve virtual method 1687: Landroid/content/ContentProvider;.openTypedAssetFile (Landroid/net/Uri;Ljava/lang/String;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Landroid/content/res/AssetFileDescriptor;
01-26 15:21:41.775 24237-24237/? W/dalvikvm: VFY: unable to resolve virtual method 1693: Landroid/content/ContentProvider;.uncanonicalize (Landroid/net/Uri;)Landroid/net/Uri;
01-26 15:21:42.320 24237-24237/? W/dalvikvm: Link of class 'Lkex;' failed
01-26 15:21:42.320 24237-24237/? W/dalvikvm: Unable to resolve superclass of Lkey; (11005)
01-26 15:21:42.320 24237-24237/? W/dalvikvm: Link of class 'Lkey;' failed
01-26 15:21:42.320 24237-24237/? E/dalvikvm: Could not find class 'key', referenced from method ket.a
01-26 15:21:42.320 24237-24237/? W/dalvikvm: VFY: unable to resolve new-instance 2707 (Lkey;) in Lket;
01-26 15:21:42.320 24237-24237/? W/dalvikvm: Link of class 'Lkex;' failed
01-26 15:21:42.325 24237-24237/? E/dalvikvm: Could not find class 'kex', referenced from method ket.a
01-26 15:21:42.325 24237-24237/? W/dalvikvm: VFY: unable to resolve new-instance 2706 (Lkex;) in Lket;
01-26 15:21:42.325 24237-24237/? W/dalvikvm: Link of class 'Lkex;' failed
01-26 15:21:42.325 24237-24237/? W/dalvikvm: Unable to resolve superclass of Lkey; (11005)
01-26 15:21:42.325 24237-24237/? W/dalvikvm: Link of class 'Lkey;' failed
01-26 15:21:42.325 24237-24237/? W/dalvikvm: Link of class 'Lkex;' failed
01-26 15:21:42.420 24237-24237/? W/dalvikvm: VFY: unable to resolve virtual method 1755: Landroid/content/Context;.isDeviceProtectedStorage ()Z
01-26 15:21:42.425 24237-24237/? W/dalvikvm: VFY: unable to resolve virtual method 2370: Landroid/os/UserHandle;.isOwner ()Z
01-26 15:21:42.510 24227-24227/? E/ActivityThread: Service com.sec.factory.cporiented.FtClientCPO has leaked ServiceConnection com.sec.factory.cporiented.FtClientCPO$1@428c3c78 that was originally bound here
                                                   android.app.ServiceConnectionLeaked: Service com.sec.factory.cporiented.FtClientCPO has leaked ServiceConnection com.sec.factory.cporiented.FtClientCPO$1@428c3c78 that was originally bound here
                                                       at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:979)
                                                       at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:873)
                                                       at android.app.ContextImpl.bindServiceAsUser(ContextImpl.java:1833)
                                                       at android.app.ContextImpl.bindService(ContextImpl.java:1821)
                                                       at android.content.ContextWrapper.bindService(ContextWrapper.java:503)
                                                       at com.sec.factory.cporiented.FtClientCPO.connectToSecPhoneService(FtClientCPO.java:123)
                                                       at com.sec.factory.cporiented.FtClientCPO.onCreate(FtClientCPO.java:74)
                                                       at android.app.ActivityThread.handleCreateService(ActivityThread.java:2687)
                                                       at android.app.ActivityThread.access$1700(ActivityThread.java:159)
                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1404)
                                                       at android.os.Handler.dispatchMessage(Handler.java:99)
                                                       at android.os.Looper.loop(Looper.java:176)
                                                       at android.app.ActivityThread.main(ActivityThread.java:5419)
                                                       at java.lang.reflect.Method.invokeNative(Native Method)
                                                       at java.lang.reflect.Method.invoke(Method.java:525)
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
                                                       at dalvik.system.NativeStart.main(Native Method)
01-26 15:21:42.785 24267-24267/? W/dalvikvm: VFY: unable to resolve virtual method 1671: Landroid/content/ContentProvider;.canonicalize (Landroid/net/Uri;)Landroid/net/Uri;
01-26 15:21:42.785 24267-24267/? W/dalvikvm: VFY: unable to resolve virtual method 1681: Landroid/content/ContentProvider;.openAssetFile (Landroid/net/Uri;Ljava/lang/String;Landroid/os/CancellationSignal;)Landroid/content/res/AssetFileDescriptor;
01-26 15:21:42.785 24267-24267/? W/dalvikvm: VFY: unable to resolve virtual method 1683: Landroid/content/ContentProvider;.openFile (Landroid/net/Uri;Ljava/lang/String;Landroid/os/CancellationSignal;)Landroid/os/ParcelFileDescriptor;
01-26 15:21:42.785 24267-24267/? W/dalvikvm: VFY: unable to resolve virtual method 1687: Landroid/content/ContentProvider;.openTypedAssetFile (Landroid/net/Uri;Ljava/lang/String;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Landroid/content/res/AssetFileDescriptor;
01-26 15:21:42.785 24267-24267/? W/dalvikvm: VFY: unable to resolve virtual method 1693: Landroid/content/ContentProvider;.uncanonicalize (Landroid/net/Uri;)Landroid/net/Uri;
01-26 15:21:42.825 24227-24227/? E/FactoryTestApp: [SensorSpec$setSpecAccel] feature : Unknown => return null
01-26 15:21:42.890 24227-24227/? W/FactoryTestApp: WARNNING: java.io.IOException: write failed: EINVAL (Invalid argument)
01-26 15:21:42.890 24227-24227/? W/FactoryTestApp: WARNNING:     libcore.io.IoBridge.write(IoBridge.java:455)
01-26 15:21:42.890 24227-24227/? W/FactoryTestApp: WARNNING:     java.io.FileOutputStream.write(FileOutputStream.java:187)
01-26 15:21:42.890 24227-24227/? W/FactoryTestApp: WARNNING:     java.io.OutputStreamWriter.flushBytes(OutputStreamWriter.java:167)
01-26 15:21:42.890 24227-24227/? W/FactoryTestApp: WARNNING:     java.io.OutputStreamWriter.flush(OutputStreamWriter.java:158)
01-26 15:21:42.890 24227-24227/? W/FactoryTestApp: WARNNING:     com.sec.factory.support.Support$Kernel.write(Support.java:1109)
01-26 15:21:42.890 24227-24227/? W/FactoryTestApp: WARNNING:     com.sec.factory.modules.ModulePower.writeBatteryAdcCal(ModulePower.java:418)
01-26 15:21:42.890 24227-24227/? W/FactoryTestApp: WARNNING:     com.sec.factory.aporiented.athandler.AtBattcali.setCalibrationOnBoot(AtBattcali.java:21)
01-26 15:21:42.890 24227-24227/? W/FactoryTestApp: WARNNING:     com.sec.factory.aporiented.athandler.AtBattcali.<init>(AtBattcali.java:14)
01-26 15:21:42.890 24227-24227/? W/FactoryTestApp: WARNNING:     com.sec.factory.cporiented.AtParserCPO.registerAllHandler(AtParserCPO.java:165)
01-26 15:21:42.890 24227-24227/? W/FactoryTestApp: WARNNING:     com.sec.factory.cporiented.FtClientCPO.createResponseWriter(FtClientCPO.java:138)
01-26 15:21:42.890 24227-24227/? W/FactoryTestApp: WARNNING:     com.sec.factory.cporiented.FtClientCPO$1.onServiceConnected(FtClientCPO.java:149)
01-26 15:21:42.895 24227-24227/? W/FactoryTestApp: WARNNING:     android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1111)
01-26 15:21:42.895 24227-24227/? W/FactoryTestApp: WARNNING:     android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1128)
01-26 15:21:42.895 24227-24227/? W/FactoryTestApp: WARNNING:     android.os.Handler.handleCallback(Handler.java:730)
01-26 15:21:42.895 24227-24227/? W/FactoryTestApp: WARNNING:     android.os.Handler.dispatchMessage(Handler.java:92)
01-26 15:21:42.895 24227-24227/? W/FactoryTestApp: WARNNING:     android.os.Looper.loop(Looper.java:176)
01-26 15:21:42.895 24227-24227/? W/FactoryTestApp: WARNNING:     android.app.ActivityThread.main(ActivityThread.java:5419)
01-26 15:21:42.895 24227-24227/? W/FactoryTestApp: WARNNING:     java.lang.reflect.Method.invokeNative(Native Method)
01-26 15:21:42.895 24227-24227/? W/FactoryTestApp: WARNNING:     java.lang.reflect.Method.invoke(Method.java:525)
01-26 15:21:42.895 24227-24227/? W/FactoryTestApp: WARNNING:     com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
01-26 15:21:42.895 24227-24227/? W/FactoryTestApp: WARNNING:     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
01-26 15:21:42.895 24227-24227/? W/FactoryTestApp: WARNNING:     dalvik.system.NativeStart.main(Native Method)
01-26 15:21:42.945 1932-2056/? E/SECHWC_LOG: rgb overlay acquireFence sync_wait error
01-26 15:21:43.040 2389-2517/? W/InputDispatcher: channel ~ Consumer closed input channel or an error occurred.  events=0xd
01-26 15:21:43.040 2389-2517/? E/InputDispatcher: channel ~ Channel is unrecoverably broken and will be disposed!
01-26 15:21:43.040 2389-12351/? W/InputDispatcher: Attempted to unregister already unregistered input channel
01-26 15:21:43.040 2389-2400/? W/ActivityManager: Force removing ActivityRecord{441d0ca0 u0 io.proximi.proximiiomaptest/.MainActivity}: app died, no saved state

I'm able to consistently trigger this by drawing a large image to map with ImageSource + RasterLayer, and then zooming in to the image as close as possible, and then repeatedly slightly zooming out/in (hold one finger still and move one back and forth). This results in a significant performance drop followed by a crash, but without any "Unfortunately App has stopped" popups or ANRs.

Even though this log is from Android 4.3, I'm able to reproduce this on all my devices:

  • Samsung Galaxy S3 (Android 4.3)
  • Nexus 5X (Android 8.1.0)
  • Samsung Galaxy J5 (2015) (Android 6.0.1)

Still, it looks to be easier to reproduce on lower performance devices. On Nexus 5X it takes around 20s of fiddling to crash, and around 6s on S3. Once you notice a hitch in framerate, logs show all kinds of problems. If you stop fiddling there, the app won't necessarily crash (Log from Android 8.1.0: https://pastebin.com/ztvgbXFB). This suggests that it's not really DeadObjectException crashing the app (at least for me), but rather the exception is just another symptom. Here's a log from fiddling until a crash on Android 8.1.0: https://pastebin.com/weve75PB

I tried adding mapbox:mapbox_renderTextureMode="true" in my map's XML layout, but it doesn't help on any device.

I'm using Mapbox Android SDK 5.3.1

@nitaliano
Copy link
Owner

nitaliano commented Jan 27, 2018

Actually I think we can try two things to learn from information about this

  1. Strip location out of the sdk completely and try to reproduce the problem
  2. Try out Google as a location engine

@SamiPatanen
Copy link

I was using a custom location engine, so I don't think that makes a difference.

That being said, I'll try to create a minimal app on Monday that I can reproduce the issue with, similar to @henrikra's repo.

@nitaliano
Copy link
Owner

there is a fix out for this issue #1001

@henrikra
Copy link
Contributor

henrikra commented Jan 30, 2018

We tried both #1001 and #1010 and those PR's don't help with this problem.

Then we went back to vanilla 6.0.3-rc1 version and tried this:
We tried now setting textureMode to true and we are not able to crash the Android anymore 🎉

But when using textureMode on true on first load the map is black (see the logs below). To be able to see the map we have to refresh current screen or just restart the app. So looks like mapbox is downloading the map but is not able to update the view when it has downloaded the map.

Btw what the textureMode as true does? Can we set it to all Android users? Are there drawbacks?

TLDR

  1. textureMode as true prevents the crash
  2. map is black on first load with the previous setting. Needs a fix

Logs when map is black:

01-30 10:29:07.586 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface:417 error 3003 (EGL_BAD_ALLOC)
01-30 10:29:07.586 30818-31668/com.myApp.dev E/BufferQueueProducer: [unnamed-30818-0] connect(P): already connected (cur=1 req=1)
01-30 10:29:07.586 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface: native_window_api_connect (win=0xac02c548) failed (0xffffffea) (already connected to another API?)
01-30 10:29:07.586 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface:417 error 3003 (EGL_BAD_ALLOC)
01-30 10:29:07.586 30818-31668/com.myApp.dev E/BufferQueueProducer: [unnamed-30818-0] connect(P): already connected (cur=1 req=1)
01-30 10:29:07.586 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface: native_window_api_connect (win=0xabe28498) failed (0xffffffea) (already connected to another API?)
01-30 10:29:07.586 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface:417 error 3003 (EGL_BAD_ALLOC)
01-30 10:29:07.586 30818-31668/com.myApp.dev E/BufferQueueProducer: [unnamed-30818-0] connect(P): already connected (cur=1 req=1)
01-30 10:29:07.586 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface: native_window_api_connect (win=0xac02c548) failed (0xffffffea) (already connected to another API?)
01-30 10:29:07.586 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface:417 error 3003 (EGL_BAD_ALLOC)
01-30 10:29:07.586 30818-31668/com.myApp.dev E/BufferQueueProducer: [unnamed-30818-0] connect(P): already connected (cur=1 req=1)
01-30 10:29:07.586 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface: native_window_api_connect (win=0xabe28498) failed (0xffffffea) (already connected to another API?)
01-30 10:29:07.587 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface:417 error 3003 (EGL_BAD_ALLOC)
01-30 10:29:07.587 30818-31668/com.myApp.dev E/BufferQueueProducer: [unnamed-30818-0] connect(P): already connected (cur=1 req=1)
01-30 10:29:07.587 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface: native_window_api_connect (win=0xac02c548) failed (0xffffffea) (already connected to another API?)
01-30 10:29:07.587 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface:417 error 3003 (EGL_BAD_ALLOC)
01-30 10:29:07.587 30818-31668/com.myApp.dev E/BufferQueueProducer: [unnamed-30818-0] connect(P): already connected (cur=1 req=1)
01-30 10:29:07.587 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface: native_window_api_connect (win=0xabe28498) failed (0xffffffea) (already connected to another API?)
01-30 10:29:07.587 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface:417 error 3003 (EGL_BAD_ALLOC)
01-30 10:29:07.587 30818-31668/com.myApp.dev E/BufferQueueProducer: [unnamed-30818-0] connect(P): already connected (cur=1 req=1)
01-30 10:29:07.587 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface: native_window_api_connect (win=0xac02c548) failed (0xffffffea) (already connected to another API?)
01-30 10:29:07.587 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface:417 error 3003 (EGL_BAD_ALLOC)
01-30 10:29:07.587 30818-31668/com.myApp.dev E/BufferQueueProducer: [unnamed-30818-0] connect(P): already connected (cur=1 req=1)
01-30 10:29:07.587 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface: native_window_api_connect (win=0xabe28498) failed (0xffffffea) (already connected to another API?)
01-30 10:29:07.587 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface:417 error 3003 (EGL_BAD_ALLOC)
01-30 10:29:07.587 30818-31668/com.myApp.dev E/BufferQueueProducer: [unnamed-30818-0] connect(P): already connected (cur=1 req=1)
01-30 10:29:07.587 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface: native_window_api_connect (win=0xac02c548) failed (0xffffffea) (already connected to another API?)
01-30 10:29:07.587 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface:417 error 3003 (EGL_BAD_ALLOC)
01-30 10:29:07.588 30818-31668/com.myApp.dev E/BufferQueueProducer: [unnamed-30818-0] connect(P): already connected (cur=1 req=1)
01-30 10:29:07.588 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface: native_window_api_connect (win=0xabe28498) failed (0xffffffea) (already connected to another API?)
01-30 10:29:07.588 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface:417 error 3003 (EGL_BAD_ALLOC)
01-30 10:29:07.588 30818-31668/com.myApp.dev E/BufferQueueProducer: [unnamed-30818-0] connect(P): already connected (cur=1 req=1)
01-30 10:29:07.588 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface: native_window_api_connect (win=0xac02c548) failed (0xffffffea) (already connected to another API?)
01-30 10:29:07.588 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface:417 error 3003 (EGL_BAD_ALLOC)
01-30 10:29:07.588 30818-31668/com.myApp.dev E/BufferQueueProducer: [unnamed-30818-0] connect(P): already connected (cur=1 req=1)
01-30 10:29:07.588 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface: native_window_api_connect (win=0xabe28498) failed (0xffffffea) (already connected to another API?)
01-30 10:29:07.588 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface:417 error 3003 (EGL_BAD_ALLOC)
01-30 10:29:07.588 30818-31668/com.myApp.dev E/BufferQueueProducer: [unnamed-30818-0] connect(P): already connected (cur=1 req=1)
01-30 10:29:07.588 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface: native_window_api_connect (win=0xac02c548) failed (0xffffffea) (already connected to another API?)
01-30 10:29:07.588 30818-31668/com.myApp.dev E/libEGL: eglCreateWindowSurface:417 error 3003 (EGL_BAD_ALLOC)

@SamiPatanen
Copy link

I had some trouble recreating the crash from scratch, and I was only able to reproduce the crash with a custom style. It's likely I'm having a separate issue. I'll open a separate issue somewhere once I have the time to complete an app that can reproduce the crash I'm experiencing.

@henrikra Android textureMode doc

@hannta
Copy link
Author

hannta commented Feb 5, 2018

Hi @nitaliano, is there any updates on this?

@henrikra
Copy link
Contributor

@nitaliano Can you tell some status of this? This is number one priority for us! :/

@nitaliano
Copy link
Owner

I'm focusing on this issue this week, I want to fix this before the final 6.0.3 release

@nitaliano
Copy link
Owner

nitaliano commented Feb 12, 2018

When I comment out the onDestroy call to the MapView I no longer seem to run into this issue.
It's NativeMapView.destroy that seems to be causing the problem

UPDATE:
It appears that onDestroy must be called in the Activities onDestroy react native runs in a single activity so we cannot just leave this memory lying around until we decide to kill the app. It appears that we will need to drop support for the GLSurfaceView and just render it in a TextureView to prevent this crash from happening. I don't see any other way around it, we can call onDestroy when the MapView is removed from the screen with a TextureView

@henrikra to answer your question above GLSurfaceView will have slightly better performance than a TextureView but to achieve that only one MapView can be rendered in an Activity at the same time so you cannot have two GLSurfaceViews stacked on top of each other. TextureView still has great performance and makes it behave more like a regular view, which makes dealing with it's lifecycle much simpler

@nitaliano
Copy link
Owner

Can someone test this PR out #1033. I don't have the Sony phone on me but I'm no longer running into the ANR's that were being created before.

@ricardochen
Copy link

ricardochen commented Feb 21, 2018

Huawei P9 Plus
I'm testing with textureMode={true} and the map it works, however, it freezes when I load custom annotations

      {<Mapbox.MapView
          key='mainmap'
          ref={map => { this.map = map; }}
          pitch={60}
          textureMode={true}
          styleURL={Mapbox.StyleURL.Light}
          zoomLevel={17}
          centerCoordinate={this.initCenterLocation()}
          
          style={{flex: 1}}
          showUserLocation={!(Platform.OS === 'android' && !this.state.isAndroidPermissionGranted )}
          userTrackingMode={Mapbox.UserTrackingModes.FollowWithHeading}
        >
          {this.state.markers.map(marker => (

          <Mapbox.PointAnnotation
          key={marker.key}
          id={marker.key}
          anchor={{ x: 0.5, y: 1 }}
          onSelected={(feature) =>this.displayAnnotationModal(feature, marker.key)}
          coordinate={marker.coordinates}>
          <Image source={marker.image} style={{width:50, height:60}}/>
          
          </Mapbox.PointAnnotation>

          ))}
        </Mapbox.MapView>}

@nitaliano
Copy link
Owner

nitaliano commented Feb 21, 2018

@ricardochen I would recommend using a ShapeSource with a SymbolLayer you'll be able to have millions of icons rendered to the screen PointAnnotation are more legacy and have more performance issues on Android than iOS due to the native platforms.

I can help you out if you need to make the switch to sources/layers we have a gitter https://gitter.im/react-native-mapbox-gl/Lobby?source=orgpage where you can ask me or anyone in the community anything you want

@henrikra
Copy link
Contributor

@nitaliano We are using also PointAnnotation so I guess we should refactor them too? :O

@nitaliano
Copy link
Owner

@henrikra yes, this shouldn't be an issue now with 6.1.0 if anyone runs into it again please post it in here.

@jpudysz
Copy link

jpudysz commented Mar 23, 2018

Hello @henrikra I have app freeze issue with 6.1.0. I was able to reproduce it on Samsung Galaxy Prime (Android 5.1.1). Additionally manipulating textureMode didn't fix it.

How to reproduce crash:

  1. Install your app with Mapbox
  2. Go with app to background mode
  3. Try to open the app

error

@jethromayuk
Copy link

Experiencing the above exception on a Huawei P9 Light using the latest dependencies:

implementation('com.mapbox.mapboxsdk:mapbox-android-sdk:5.5.1@aar') { transitive = true } implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.12.0' implementation('com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.12.0') { transitive = true }

E/FusedLocationProviderServiceDelegate: Error occurred trying to report a new Location android.os.DeadObjectException at android.os.BinderProxy.transactNative(Native Method) at android.os.BinderProxy.transact(Binder.java:505) at com.mapzen.android.lost.internal.IFusedLocationProviderCallback$Stub$Proxy.onLocationChanged(IFusedLocationProviderCallback.java:129) at com.mapzen.android.lost.internal.FusedLocationProviderServiceDelegate.reportLocation(FusedLocationProviderServiceDelegate.java:95) at com.mapzen.android.lost.internal.FusionEngine.onLocationChanged(FusionEngine.java:196) at com.mapzen.android.lost.internal.FusionEngine.checkLastKnownAndNotify(FusionEngine.java:183) at com.mapzen.android.lost.internal.FusionEngine.checkLastKnownPassive(FusionEngine.java:177) at com.mapzen.android.lost.internal.FusionEngine.enable(FusionEngine.java:134) at com.mapzen.android.lost.internal.LocationEngine.removeRequests(LocationEngine.java:61) at com.mapzen.android.lost.internal.FusedLocationProviderServiceDelegate.removeLocationUpdates(FusedLocationProviderServiceDelegate.java:69) at com.mapzen.android.lost.internal.FusedLocationProviderService$1.removeLocationUpdates(FusedLocationProviderService.java:48) at com.mapzen.android.lost.internal.IFusedLocationProviderService$Stub.onTransact(IFusedLocationProviderService.java:110) at android.os.Binder.execTransact(Binder.java:453)

@jpudysz
Copy link

jpudysz commented Apr 24, 2018

Any update?

@anttijva
Copy link

anttijva commented Mar 8, 2019

iOS release and debug works like a charm, android debug works but release crashes because of this.

Samsung Xcover 3, android 5.1.1
"@mapbox/react-native-mapbox-gl": "^6.1.3"

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

No branches or pull requests

10 participants