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

mbgl::gl::value::Viewport::Get() == getContext().viewport.getCurrentValue() failed #7220

Closed
tobrun opened this issue Nov 29, 2016 · 15 comments
Closed
Assignees
Labels
Android Mapbox Maps SDK for Android crash

Comments

@tobrun
Copy link
Member

tobrun commented Nov 29, 2016

I was able to produce the following crash below with:

  • make run-android-lib-arm-v8
  • make run-android-ui-test

It fails on testCirclePitchScale but occurs on other tests as well, not constantly reproducible:

11-29 11:18:08.754 10875-10875/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
11-29 11:18:08.754 10875-10875/? A/DEBUG: Build fingerprint: 'google/ryu/dragon:7.1.1/NPF10C/3347772:user/release-keys'
11-29 11:18:08.754 10875-10875/? A/DEBUG: Revision: '0'
11-29 11:18:08.754 10875-10875/? A/DEBUG: ABI: 'arm64'
11-29 11:18:08.754 10875-10875/? A/DEBUG: pid: 9804, tid: 9804, name: pboxsdk.testapp  >>> com.mapbox.mapboxsdk.testapp <<<
11-29 11:18:08.754 10875-10875/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
11-29 11:18:08.757 10875-10875/? A/DEBUG: Abort message: '../../../platform/android/src/native_map_view.cpp:107: void mbgl::android::NativeMapView::updateViewBinding(): assertion "mbgl::gl::value::Viewport::Get() == getContext().viewport.getCurrentValue()" failed'
11-29 11:18:08.757 10875-10875/? A/DEBUG:     x0   0000000000000000  x1   000000000000264c  x2   0000000000000006  x3   0000000000000008
11-29 11:18:08.757 10875-10875/? A/DEBUG:     x4   0000000000000000  x5   0000000000808080  x6   0000000000000000  x7   0000000000000030
11-29 11:18:08.758 10875-10875/? A/DEBUG:     x8   0000000000000083  x9   ffffffffffffffdf  x10  0000000000000000  x11  0000000000000001
11-29 11:18:08.758 10875-10875/? A/DEBUG:     x12  0000000000000028  x13  0000000000000000  x14  0000000000000000  x15  00251493a82bb652
11-29 11:18:08.758 10875-10875/? A/DEBUG:     x16  000000746c8b9ee0  x17  000000746c863aac  x18  0000000c00000000  x19  000000746e7e0b40
11-29 11:18:08.758 10875-10875/? A/DEBUG:     x20  0000000000000006  x21  000000746e7e0a98  x22  000000000000000b  x23  000000001352ec00
11-29 11:18:08.758 10875-10875/? A/DEBUG:     x24  000000001352ec00  x25  0000000012c52730  x26  0000000000000000  x27  0000000000000000
11-29 11:18:08.758 10875-10875/? A/DEBUG:     x28  0000000000000000  x29  0000007ff4f76880  x30  000000746c860ed8
11-29 11:18:08.758 10875-10875/? A/DEBUG:     sp   0000007ff4f76860  pc   000000746c863ab4  pstate 0000000060000000
11-29 11:18:08.758 3102-3102/? E/NowRemoteClient: skipping logEndstates, service is null
11-29 11:18:08.767 10875-10875/? A/DEBUG: backtrace:
11-29 11:18:08.767 10875-10875/? A/DEBUG:     #00 pc 000000000006bab4  /system/lib64/libc.so (tgkill+8)
11-29 11:18:08.767 10875-10875/? A/DEBUG:     #01 pc 0000000000068ed4  /system/lib64/libc.so (pthread_kill+64)
11-29 11:18:08.767 10875-10875/? A/DEBUG:     #02 pc 0000000000023f58  /system/lib64/libc.so (raise+24)
11-29 11:18:08.767 10875-10875/? A/DEBUG:     #03 pc 000000000001c810  /system/lib64/libc.so (abort+52)
11-29 11:18:08.767 10875-10875/? A/DEBUG:     #04 pc 0000000000020f08  /system/lib64/libc.so (__libc_fatal+104)
11-29 11:18:08.767 10875-10875/? A/DEBUG:     #05 pc 000000000001cc28  /system/lib64/libc.so (__assert2+48)
11-29 11:18:08.767 10875-10875/? A/DEBUG:     #06 pc 00000000000cdeb0  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm64/libmapbox-gl.so
11-29 11:18:08.767 10875-10875/? A/DEBUG:     #07 pc 00000000000ce44c  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm64/libmapbox-gl.so
11-29 11:18:08.767 10875-10875/? A/DEBUG:     #08 pc 00000000000d4d50  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm64/libmapbox-gl.so
11-29 11:18:08.767 10875-10875/? A/DEBUG:     #09 pc 000000000071cfa8  /data/app/com.mapbox.mapboxsdk.testapp-1/oat/arm64/base.odex (offset 0x6d3000)
                                          
                                          
                                          [ 11-29 11:18:11.344   167:  167 W/         ]
                                          debuggerd: resuming target 9804

Symbolicated:

********** Crash dump: **********
Build fingerprint: 'google/ryu/dragon:7.1.1/NPF10C/3347772:user/release-keys'
pid: 9804, tid: 9804, name: pboxsdk.testapp  >>> com.mapbox.mapboxsdk.testapp <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Stack frame #00 pc 000000000006bab4  /system/lib64/libc.so (tgkill+8)
Stack frame #01 pc 0000000000068ed4  /system/lib64/libc.so (pthread_kill+64)
Stack frame #02 pc 0000000000023f58  /system/lib64/libc.so (raise+24)
Stack frame #03 pc 000000000001c810  /system/lib64/libc.so (abort+52)
Stack frame #04 pc 0000000000020f08  /system/lib64/libc.so (__libc_fatal+104)
Stack frame #05 pc 000000000001cc28  /system/lib64/libc.so (__assert2+48)
Stack frame #06 pc 00000000000cdeb0  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm64/libmapbox-gl.so: Routine mbgl::android::NativeMapView::updateViewBinding() at /home/tvn/Mapbox/mapbox-gl-native/build/android-arm-v8/Debug/../../../platform/android/src/native_map_view.cpp:107 (discriminator 2)
Stack frame #07 pc 00000000000ce44c  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm64/libmapbox-gl.so: Routine mbgl::android::NativeMapView::render() at /home/tvn/Mapbox/mapbox-gl-native/build/android-arm-v8/Debug/../../../platform/android/src/native_map_view.cpp:185
Stack frame #08 pc 00000000000d4d50  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm64/libmapbox-gl.so: Routine (anonymous namespace)::nativeRender(_JNIEnv*, jni::jobject*, long long) at /home/tvn/Mapbox/mapbox-gl-native/build/android-arm-v8/Debug/../../../platform/android/src/jni.cpp:367
Stack frame #09 pc 000000000071cfa8  /data/app/com.mapbox.mapboxsdk.testapp-1/oat/arm64/base.odex (offset 0x6d3000)

cc @mapbox/android

@tobrun tobrun added Android Mapbox Maps SDK for Android crash labels Nov 29, 2016
@tobrun
Copy link
Member Author

tobrun commented Nov 29, 2016

Also seeing this on testCircleRadius when building for arm-v7

@tobrun
Copy link
Member Author

tobrun commented Nov 29, 2016

Noting that I'm not seeing this crash on a phone factor device, only on a tablet.

cc @kkaefer, this issue seems related to the one with the keyboard?

@tobrun
Copy link
Member Author

tobrun commented Dec 9, 2016

Now for the first time I have seen this on CI, on a nexus 6, not constantly reproducible.

12-09 05:48:47.559: I/DEBUG(358): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-09 05:48:47.559: I/DEBUG(358): Build fingerprint: 'google/shamu/shamu:5.1.1/LMY48Y/2364368:user/release-keys'
12-09 05:48:47.559: I/DEBUG(358): Revision: '33696'
12-09 05:48:47.559: I/DEBUG(358): ABI: 'arm'
12-09 05:48:47.560: I/DEBUG(358): pid: 2869, tid: 2869, name: pboxsdk.testapp  >>> com.mapbox.mapboxsdk.testapp <<<
12-09 05:48:47.560: I/DEBUG(358): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
12-09 05:48:47.596: I/DEBUG(358): Abort message: '../../../platform/android/src/native_map_view.cpp:105: void mbgl::android::NativeMapView::updateViewBinding(): assertion "mbgl::gl::value::BindFramebuffer::Get() == getContext().bindFramebuffer.getCurrentValue()" failed'
12-09 05:48:47.596: I/DEBUG(358):     r0 00000000  r1 00000b35  r2 00000006  r3 00000000
12-09 05:48:47.596: I/DEBUG(358):     r4 b6f01e38  r5 00000006  r6 0000000b  r7 0000010c
12-09 05:48:47.596: I/DEBUG(358):     r8 b4b0ea00  r9 b4827800  sl 13a41f40  fp 00000000
12-09 05:48:47.596: I/DEBUG(358):     ip 00000b35  sp beee16a8  lr b6d7e3c5  pc b6da20ec  cpsr 60030010
12-09 05:48:47.596: I/DEBUG(358): backtrace:
12-09 05:48:47.596: I/DEBUG(358):     #00 pc 0003b0ec  /system/lib/libc.so (tgkill+12)
12-09 05:48:47.596: I/DEBUG(358):     #01 pc 000173c1  /system/lib/libc.so (pthread_kill+52)
12-09 05:48:47.597: I/DEBUG(358):     #02 pc 00017fd3  /system/lib/libc.so (raise+10)
12-09 05:48:47.597: I/DEBUG(358):     #03 pc 00014795  /system/lib/libc.so (__libc_android_abort+36)
12-09 05:48:47.597: I/DEBUG(358):     #04 pc 00012f44  /system/lib/libc.so (abort+4)
12-09 05:48:47.597: I/DEBUG(358):     #05 pc 00015ab1  /system/lib/libc.so (__libc_fatal+16)
12-09 05:48:47.597: I/DEBUG(358):     #06 pc 00014819  /system/lib/libc.so (__assert2+20)
12-09 05:48:47.597: I/DEBUG(358):     #07 pc 000e98f9  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
12-09 05:48:47.597: I/DEBUG(358):     #08 pc 000e9d25  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
12-09 05:48:47.597: I/DEBUG(358):     #09 pc 0004d459  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
12-09 05:48:47.597: I/DEBUG(358):     #10 pc 002206ff  /data/dalvik-cache/arm/data@app@com.mapbox.mapboxsdk.testapp-1@base.apk@classes.dex
12-09 05:48:49.293: W/ActivityManager(833): Error in app com.mapbox.mapboxsdk.testapp running instrumentation ComponentInfo{com.mapbox.mapboxsd

@kkaefer kkaefer self-assigned this Dec 9, 2016
@ivovandongen
Copy link
Contributor

@tobrun I've seen similar issues when something happens between Backend#activate and Backend#deactivate. This might be covering up the actual error. I've implemented a fix on @kkaefer 's suggestion here: a1cf025. This might uncover the actual issue.

@tobrun
Copy link
Member Author

tobrun commented Dec 15, 2016

Linking #6546 as this has become one of the causes for unreliable instrumentation tests. At the time of reporting this issue didn't show on CI, only the mentioned device in OP, but now the Nexus 6 has started to show this.

@kkaefer
Copy link
Member

kkaefer commented Dec 21, 2016

This error seems to be caused by an inactive GL context. In #5721, we introduced refcounting for activations, but it appears that we aren't activating the context in some situations where it is necessary.

@zugaldia zugaldia added this to the android-future milestone Jan 2, 2017
@zugaldia
Copy link
Member

zugaldia commented Jan 2, 2017

Adding this ticket to a milestone to bump its priority -- as noted by @tobrun, this is affecting our instrumentation tests.

@tobrun
Copy link
Member Author

tobrun commented Jan 27, 2017

Noticed a similar crash, not identical and only when compiling against arm-v8, haven't seen this on arm-v7:

pid: 17085, tid: 17085, name: pboxsdk.testapp >>> com.mapbox.mapboxsdk.testapp <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Stack frame #00 pc 000000000006b258 /system/lib64/libc.so (tgkill+8)
Stack frame #1 pc 00000000000686f4 /system/lib64/libc.so (pthread_kill+64)
Stack frame #2 pc 0000000000023ce8 /system/lib64/libc.so (raise+24)
Stack frame #3 pc 000000000001c76c /system/lib64/libc.so (abort+52)
Stack frame #4 pc 0000000000020cf4 /system/lib64/libc.so (__libc_fatal+104)
Stack frame #5 pc 000000000001cb7c /system/lib64/libc.so (__assert2+48)
Stack frame #6 pc 0000000000167320 /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm64/libmapbox-gl.so: Routine mbgl::android::NativeMapView::updateViewBinding() at /home/tvn/Mapbox/mapbox-gl-native/build/android-arm-v8/Debug/../../../platform/android/src/native_map_view.cpp:87
Stack frame #7 pc 0000000000167804 /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm64/libmapbox-gl.so: Routine mbgl::android::NativeMapView::render() at /home/tvn/Mapbox/mapbox-gl-native/build/android-arm-v8/Debug/../../../platform/android/src/native_map_view.cpp:167
Stack frame #8 pc 000000000007d5c4 /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm64/libmapbox-gl.so: Routine (anonymous namespace)::nativeRender(_JNIEnv*, jni::jobject*, long long) at /home/tvn/Mapbox/mapbox-gl-native/build/android-arm-v8/Debug/../../../platform/android/src/jni.cpp:367
Stack frame #9 pc 000000000051b408 /data/app/com.mapbox.mapboxsdk.testapp-1/oat/arm64/base.odex (offset 0x4e3000)

@tobrun
Copy link
Member Author

tobrun commented Mar 1, 2017

noting here that we are still occasionally hitting this issue on Firebase test lab.

@tobrun
Copy link
Member Author

tobrun commented Mar 1, 2017

One thing I noticed when looking into another issue is that this can occur when there isn't any valid surface. Eg. calling Map::render() when the surface hasn't been fully created yet.

@tobrun
Copy link
Member Author

tobrun commented Apr 21, 2017

With recent changes to master and verifying with runs on AWS/Firebase, confirming that this doesn't occur anymore. Closing for now.

@tobrun tobrun closed this as completed Apr 21, 2017
@tobrun
Copy link
Member Author

tobrun commented May 5, 2017

Reopening as this seems to have resurfaced:

backend.cpp:32: void mbgl::Backend::assumeFramebufferBinding(const gl::FramebufferID): assertion "gl::value::BindFramebuffer::Get() == getContext().bindFramebuffer.getCurrentValue()" failed'

05-05 01:02:10.844: I/DEBUG(203): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
05-05 01:02:10.844: I/DEBUG(203): Build fingerprint: 'google/volantis/flounder:5.0.2/LRX22L/1816899:user/release-keys'
05-05 01:02:10.844: I/DEBUG(203): Revision: '0'
05-05 01:02:10.845: I/DEBUG(203): ABI: 'arm'
05-05 01:02:10.845: I/DEBUG(203): pid: 14592, tid: 14592, name: pboxsdk.testapp  >>> com.mapbox.mapboxsdk.testapp <<<
05-05 01:02:10.845: I/DEBUG(203): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
05-05 01:02:10.861: I/DEBUG(203): Abort message: '/Users/Nurbot/mapbox-gl-native/src/mbgl/map/backend.cpp:32: void mbgl::Backend::assumeFramebufferBinding(const gl::FramebufferID): assertion "gl::value::BindFramebuffer::Get() == getContext().bindFramebuffer.getCurrentValue()" failed'
05-05 01:02:10.861: I/DEBUG(203):     r0 00000000  r1 00003900  r2 00000006  r3 00000000
05-05 01:02:10.861: I/DEBUG(203):     r4 f761a114  r5 00000006  r6 0000000b  r7 0000010c
05-05 01:02:10.861: I/DEBUG(203):     r8 12e36ac0  r9 ab096538  sl 12e36ac0  fp 00000000
05-05 01:02:10.861: I/DEBUG(203):     ip 00003900  sp ffeae208  lr f75b66e9  pc f75dbac4  cpsr 600f0010
05-05 01:02:10.862: I/DEBUG(203): backtrace:
05-05 01:02:10.863: I/DEBUG(203):     #00 pc 0003bac4  /system/lib/libc.so (tgkill+12)
05-05 01:02:10.863: I/DEBUG(203):     #01 pc 000166e5  /system/lib/libc.so (pthread_kill+52)
05-05 01:02:10.864: I/DEBUG(203):     #02 pc 000172f7  /system/lib/libc.so (raise+10)
05-05 01:02:10.864: I/DEBUG(203):     #03 pc 00013b49  /system/lib/libc.so (__libc_android_abort+36)
05-05 01:02:10.864: I/DEBUG(203):     #04 pc 00011fec  /system/lib/libc.so (abort+4)
05-05 01:02:10.865: I/DEBUG(203):     #05 pc 00014e13  /system/lib/libc.so (__libc_fatal+16)
05-05 01:02:10.865: I/DEBUG(203):     #06 pc 00013bcd  /system/lib/libc.so (__assert2+20)
05-05 01:02:10.866: I/DEBUG(203):     #07 pc 0019a3db  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
05-05 01:02:10.867: I/DEBUG(203):     #08 pc 000ac583  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
05-05 01:02:10.868: I/DEBUG(203):     #09 pc 0019c6f3  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
05-05 01:02:10.869: I/DEBUG(203):     #10 pc 0019cae3  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
05-05 01:02:10.869: I/DEBUG(203):     #11 pc 000a36cf  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
05-05 01:02:10.869: I/DEBUG(203):     #12 pc 000b7b95  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
05-05 01:02:10.870: I/DEBUG(203):     #13 pc 000b7b2d  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
05-05 01:02:10.870: I/DEBUG(203):     #14 pc 000b7aef  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
05-05 01:02:10.870: I/DEBUG(203):     #15 pc 000b7c27  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
05-05 01:02:10.870: I/DEBUG(203):     #16 pc 000b7be7  /data/app/com.mapbox.mapboxsdk.testapp-1/lib/arm/libmapbox-gl.so
05-05 01:02:10.870: I/DEBUG(203):     #17 pc 00173a7b  /data/dalvik-cache/arm/data@app@com.mapbox.mapboxsdk.testapp-1@base.apk@classes.dex

@tobrun tobrun reopened this May 5, 2017
@tobrun
Copy link
Member Author

tobrun commented May 5, 2017

When I disable the assertion, I'm hitting the following assertion of the viewport size, which is executed below the frame buffer one:

        void NativeMapView::updateAssumedState() {
            assumeFramebufferBinding(0);
            assumeViewportSize(getFramebufferSize());
        }

My hunch indicates me the MapView is already been destroyed when these assertions are being executed. I'm going to see if I can avoid such a thing from occurring. atm the issue is reproducible on Firebase with every run.

@tobrun
Copy link
Member Author

tobrun commented May 5, 2017

Hunch was incorrect, not related to destroying the surface but related to adding a Layer. Removing all the assertions shows the following eglSwapBuffers failed:

java.lang.Error: eglSwapBuffers() failed
	at com.mapbox.mapboxsdk.maps.NativeMapView.nativeRender(Native Method)
	at com.mapbox.mapboxsdk.maps.NativeMapView.render(NativeMapView.java:178)
	at com.mapbox.mapboxsdk.maps.MapView.onDraw(MapView.java:420)
	at android.view.View.draw(View.java:15114)
	at android.widget.FrameLayout.draw(FrameLayout.java:592)
	at android.view.View.updateDisplayListIfDirty(View.java:14048)
	at android.view.View.getDisplayList(View.java:14071)
	at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3388)
	at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3367)
	at android.view.View.updateDisplayListIfDirty(View.java:14008)
	at android.view.View.getDisplayList(View.java:14071)
	at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3388)
	at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3367)
	at android.view.View.updateDisplayListIfDirty(View.java:14008)
	at android.view.View.getDisplayList(View.java:14071)
	at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3388)
	at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3367)
	at android.view.View.updateDisplayListIfDirty(View.java:14008)
	at android.view.View.getDisplayList(View.java:14071)
	at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3388)
	at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3367)

A coupe of lines before, I'm seeing:

05-05 02:01:39.544: I/Adreno(13620): EGLSurface 0x91f26a00 is not current
05-05 02:01:39.544: E/mbgl(13620): {pboxsdk.testapp}[OpenGL]: eglSwapBuffers() returned error 12301

@tobrun
Copy link
Member Author

tobrun commented Jun 6, 2017

plausible fix for this in #9198, the issue was that we were calling into MapboxMap from the instrumentation thread instead of the application ui thread.

@tobrun tobrun closed this as completed Jun 13, 2017
@lilykaiser lilykaiser removed this from the android-future milestone Sep 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android crash
Projects
None yet
Development

No branches or pull requests

5 participants