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

Crash on launch after updating to ios-v3.4.0-beta.2 from ios-v3.4.0-beta.1 #6883

Closed
JesseCrocker opened this issue Nov 2, 2016 · 21 comments
Closed
Assignees
Labels
crash iOS Mapbox Maps SDK for iOS release blocker Blocks the next final release
Milestone

Comments

@JesseCrocker
Copy link
Contributor

Platform:
iOS Simulator
Mapbox SDK version:
ios-v3.4.0-beta.2, installed with podspec https://raw.githubusercontent.com/mapbox/mapbox-gl-native/ios-v3.4.0-beta.2/platform/ios/Mapbox-iOS-SDK-symbols.podspec

Steps to trigger behavior

App was working properly on ios-v3.4.0-beta.1, after updating to os-v3.4.0-beta.2 it crashes on launch. The stack trace led me to believe it was related to showing user location, but disabling showing user location did not fix it.

Console output

2016-11-02 13:57:31.198 GaiaGPS[44461:4344987] Failed to bind EAGLDrawable: <CAEAGLLayer: 0x608000229380> to GL_RENDERBUFFER 1
2016-11-02 13:57:31.198 GaiaGPS[44461:4344987] Failed to make complete framebuffer object 8cd6
2016-11-02 13:57:31.221 GaiaGPS[44461:4344987] Failed to bind EAGLDrawable: <CAEAGLLayer: 0x608000229380> to GL_RENDERBUFFER 1
2016-11-02 13:57:31.221 GaiaGPS[44461:4344987] Failed to make complete framebuffer object 8cd6
objc[44461]: EXCEPTIONS: terminating
objc[44461]: EXCEPTIONS: searching through frame [ip=0x115938466 sp=0x7fff52e85e00] for exception 0x608000111f38
objc[44461]: EXCEPTIONS: skipping catch(?)
objc[44461]: EXCEPTIONS: unwinding through frame [ip=0x115938466 sp=0x7fff52e85e00] for exception 0x608000111f38
objc[44461]: EXCEPTIONS: handling exception 0x608000111f38 at 0x115938485
libc++abi.dylib: terminating with uncaught exception of type mbgl::gl::Error: glBindTexture(GL_TEXTURE_2D, value): Error GL_INVALID_ENUM at /Users/boundsj/mapbox-gl-native/src/mbgl/gl/value.cpp:284

Disassembly

Mapbox`::-[MGLMapView glkView:drawInRect:](GLKView *, CGRect):
    0x110ebc42f <+0>:  pushq  %rbp
    0x110ebc430 <+1>:  movq   %rsp, %rbp
    0x110ebc433 <+4>:  pushq  %r14
    0x110ebc435 <+6>:  pushq  %rbx
    0x110ebc436 <+7>:  movq   %rdi, %rbx
    0x110ebc439 <+10>: movq   0x6c0cc0(%rip), %rsi      ; "isDormant"
    0x110ebc440 <+17>: callq  *0x6a17d2(%rip)           ; (void *)0x000000011594eac0: objc_msgSend
    0x110ebc446 <+23>: testb  %al, %al
    0x110ebc448 <+25>: jne    0x110ebc47e               ; <+79> at MGLMapView.mm:885
    0x110ebc44a <+27>: movq   0x6c2a2f(%rip), %r14      ; MGLMapView._mbglView
    0x110ebc451 <+34>: movq   (%rbx,%r14), %rdi
    0x110ebc455 <+38>: callq  0x110ed938c               ; MBGLView::updateViewBinding at MGLMapView.mm:5040
    0x110ebc45a <+43>: movq   0x6c29ff(%rip), %rax      ; MGLMapView._mbglMap
    0x110ebc461 <+50>: movq   (%rbx,%rax), %rdi
    0x110ebc465 <+54>: movq   (%rbx,%r14), %rsi
    0x110ebc469 <+58>: callq  0x1110f5a40               ; mbgl::Map::render(mbgl::View&)
    0x110ebc46e <+63>: movq   0x6c0c93(%rip), %rsi      ; "updateUserLocationAnnotationView"
    0x110ebc475 <+70>: movq   %rbx, %rdi
    0x110ebc478 <+73>: callq  *0x6a179a(%rip)           ; (void *)0x000000011594eac0: objc_msgSend
    0x110ebc47e <+79>: popq   %rbx
    0x110ebc47f <+80>: popq   %r14
    0x110ebc481 <+82>: popq   %rbp
    0x110ebc482 <+83>: retq   

Stack Trace

#0	0x00000001162faf06 in __pthread_kill ()
#1	0x000000011632f4ec in pthread_kill ()
#2	0x0000000116077fd7 in abort ()
#3	0x0000000115e4295a in abort_message ()
#4	0x0000000115e67ce7 in default_terminate_handler() ()
#5	0x00000001159384b4 in _objc_terminate() ()
#6	0x0000000115e64e69 in std::__terminate(void (*)()) ()
#7	0x0000000115e64ee3 in std::terminate() ()
#8	0x0000000110ed938b in __clang_call_terminate ()
#9	0x00000001110a073c in mbgl::gl::value::BindTexture::Set(unsigned int const&)::$_47::operator()() const::__MBGL_C_E::~__MBGL_C_E() ()
#10	0x00000001110a06f5 in mbgl::gl::value::BindTexture::Set(unsigned int const&)::$_47::operator()() const::__MBGL_C_E::~__MBGL_C_E() ()
#11	0x000000011109f169 in mbgl::gl::value::BindTexture::Set(unsigned int const&)::$_47::operator()() const ()
#12	0x000000011109f130 in mbgl::gl::value::BindTexture::Set(unsigned int const&) ()
#13	0x000000011116d0a2 in mbgl::gl::State<mbgl::gl::value::BindTexture>::operator=(unsigned int const&) ()
#14	0x000000011113c52d in mbgl::FrameHistory::bind(mbgl::gl::Context&, unsigned int) ()
#15	0x000000011113c236 in mbgl::FrameHistory::upload(mbgl::gl::Context&, unsigned int) ()
#16	0x000000011114ac63 in mbgl::Painter::render(mbgl::style::Style const&, mbgl::FrameData const&, mbgl::View&, mbgl::SpriteAtlas&) ()
#17	0x00000001110f64a8 in mbgl::Map::Impl::render(mbgl::View&) ()
#18	0x00000001110f5c0c in mbgl::Map::render(mbgl::View&) ()
#19	0x0000000110ebc46e in ::-[MGLMapView glkView:drawInRect:](GLKView *, CGRect) at /Users/boundsj/mapbox-gl-native/platform/ios/src/MGLMapView.mm:881
#20	0x000000011f98d148 in -[GLKView _display:] ()
#21	0x0000000110ebcde2 in ::-[MGLMapView updateFromDisplayLink]() at /Users/boundsj/mapbox-gl-native/platform/ios/src/MGLMapView.mm:1009
#22	0x0000000112457c35 in CA::Display::DisplayLinkItem::dispatch(unsigned long long) ()
#23	0x0000000112457af5 in CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) ()
#24	0x000000010f066964 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ ()
#25	0x000000010f0665f3 in __CFRunLoopDoTimer ()
#26	0x000000010f06617a in __CFRunLoopDoTimers ()
#27	0x000000010f05df01 in __CFRunLoopRun ()
#28	0x000000010f05d494 in CFRunLoopRunSpecific ()
#29	0x00000001177fda6f in GSEventRunModal ()
#30	0x00000001128a6964 in UIApplicationMain ()
#31	0x000000010cee7c0c in main at /Users/jesse/projects/Gaia-GPS-iPhone-mapbox/Classes/main.m:24
#32	0x0000000115fcf68d in start ()
#33	0x0000000115fcf68d in start ()

@jfirebaugh
Copy link
Contributor

This looks like a recurrence of #1550.

I'm confused why the GL error checking is in this build though. @boundsj, the podspec should be a release build right? We don't check OpenGL errors in release builds, and ios-v3.4.0-beta.2 does not include a commit like 3e6d067 (right?)

@JesseCrocker JesseCrocker changed the title Crash on launch after updating to ios-v3.4.0-beta.1 from ios-v3.4.0-beta.2 Crash on launch after updating to ios-v3.4.0-beta.2 from ios-v3.4.0-beta.1 Nov 2, 2016
@boundsj boundsj added iOS Mapbox Maps SDK for iOS build and removed build labels Nov 2, 2016
@boundsj boundsj added this to the ios-v3.4.0 milestone Nov 2, 2016
@boundsj boundsj self-assigned this Nov 2, 2016
@boundsj
Copy link
Contributor

boundsj commented Nov 2, 2016

@jfirebaugh

ios-v3.4.0-beta.2 does not include a commit like 3e6d067 (right?)

That is correct.

the podspec should be a release build right?

That is correct.

@JesseCrocker

I just pointed a demo project I have at beta.2 with pod 'Mapbox-iOS-SDK', :podspec => 'https://raw.githubusercontent.com/mapbox/mapbox-gl-native/ios-v3.4.0-beta.2/platform/ios/Mapbox-iOS-SDK-symbols.podspec and everything looks fine. Does the crash happen for you consistently? Does reverting to beta.1 stop the crash?

@JesseCrocker
Copy link
Contributor Author

@boundsj Yes, crash happens every time, and reverting back to beta.1 fixes it.

@boundsj
Copy link
Contributor

boundsj commented Nov 2, 2016

@jfirebaugh here is the diff between beta.1 and beta.2. There were a few core changes like #3563 and #6773 in this version.

@JesseCrocker would it be possible to share a sample project that reproduces the crash? I'm not seeing this on a few different apps that I'm now using beta 2 in.

@JesseCrocker
Copy link
Contributor Author

@boundsj I'm seeing the crash on a closed-source project, but i'll try and come up with a test case to send over tomorrow morning.

@boundsj
Copy link
Contributor

boundsj commented Nov 2, 2016

Thanks @JesseCrocker! Even if it is just a list of what you are doing (Mapbox iOS SDK related) when the app starts and details about your environment (i.e. Xcode version, Swift or Objective-C) that would be helpful. And, if you can manage, an Xcode project that reproduces the issue would help the most.

@naluhh
Copy link

naluhh commented Nov 3, 2016

From what I've seen, Initing with no frame cause MapBox to crash.
MGLMapView() -> Crash
MGLMapView(frame:frame) works

@JesseCrocker
Copy link
Contributor Author

I can confirm what @naluhh said, it's related to the frame.

I was calling [[MGLMapView alloc] initWithFrame:CGRectZero]; then let constraints set the proper size, if i change that to [[MGLMapView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; it no longer crashes.

@boundsj boundsj added the release blocker Blocks the next final release label Nov 3, 2016
@boundsj
Copy link
Contributor

boundsj commented Nov 3, 2016

Thanks for narrowing this down @naluhh and @JesseCrocker.

Here is the repro case then:

// Don't use a frame
mapView = MGLMapView()
mapView.translatesAutoresizingMaskIntoConstraints = false
mapContainerView.addSubview(mapView)

mapView.topAnchor.constraint(equalTo: mapContainerView.topAnchor).isActive = true
mapView.leftAnchor.constraint(equalTo: mapContainerView.leftAnchor).isActive = true
mapView.bottomAnchor.constraint(equalTo: mapContainerView.bottomAnchor).isActive = true
mapView.rightAnchor.constraint(equalTo: mapContainerView.rightAnchor).isActive = true

This problem is not entirely new, it seems.

In beta.1 if the lines that add the constraints are commented out, the following endless log spew occurs:

2016-11-03 09:09:46.364 TestConstraintIssue[7438:13468203] Failed to bind EAGLDrawable: <CAEAGLLayer: 0x600000032f60> to GL_RENDERBUFFER 1
2016-11-03 09:09:46.365 TestConstraintIssue[7438:13468203] Failed to make complete framebuffer object 8cd6
2016-11-03 09:09:46.383 TestConstraintIssue[7438:13468203] Failed to bind EAGLDrawable: <CAEAGLLayer: 0x600000032f60> to GL_RENDERBUFFER 1
2016-11-03 09:09:46.384 TestConstraintIssue[7438:13468203] Failed to make complete framebuffer object 8cd6
2016-11-03 09:09:46.402 TestConstraintIssue[7438:13468203] Failed to bind EAGLDrawable: <CAEAGLLayer: 0x600000032f60> to GL_RENDERBUFFER 1
2016-11-03 09:09:46.405 TestConstraintIssue[7438:13468203] Failed to make complete framebuffer object 8cd6

In beta.2 the crash noted above occurs no matter if the constraints are added or not.

cc @incanus @1ec5

@incanus incanus assigned incanus and unassigned boundsj Nov 3, 2016
@incanus
Copy link
Contributor

incanus commented Nov 3, 2016

I do see this crash with the repro mentioned above, and a CGRectZero frame triggers it. But interestingly, in the GL project proper, the occurs when no contextual info in the -glkView:drawInRect: has a zero frame—not view.frame, rect, or the parent MGLMapView's frame. Still digging.

@incanus
Copy link
Contributor

incanus commented Nov 3, 2016

Weirdly, in manually disabling GL error checking for a local dev copy, both setting an initial CGRectZero as well as subsequently changing the size via the constraints activation above log some CAEAGLLayer warnings, but nothing is fatal and no crashes happen. The crash is only in the active MBGL_CHECK_ERROR.

@incanus
Copy link
Contributor

incanus commented Nov 4, 2016

Similarly, adding -DNDEBUG to the Debug configuration also does not disable GL error checking. Related: #6887 (comment)

@incanus
Copy link
Contributor

incanus commented Nov 4, 2016

Current status on debugging this is something outside of MGLMapView.mm is binding the GL context, I think. Because it's not a routine like [_glView bindDrawable] or getContext().bindFramebuffer.setCurrentValue(0) that is triggering these log lines around bind problems. It could be some sort of implicit bind that's triggered in GLKView internals. If I can find out where, I can add a check for proper state before proceeding.

@kkaefer
Copy link
Contributor

kkaefer commented Nov 4, 2016

@incanus The worrying part here is that the stack trace contains __MBGL_C_E, which is only present when compiled in Debug mode.

@incanus
Copy link
Contributor

incanus commented Nov 4, 2016

Yeah, I am seeing that as a separate issue though—that we possibly rolled a build wrong. If I disable GL error checking, things don't crash, but we still get GL framebuffer bind warnings, which I want to get rid of. That's basically the core issue here now, though it should not technically be a crash.

@1ec5
Copy link
Contributor

1ec5 commented Nov 4, 2016

#1572 tracks the GL framebuffer bind warnings specifically. (That ticket notes that some users have experienced crashes due to that issue, but the crash is unreproducible.)

@incanus
Copy link
Contributor

incanus commented Nov 4, 2016

#1572 tracks the GL framebuffer bind warnings specifically

In that case, I think we can close here in favor of #1572 and #6887. I will move #1572 to the milestone.

@1ec5
Copy link
Contributor

1ec5 commented Nov 4, 2016

We should still get to the bottom of why @JesseCrocker was seeing this crash only on v3.4.0-beta.2 but not v3.4.0-beta.1 with the same CGRectZero. Does #6883 (comment) prove that we inadvertently built beta 2 as a Debug build? We did make changes to the SDK build script between the last alpha and beta 1 (like #6581), but I’m unaware of any changes to the deployment script after beta 1.

@nitrag
Copy link
Contributor

nitrag commented Nov 7, 2016

I have this issue about 1 of 5 launches, when it happens I rebuild and it works.

Mapbox`::-[MGLMapView glkView:drawInRect:](GLKView *, CGRect):
    0x10e43742f <+0>:  pushq  %rbp
    0x10e437430 <+1>:  movq   %rsp, %rbp
    0x10e437433 <+4>:  pushq  %r14
    0x10e437435 <+6>:  pushq  %rbx
    0x10e437436 <+7>:  movq   %rdi, %rbx
    0x10e437439 <+10>: movq   0x6c0cc0(%rip), %rsi      ; "isDormant"
    0x10e437440 <+17>: callq  *0x6a17d2(%rip)           ; (void *)0x0000000110f29ac0: objc_msgSend
    0x10e437446 <+23>: testb  %al, %al
    0x10e437448 <+25>: jne    0x10e43747e               ; <+79> at MGLMapView.mm:885
    0x10e43744a <+27>: movq   0x6c2a2f(%rip), %r14
    0x10e437451 <+34>: movq   (%rbx,%r14), %rdi
    0x10e437455 <+38>: callq  0x10e45438c               ; MBGLView::updateViewBinding at MGLMapView.mm:5040
    0x10e43745a <+43>: movq   0x6c29ff(%rip), %rax
    0x10e437461 <+50>: movq   (%rbx,%rax), %rdi
    0x10e437465 <+54>: movq   (%rbx,%r14), %rsi
    0x10e437469 <+58>: callq  0x10e670a40               ; mbgl::Map::render(mbgl::View&)
->  0x10e43746e <+63>: movq   0x6c0c93(%rip), %rsi      ; "updateUserLocationAnnotationView"
    0x10e437475 <+70>: movq   %rbx, %rdi
    0x10e437478 <+73>: callq  *0x6a179a(%rip)           ; (void *)0x0000000110f29ac0: objc_msgSend
    0x10e43747e <+79>: popq   %rbx
    0x10e43747f <+80>: popq   %r14
    0x10e437481 <+82>: popq   %rbp
    0x10e437482 <+83>: retq   

Let me know what to provide to help your finding the bug.

@boundsj
Copy link
Contributor

boundsj commented Nov 7, 2016

@nitrag this appears to be a different issues related to the user annotation view and not GL error checking + IB constraints. Can you please open a new ticket with the stack trace you posted above?

@boundsj
Copy link
Contributor

boundsj commented Nov 8, 2016

We should still get to the bottom of why @JesseCrocker was seeing this crash only on v3.4.0-beta.2 but not v3.4.0-beta.1

#6887 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
crash iOS Mapbox Maps SDK for iOS release blocker Blocks the next final release
Projects
None yet
Development

No branches or pull requests

8 participants