Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Random native crash makes our CI integration flaky #6286

Closed

Description

@tobrun

We currently run instrumentation tests as part of our CI integration on Android. I have been hearing about reports of the test being flaky. Most occurrences of flakyness are coming from random native crashes. I haven't been able to pinpoint where these are coming from since they are not reproducible on demand and I haven't noticed this issue while running on a device locally.

An example of such a native crash:

09-07 09:15:06.169: I/DEBUG(357): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
09-07 09:15:06.169: I/DEBUG(357): Build fingerprint: 'google/shamu/shamu:5.1.1/LMY48Y/2364368:user/release-keys'
09-07 09:15:06.169: I/DEBUG(357): Revision: '33696'
09-07 09:15:06.169: I/DEBUG(357): ABI: 'arm'
09-07 09:15:06.169: I/DEBUG(357): pid: 22827, tid: 24280, name: Worker  >>> com.mapbox.mapboxsdk.testapp <<<
09-07 09:15:06.170: I/DEBUG(357): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
09-07 09:15:06.213: I/DEBUG(357):     r0 00000000  r1 912a9970  r2 a08b8e00  r3 8c073d40
09-07 09:15:06.213: I/DEBUG(357):     r4 910aeed8  r5 912a9970  r6 968e2760  r7 9965bb70
09-07 09:15:06.213: I/DEBUG(357):     r8 7a18293c  r9 9965bb84  sl 910aef00  fp 9965bb74
09-07 09:15:06.213: I/DEBUG(357):     ip b6e907dc  sp 9965baf8  lr a17a0da4  pc a17a0e84  cpsr 600f0010
09-07 09:15:06.214: I/DEBUG(357): backtrace:
09-07 09:15:06.214: I/DEBUG(357):     #00 pc 00128e84  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
09-07 09:15:06.214: I/DEBUG(357):     #01 pc 00128da0  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
09-07 09:15:06.214: I/DEBUG(357):     #02 pc 00138ae8  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
09-07 09:15:06.214: I/DEBUG(357):     #03 pc 0013ddf4  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
09-07 09:15:06.214: I/DEBUG(357):     #04 pc 0013dc04  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
09-07 09:15:06.214: I/DEBUG(357):     #05 pc 0014114c  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
09-07 09:15:06.214: I/DEBUG(357):     #06 pc 00141030  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
09-07 09:15:06.214: I/DEBUG(357):     #07 pc 00139188  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
09-07 09:15:06.214: I/DEBUG(357):     #08 pc 001390d0  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
09-07 09:15:06.214: I/DEBUG(357):     #09 pc 00016baf  /system/lib/libc.so (__pthread_start(void*)+30)
09-07 09:15:06.214: I/DEBUG(357):     #10 pc 00014af3  /system/lib/libc.so (__start_thread+6)

Links to the some actual failing test cases:

cc @mapbox/mobile

Activity

  1. added
    Android
    on Sep 7, 2016
  2. jfirebaugh commented on Sep 7, 2016

    @jfirebaugh
    Contributor

    @tobrun Is it possible to symbolicate the stack trace automatically, so that when issues like this occur in CI we at least have the code location leading up the the crash?

  3. tobrun commented on Sep 7, 2016

    @tobrun
    MemberAuthor

    yes, been talking with @ivovandongen about this. Just need to get the stacktrace stripped from the logcat file and run ndk-stack on it. I'm handling this as a high priority since this is blocking other people and making them mad ("grinding their teeth").

  4. tobrun commented on Sep 8, 2016

    @tobrun
    MemberAuthor

    While trying to make the build fail with a native crash, I'm also running into:

    java.lang.Error: eglSwapBuffers() failed
     FATAL EXCEPTION: main
     Process: com.mapbox.mapboxsdk.testapp, PID: 6773
     java.lang.Error: eglSwapBuffers() failed
        at com.mapbox.mapboxsdk.maps.NativeMapView.nativeRender(Native Method)
        at com.mapbox.mapboxsdk.maps.NativeMapView.render(NativeMapView.java:138)
        at com.mapbox.mapboxsdk.maps.MapView.onDraw(MapView.java:1379)
        at android.view.View.draw(View.java:15231)
        at android.widget.FrameLayout.draw(FrameLayout.java:598)
        at android.view.View.updateDisplayListIfDirty(View.java:14167)
        at android.view.View.getDisplayList(View.java:14189)
        at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
        at android.view.View.updateDisplayListIfDirty(View.java:14127)
        at android.view.View.getDisplayList(View.java:14189)
        at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
        at android.view.View.updateDisplayListIfDirty(View.java:14127)
        at android.view.View.getDisplayList(View.java:14189)
        at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
        at android.view.View.updateDisplayListIfDirty(View.java:14127)
        at android.view.View.getDisplayList(View.java:14189)
        at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
        at android.view.View.updateDisplayListIfDirty(View.java:14127)
        at android.view.View.getDisplayList(View.java:14189)
        at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
        at android.view.View.updateDisplayListIfDirty(View.java:14127)
        at android.view.View.getDisplayList(View.java:14189)
        at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
        at android.view.View.updateDisplayListIfDirty(View.java:14127)
        at android.view.View.getDisplayList(View.java:14189)
        at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:273)
        at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:279)
        at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:318)
        at android.view.ViewRootImpl.draw(ViewRootImpl.java:2530)
        at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2352)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1982)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1061)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5885)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
        at android.view.Choreographer.doCallbacks(Choreographer.java:580)
        at android.view.Choreographer.doFrame(Choreographer.java:550)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:135)
        at android.app.ActivityThread.main(ActivityThread.java:5254)
        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:903)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
  5. tobrun commented on Sep 8, 2016

    @tobrun
    MemberAuthor

    I was able to integrate the suggestion from #6286 (comment).

    When the logcat output from Firebase test lab contains a native stacktrace. eg:

    09-07 17:41:53.741: I/DEBUG(357): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    09-07 17:41:53.743: I/DEBUG(357): Build fingerprint: 'google/shamu/shamu:5.1.1/LMY48Y/2364368:user/release-keys'
    09-07 17:41:53.744: I/DEBUG(357): Revision: '33696'
    09-07 17:41:53.745: I/DEBUG(357): ABI: 'arm'
    09-07 17:41:53.746: I/DEBUG(357): pid: 12124, tid: 12788, name: Worker  >>> com.mapbox.mapboxsdk.testapp <<<
    09-07 17:41:53.747: I/DEBUG(357): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
    09-07 17:41:53.783: I/DEBUG(357):     r0 00000000  r1 954376c0  r2 91834900  r3 8e4e73c0
    09-07 17:41:53.783: I/DEBUG(357):     r4 95466d58  r5 954376c0  r6 8e45ed60  r7 9c949b70
    09-07 17:41:53.783: I/DEBUG(357):     r8 9551cd38  r9 9c949b84  sl 95466d80  fp 9c949b74
    09-07 17:41:53.783: I/DEBUG(357):     ip 0000002d  sp 9c949af8  lr a17dad84  pc a17dae64  cpsr 600f0010
    09-07 17:41:53.784: I/DEBUG(357): backtrace:
    09-07 17:41:53.784: I/DEBUG(357):     #00 pc 00128e64  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
    09-07 17:41:53.784: I/DEBUG(357):     #01 pc 00128d80  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
    09-07 17:41:53.784: I/DEBUG(357):     #02 pc 00138ac8  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
    09-07 17:41:53.784: I/DEBUG(357):     #03 pc 0013ddd4  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
    09-07 17:41:53.784: I/DEBUG(357):     #04 pc 0013dbe4  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
    09-07 17:41:53.784: I/DEBUG(357):     #05 pc 0014112c  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
    09-07 17:41:53.784: I/DEBUG(357):     #06 pc 00141010  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
    09-07 17:41:53.785: I/DEBUG(357):     #07 pc 00139168  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
    09-07 17:41:53.785: I/DEBUG(357):     #08 pc 001390b0  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
    09-07 17:41:53.785: I/DEBUG(357):     #09 pc 00016baf  /system/lib/libc.so (__pthread_start(void*)+30)
    09-07 17:41:53.785: I/DEBUG(357):     #10 pc 00014af3  /system/lib/libc.so (__start_thread+6)
    

    Than the output from ndk-stack command will be shown in the bitrise output as:

    screen shot 2016-09-07 at 17 55 31

    Note: it doesn't show output with file and line numbers... I think this has to do with having our Buildtype set to release. Need to look into this more before merging.

    Update: setting buildtype to debug doesn't resolve the issue, seeing the same result as above. @ivovandongen / @zugaldia any idea why this is not working?

  6. tobrun commented on Sep 8, 2016

    @tobrun
    MemberAuthor

    Thanks to @ivovandongen for 👀. It seemed the path for ndk-stack has changed with the introduction of the cmake build system. After changing the path I'm able to symbolicate the crash:

    screen shot 2016-09-08 at 07 43 58

  7. jfirebaugh commented on Sep 8, 2016

    @jfirebaugh
    Contributor

    Sqlite error on a UPDATE resources ... query. Probably #6193. #6267 should help diagnose more precisely.

    Does ndk-stack have a mode where you can pipe output through it? Ideally the symbolicated stack trace appears in the proper context of the rest of the log, like in Android Studio output.

  8. tobrun commented on Sep 8, 2016

    @tobrun
    MemberAuthor

    Capturing from @ivovandongen that it doesn't seem supported or we need to "smart" parse it ourselves in parts. FWIW this it the source of ndk-stack.

  9. tobrun commented on Sep 9, 2016

    @tobrun
    MemberAuthor

    Received report of another random crash:

    screen shot 2016-09-09 at 15 47 00

  10. friedbunny commented on Sep 9, 2016

    @friedbunny
    Contributor

    Received report of another random crash:

    That’s #6300, which @jfirebaugh closed as a dupe of #6263.

  11. tobrun commented on Sep 12, 2016

    @tobrun
    MemberAuthor

    Strictmode is acting up occasionally. eg:

    09-12 04:26:09.903: E/StrictMode(2513): A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
    09-12 04:26:09.903: E/StrictMode(2513): java.lang.Throwable: Explicit termination method 'end' not called
    09-12 04:26:09.903: E/StrictMode(2513):     at dalvik.system.CloseGuard.open(CloseGuard.java:184)
    09-12 04:26:09.903: E/StrictMode(2513):     at java.util.zip.Inflater.<init>(Inflater.java:82)
    09-12 04:26:09.903: E/StrictMode(2513):     at okio.GzipSource.<init>(GzipSource.java:62)
    09-12 04:26:09.903: E/StrictMode(2513):     at okhttp3.internal.http.HttpEngine.unzip(HttpEngine.java:506)
    09-12 04:26:09.903: E/StrictMode(2513):     at okhttp3.internal.http.HttpEngine.readResponse(HttpEngine.java:684)
    09-12 04:26:09.903: E/StrictMode(2513):     at okhttp3.RealCall.getResponse(RealCall.java:244)
    09-12 04:26:09.903: E/StrictMode(2513):     at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:201)
    09-12 04:26:09.903: E/StrictMode(2513):     at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:163)
    09-12 04:26:09.903: E/StrictMode(2513):     at okhttp3.RealCall.access$100(RealCall.java:30)
    09-12 04:26:09.903: E/StrictMode(2513):     at okhttp3.RealCall$AsyncCall.execute(RealCall.java:127)
    09-12 04:26:09.903: E/StrictMode(2513):     at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
    09-12 04:26:09.903: E/StrictMode(2513):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    09-12 04:26:09.903: E/StrictMode(2513):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    09-12 04:26:09.903: E/StrictMode(2513):     at java.lang.Thread.run(Thread.java:818)
    09-12 04:26:09.903: W/System.err(2513): StrictMode VmPolicy violation with POLICY_DEATH; shutting down.
  12. jfirebaugh commented on Sep 13, 2016

    @jfirebaugh
    Contributor

    Original report here is #6263. Let's open separate issues for other CI failures.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Androidtests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions