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.

Crash at mbgl::gl::Program<mbgl::FillPatternProgram>::draw #14518

Closed

Description

@friedbunny

Steps to reproduce

  1. Load a specific private style, linked to in https://github.com/mapbox/studio-preview-ios/issues/359#issuecomment-486849890.
  2. Set initial coordinates to (37.747899, -119.587126) and zoom level to z15.
  3. Zoom out until it crashes (~z5-6).

Unfortunately, I haven’t been able to reproduce this with iosapp — only Studio Preview (1.3.31 and 1.3.32) and ios-sdk-examples.

Crash trace

When attached to the debugger:

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x28)
    frame #0: 0x00000001cc23e510 GLEngine`gleRunVertexSubmitARM + 2772
    frame #1: 0x00000001cc23b914 GLEngine`gleSetVertexArrayFunc + 144
    frame #2: 0x00000001cc1e2884 GLEngine`glDrawElements_ACC_ES2Exec + 608
  * frame #3: 0x0000000102a311e4 Mapbox`mbgl::gl::Program<mbgl::FillPatternProgram>::draw(this=0x0000000105631bb0, genericContext=0x000000010502d3d0, drawMode=0x000000016db14708, depthMode=<unavailable>, stencilMode=<unavailable>, colorMode=<unavailable>, cullFaceMode=<unavailable>, uniformValues=0x000000016db148d0, drawScope=0x0000000282a18cb8, attributeBindings=0x000000016db14a88, textureBindings=0x000000016db146e8, indexBuffer=0x0000000280c74dd8, indexOffset=0, indexLength=78) at program.hpp:153:17 [opt]
    frame #4: 0x0000000102a6d7bc Mapbox`mbgl::RenderFillLayer::render(mbgl::PaintParameters&, mbgl::RenderSource*) at program.hpp:94:22 [opt]
    frame #5: 0x0000000102a6d6cc Mapbox`mbgl::RenderFillLayer::render(mbgl::PaintParameters&, mbgl::RenderSource*) [inlined] auto mbgl::RenderFillLayer::render(program=<unavailable>, indexBuffer=0x0000000280c74dd8, segments=size=0)::$_1::operator()<mbgl::ProgramMap<mbgl::FillPatternProgram>, mbgl::gfx::Triangles, mbgl::gfx::DepthMode, mbgl::gfx::IndexBuffer, std::__1::vector<mbgl::Segment<mbgl::TypeList<mbgl::attributes::a_pos, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::a_opacity>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::a_color>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::a_outline_color>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::a_pattern_to>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::a_pattern_from> > >, std::__1::allocator<mbgl::Segment<mbgl::TypeList<mbgl::attributes::a_pos, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::a_opacity>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::a_color>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::a_outline_color>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::a_pattern_to>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::a_pattern_from> > > > >, mbgl::gfx::TextureBindings<mbgl::TypeList<mbgl::textures::u_image> > >(mbgl::ProgramMap<mbgl::FillPatternProgram>&, mbgl::gfx::Triangles const&, mbgl::gfx::DepthMode const&, mbgl::gfx::IndexBuffer const&, std::__1::vector<mbgl::Segment<mbgl::TypeList<mbgl::attributes::a_pos, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::a_opacity>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::a_color>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::a_outline_color>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::a_pattern_to>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::a_pattern_from> > >, std::__1::allocator<mbgl::Segment<mbgl::TypeList<mbgl::attributes::a_pos, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::a_opacity>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::a_color>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::a_outline_color>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::a_pattern_to>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::a_pattern_from> > > > > const&, mbgl::gfx::TextureBindings<mbgl::TypeList<mbgl::textures::u_image> >&&) const at render_fill_layer.cpp:197 [opt]
    frame #6: 0x0000000102a6d4a4 Mapbox`mbgl::RenderFillLayer::render(this=<unavailable>, parameters=<unavailable>, (null)=<unavailable>) at render_fill_layer.cpp:213 [opt]
    frame #7: 0x0000000102aa0cb0 Mapbox`mbgl::Renderer::Impl::render(this=<unavailable>, updateParameters=<unavailable>) at renderer_impl.cpp:547:27 [opt]
    frame #8: 0x000000010294ba54 Mapbox`::-[MGLMapView glkView:drawInRect:](GLKView *, CGRect) [inlined] mbgl::Renderer::render(this=<unavailable>, updateParameters=<unavailable>) at renderer.cpp:34:11 [opt]
    frame #9: 0x000000010294ba4c Mapbox`::-[MGLMapView glkView:drawInRect:](GLKView *, CGRect) [inlined] MGLRenderFrontend::render(this=0x0000000282b711c0) at MGLRendererFrontend.h:57 [opt]
    frame #10: 0x000000010294ba0c Mapbox`::-[MGLMapView glkView:drawInRect:](self=<unavailable>, _cmd=<unavailable>, view=<unavailable>, rect=<unavailable>) at MGLMapView.mm:993 [opt]
    frame #11: 0x00000001b7f5a8f4 GLKit`-[GLKView _display:] + 216
    frame #12: 0x000000010294c378 Mapbox`::-[MGLMapView updateFromDisplayLink:](self=0x000000010a800800, _cmd=<unavailable>, displayLink=<unavailable>) at MGLMapView.mm:1168:13 [opt]
    frame #13: 0x00000001af39e194 QuartzCore`CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 636
    frame #14: 0x00000001af46748c QuartzCore`display_timer_callback(__CFMachPort*, void*, long, void*) + 272
    frame #15: 0x00000001aafa7d30 CoreFoundation`__CFMachPortPerform + 188
    frame #16: 0x00000001aafce934 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
    frame #17: 0x00000001aafce080 CoreFoundation`__CFRunLoopDoSource1 + 440
    frame #18: 0x00000001aafc8ea4 CoreFoundation`__CFRunLoopRun + 2096
    frame #19: 0x00000001aafc8354 CoreFoundation`CFRunLoopRunSpecific + 436
    frame #20: 0x00000001ad1c879c GraphicsServices`GSEventRunModal + 104
    frame #21: 0x00000001d7471b68 UIKitCore`UIApplicationMain + 212
    frame #22: 0x0000000102312378 StudioPreview`main at AppDelegate.swift:13:7
    frame #23: 0x00000001aaa8e8e0 libdyld.dylib`start + 4

Reported by Crashlytics:

#0. Crashed: com.apple.main-thread
0  GLEngine                       0x1e531e510 gleRunVertexSubmitARM
1  GLEngine                       0x1e531b914 gleSetVertexArrayFunc
2  GLEngine                       0x1e52c2884 glDrawElements_ACC_ES2Exec
3  Mapbox                         0x100ebe4d4 MGLTimeIntervalFromDuration(std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> >) + 531420
4  Mapbox                         0x100ef87b0 MGLTimeIntervalFromDuration(std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> >) + 769720
5  Mapbox                         0x100f2abe0 MGLTimeIntervalFromDuration(std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> >) + 975592
6  Mapbox                         0x100de6b5c MGLStringFromMetricType + 28492
7  GLKit                          0x1d103a8f4 -[GLKView _display:] + 216
8  Mapbox                         0x100de7480 MGLStringFromMetricType + 30832
9  QuartzCore                     0x1c847e194 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 636
10 QuartzCore                     0x1c854748c display_timer_callback(__CFMachPort*, void*, long, void*) + 272
11 CoreFoundation                 0x1c4087d30 __CFMachPortPerform + 188
12 CoreFoundation                 0x1c40ae934 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
13 CoreFoundation                 0x1c40ae080 __CFRunLoopDoSource1 + 440
14 CoreFoundation                 0x1c40a8ea4 __CFRunLoopRun + 2096
15 CoreFoundation                 0x1c40a8354 CFRunLoopRunSpecific + 436
16 GraphicsServices               0x1c62a879c GSEventRunModal + 104
17 UIKitCore                      0x1f0551b68 UIApplicationMain + 212
18 StudioPreview                  0x100959208 main (OfflineStorage.swift:13)
19 libdyld.dylib                  0x1c3b6e8e0 start + 4

Configuration

Mapbox SDK versions: exists at least from ios-v4.8.0 through ios-v4.11.0-beta.1
iOS/macOS versions: tested on iOS 12.1.4, 12.2
Device/simulator models: iPhone X, iPhone SE, iPad Pro 10.5
Xcode version: 10.2

/cc @julianrex @pozdnyakov

Activity

  1. added
    iOS
    Core
    on Apr 25, 2019
  2. friedbunny commented on Apr 25, 2019

    @friedbunny
    ContributorAuthor

    This reproduces in Studio Preview back to ios-v4.8.0 (which is the earliest I have easy access to).

  3. julianrex commented on Apr 26, 2019

    @julianrex
    Contributor

    Looks like we're missing symbols here?

  4. friedbunny commented on Apr 29, 2019

    @friedbunny
    ContributorAuthor

    Looks like we're missing symbols here?

    The Crashlytics traces for this (easily reproducible) crash sometimes do show the wrong symbols, but local crashes consistently point to mbgl::gl::Program<mbgl::FillPatternProgram>::draw.

    I fiddled with this a bit today but I’m still not able to isolate why this happens so easily in Studio Preview but not iosapp.

  5. friedbunny commented on May 1, 2019

    @friedbunny
    ContributorAuthor

    Still can’t reproduce in iosapp, but it does reproduce in ios-sdk-examples. Debug build at d5822ab (~ios-v4.12.0-alpha.1):

    * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x28)
        frame #0: 0x000000012ac94d60
        frame #1: 0x000000012242afb5 GLEngine`glDrawElements_IMM_ES2Exec + 1125
      * frame #2: 0x000000010d0527ba Mapbox`mbgl::gl::Context::draw(this=0x00007ffee6ba8168)::$_50::operator()() const at context.cpp:731:5
        frame #3: 0x000000010d0526f9 Mapbox`mbgl::gl::Context::draw(this=0x00007ff272c0e020, drawMode=0x00007ffee6ba8c98, indexOffset=0, indexLength=78) at context.cpp:731:5
        frame #4: 0x000000010d17056b Mapbox`mbgl::gl::Program<mbgl::FillPatternProgram>::draw(this=0x00006000002a9a20, genericContext=0x00007ff272c0e020, (null)=0x0000618000637200, drawMode=0x00007ffee6ba8c98, depthMode=0x00007ffee6ba8c88, stencilMode=0x00007ffee6ba8770, colorMode=0x00007ffee6ba8750, cullFaceMode=0x00007ffee6ba8740, uniformValues=0x00007ffee6ba8990, drawScope=0x000061000026ceb8, attributeBindings=0x00007ffee6ba8470, textureBindings=0x00007ffee6ba8c68, indexBuffer=0x00006080003e70d8, indexOffset=0, indexLength=78) at program.hpp:203:17
        frame #5: 0x000000010d2d5876 Mapbox`void mbgl::Program<mbgl::FillPatternProgram, (mbgl::gfx::PrimitiveType)2, mbgl::TypeList<mbgl::attributes::pos>, mbgl::TypeList<mbgl::uniforms::matrix, mbgl::uniforms::world, mbgl::uniforms::texsize, mbgl::uniforms::scale, mbgl::uniforms::fade, mbgl::uniforms::pixel_coord_upper, mbgl::uniforms::pixel_coord_lower>, mbgl::TypeList<mbgl::textures::image>, mbgl::style::FillPaintProperties>::draw<mbgl::gfx::Triangles>(this=0x00006000000504e0, context=0x00007ff272c0e020, renderPass=0x0000618000637200, drawMode=0x00007ffee6ba8c98, depthMode=0x00007ffee6ba8c88, stencilMode=0x00007ffee6ba8770, colorMode=0x00007ffee6ba8750, cullFaceMode=0x00007ffee6ba8740, indexBuffer=0x00006080003e70d8, segments=size=1, uniformValues=0x00007ffee6ba8990, allAttributeBindings=0x00007ffee6ba8788, textureBindings=0x00007ffee6ba8c68, layerID="nps-hydro-foreshore rapids area") at program.hpp:99:22
        frame #6: 0x000000010d2c4c29 Mapbox`auto mbgl::RenderFillLayer::render(this=0x00007ffee6ba8ca0, programInstance=0x00006000000504e0, drawMode=0x00007ffee6ba8c98, depthMode=0x00007ffee6ba8c88, indexBuffer=0x00006080003e70d8, segments=size=1, textureBindings=0x00007ffee6ba8c68)::$_1::operator()<mbgl::FillPatternProgram, mbgl::gfx::Triangles, mbgl::gfx::DepthMode, mbgl::gfx::IndexBuffer, std::__1::vector<mbgl::Segment<mbgl::TypeList<mbgl::attributes::pos, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::opacity>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::color>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::outline_color>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::pattern_to>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::pattern_from> > >, std::__1::allocator<mbgl::Segment<mbgl::TypeList<mbgl::attributes::pos, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::opacity>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::color>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::outline_color>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::pattern_to>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::pattern_from> > > > >, mbgl::gfx::TextureBindings<mbgl::TypeList<mbgl::textures::image> > >(mbgl::FillPatternProgram&, mbgl::gfx::Triangles const&, mbgl::gfx::DepthMode const&, mbgl::gfx::IndexBuffer const&, std::__1::vector<mbgl::Segment<mbgl::TypeList<mbgl::attributes::pos, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::opacity>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::color>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::outline_color>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::pattern_to>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::pattern_from> > >, std::__1::allocator<mbgl::Segment<mbgl::TypeList<mbgl::attributes::pos, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::opacity>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::color>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::outline_color>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::pattern_to>, mbgl::ZoomInterpolatedAttribute<mbgl::attributes::pattern_from> > > > > const&, mbgl::gfx::TextureBindings<mbgl::TypeList<mbgl::textures::image> >&&) const at render_fill_layer.cpp:211:33
        frame #7: 0x000000010d2c3b60 Mapbox`mbgl::RenderFillLayer::render(this=0x00007ff272c212b0, parameters=0x00007ffee6ba9788, (null)=0x00007ff272b3ead0) at render_fill_layer.cpp:228:13
        frame #8: 0x000000010d386929 Mapbox`mbgl::Renderer::Impl::render(this=0x00007ff272c33570, updateParameters=0x00007ff272d327d8) at renderer_impl.cpp:459:29
        frame #9: 0x000000010d37e045 Mapbox`mbgl::Renderer::render(this=0x000060000001b030, updateParameters=0x00007ff272d327d8) at renderer.cpp:36:11
        frame #10: 0x000000010ce43914 Mapbox`MGLRenderFrontend::render(this=0x000060000006ed40) at MGLRendererFrontend.h:57:19
        frame #11: 0x000000010ce43821 Mapbox`::-[MGLMapView glkView:drawInRect:](self=0x00007ff275000000, _cmd="glkView:drawInRect:", view=0x00007ff26a522370, rect=(origin = (x = 0, y = 0), size = (width = 320, height = 568))) at MGLMapView.mm:994:28
        frame #12: 0x0000000111df6004 GLKit`-[GLKView _display:] + 310
        frame #13: 0x000000010ce45a4f Mapbox`::-[MGLMapView updateFromDisplayLink:](self=0x00007ff275000000, _cmd="updateFromDisplayLink:", displayLink=0x000060000001e400) at MGLMapView.mm:1171:13
        frame #14: 0x000000010a941767 QuartzCore`CA::Display::DisplayLinkItem::dispatch(unsigned long long) + 51
        frame #15: 0x000000010a94162d QuartzCore`CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 439
        frame #16: 0x0000000109d47b61 CoreFoundation`__CFMachPortPerform + 161
        frame #17: 0x0000000109d47aa9 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
        frame #18: 0x0000000109d47a21 CoreFoundation`__CFRunLoopDoSource1 + 465
        frame #19: 0x0000000109d3fba0 CoreFoundation`__CFRunLoopRun + 2352
        frame #20: 0x0000000109d3f016 CoreFoundation`CFRunLoopRunSpecific + 406
        frame #21: 0x0000000113b87a24 GraphicsServices`GSEventRunModal + 62
        frame #22: 0x000000010abc0134 UIKit`UIApplicationMain + 159
        frame #23: 0x00000001090721a0 Examples`main(argc=1, argv=0x00007ffee6bac430) at main.m:14:16
        frame #24: 0x0000000112b1765d libdyld.dylib`start + 1
    

    Screen Shot 2019-05-01 at 4 09 35 PM

    MBGL_CHECK_ERROR(glDrawElements(
    Enum<gfx::DrawModeType>::to(drawMode.type),
    static_cast<GLsizei>(indexLength),
    GL_UNSIGNED_SHORT,
    reinterpret_cast<GLvoid*>(sizeof(uint16_t) * indexOffset)));

    ... I have no idea if this is useful, but that’s where the debugger stops.

  6. self-assigned this
    on May 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

CorecrashiOS

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions