Skip to content

glTexImage2d crashes in libGLESv2_mtk.so. #103498

Closed

Description

@zanderso

In b/217143672 and it's duplicates, we are still seeing crashes in /vendor/lib/egl/libGLESv2_mtk.so (glTexImage2D+156) even after flutter-team-archive/engine#32106.

I don't think this will be actionable without a local repro to work from, but do we have any MediaTek devices in the device library to run the customer: money app on? @dnfield @jason-simmons.

Activity

  1. dnfield commented on May 11, 2022

    @dnfield
    Contributor

    Are you sure you linked the right engine PR? The stack trace in the internal bug doesn't look obviously related to it.

    Here are some slightly sanitized traces:

    *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    Build fingerprint: 'Redmi/cattail/cattail:10/QP1A.190711.020/V12.0.16.0.QCTINXM:user/release-keys'
    ABI: 'arm'
    Revision: '0'
    Timestamp: 2022-05-11 13:48:50+0530
    pid: 21089, tid: 21117, name: 1.io  >>> com.redacted.app <<<
    uid: 10191
    signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x766c65e0
    backtrace:
        #00  pc 0002bfcc  /vendor/lib/egl/libGLESv2_mtk.so (BuildId: 34ed5df2075eeb41cbc04b3113ec2bda)
        #01  pc 00041ddd  /vendor/lib/egl/libGLESv2_mtk.so (BuildId: 34ed5df2075eeb41cbc04b3113ec2bda)
        #02  pc 0002bf71  /vendor/lib/egl/libGLESv2_mtk.so (BuildId: 34ed5df2075eeb41cbc04b3113ec2bda)
        #03  pc 0006c867  /vendor/lib/egl/libGLESv2_mtk.so (BuildId: 34ed5df2075eeb41cbc04b3113ec2bda)
        #04  pc 0006c3bd  /vendor/lib/egl/libGLESv2_mtk.so (glTexImage2D+156) (BuildId: 34ed5df2075eeb41cbc04b3113ec2bda)
        #05  pc 0002ab8f  /vendor/lib/egl/libGLES_meow.so (BuildId: 6d6caf55643460f2db471f5c3405e207)
        #06  pc 0034e225  /data/app/com.redacted.app-7WJs-WdQoixyWOpqxH0f9Q==/base.apk!libflutter.so (offset 0x2668000) (GrGLMakeAssembledGLESInterface(void*, void (*(*)(void*, char const*))()))
        #07  pc 00208cfb  /data/app/com.redacted.app-7WJs-WdQoixyWOpqxH0f9Q==/base.apk!libflutter.so (offset 0x2668000) (apply_kernel_in_y(float*, int, float, float, int, float const*))
        #07  pc 00208cfb  /data/app/com.redacted.app-7WJs-WdQoixyWOpqxH0f9Q==/base.apk!libflutter.so (offset 0x2668000) (create_circle_profile(unsigned char*, float, float, int))
        #07  pc 00208cfb  /data/app/com.redacted.app-7WJs-WdQoixyWOpqxH0f9Q==/base.apk!libflutter.so (offset 0x2668000) (create_profile_effect(GrRecordingContext*, SkRect const&, float, float*, float*))
        #07  pc 00208cfb  /data/app/com.redacted.app-7WJs-WdQoixyWOpqxH0f9Q==/base.apk!libflutter.so (offset 0x2668000) (make_circle_blur(GrRecordingContext*, SkRect const&, float))
        #07  pc 00208cfb  /data/app/com.redacted.app-7WJs-WdQoixyWOpqxH0f9Q==/base.apk!libflutter.so (offset 0x2668000) (SkBlurMaskFilterImpl::directFilterMaskGPU(GrRecordingContext*, skgpu::v1::SurfaceDrawContext*, GrPaint&&, GrClip const*, SkMatrix const&, GrStyledShape const&) const)
        #08  pc 00000100  <unknown>
    

    And

    Stack Trace:
    *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    Build fingerprint: 'OPPO/CPH2185/OP4F2F:10/QP1A.190711.020/1635837988:user/release-keys'
    ABI: 'arm64'
    Revision: '0'
    Timestamp: 2022-01-31 10:14:10+0530
    pid: 27114, tid: 27179, name: 1.io  >>> com.redacted.app <<<
    uid: 10081
    signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x100a7
    backtrace:
        #00  pc 000000000003d01c  /vendor/lib64/egl/libGLESv2_mtk.so (BuildId: f55b631d976bbc513f8214143d01a5b9)
        #01  pc 0000000000057c3c  /vendor/lib64/egl/libGLESv2_mtk.so (BuildId: f55b631d976bbc513f8214143d01a5b9)
        #02  pc 000000000003cea0  /vendor/lib64/egl/libGLESv2_mtk.so (BuildId: f55b631d976bbc513f8214143d01a5b9)
        #03  pc 00000000000904e8  /vendor/lib64/egl/libGLESv2_mtk.so (BuildId: f55b631d976bbc513f8214143d01a5b9)
        #04  pc 000000000008f574  /vendor/lib64/egl/libGLESv2_mtk.so (glTexImage2D+316) (BuildId: f55b631d976bbc513f8214143d01a5b9)
        #05  pc 0000000000082eb4  /vendor/lib64/egl/libGLES_meow.so (BuildId: 56e1d7e99ff3d2f3846472d7c380c1b6)
        #06  pc 000000000050ef9c  /data/app/com.redacted.app-PHLLI2fahqcNZaKZ-vUN0g==/base.apk!libflutter.so (offset 0x2450000) (GrGLGpu::readOrTransferPixelsFrom(GrSurface*, SkIRect, GrColorType, GrColorType, void*, int))
        #07  pc 0000014f00000000  <unknown>
    

    In one case it looks like Skia is trying to run a shader the GPU/driver doesn't like. In the other it looks like Skia is trying to push pixels to the GPU and it's crashing.

  2. zanderso commented on May 11, 2022

    @zanderso
    MemberAuthor

    @dnfield I could have been led astray by the possibly unrelated comment here #91962 (comment), on an issue closed by the linked PR =(

  3. dnfield commented on May 11, 2022

    @dnfield
    Contributor

    FWIW Wembley is a MediaTek device.

  4. dnfield commented on May 11, 2022

    @dnfield
    Contributor

    Why is that first one happening on the IO thread...

  5. johnstiles-google commented on May 11, 2022

    @johnstiles-google
    Contributor

    The first crawl is invalid—it looks like two unrelated crawls mashed together.

    libGLES_meow.so
    GrGLMakeAssembledGLESInterface
    apply_kernel_in_y(float*, int, float, float, int, float const*)
    create_circle_profile(unsigned char*, float, float, int)
    create_profile_effect(GrRecordingContext*, SkRect const&, float, float*, float*) 
    

    apply_kernel_in_y is a leaf function that does math in a loop. It doesn't involve anything GL-related at all.

  6. jason-simmons commented on May 11, 2022

    @jason-simmons
    Contributor

    Is there any way to get more info on the state of the app when these crashes happen? In particular, is the app midway through shutdown?

    In both traces the crash is coming from a call to glTexImage2D on the IO thread.
    (The libflutter.so symbolization in the first stack trace looks inaccurate and was probably done using the wrong binary.)

    There are a lot of potential races involving the ConcurrentTaskRunner, IO thread, and UI thread during image decoding (see #103517).

    But I would expect the IO thread's glTexImage2D call to happen when the decoded image is uploaded to a texture. That should only happen if the IO thread task verifies that the IOManager is still alive. In that case the Skia GrDirectContext and EGL context will still be active and it should be safe to call OpenGL ES APIs.

  7. chinmaygarde commented on May 16, 2022

    @chinmaygarde
    Contributor

    I think we need to get our hands on this device and attempt to reproduce this issue. There isn't enough information here to make progress and we are speculating.

  8. added
    P2Important issues not at the top of the work list
    on May 16, 2022
  9. dchang109 commented on Jul 4, 2022

    @dchang109
  10. dodatw commented on Jul 28, 2022

    @dodatw

    I saw the same crash after upgrade to flutter 3.0.5 on Redmi 9/Android 10

    *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    pid: 0, tid: 0 >>> com.youcam.videoeditor.reface.makeup <<<
    
    backtrace:
      #00  pc 000000000002c044  /vendor/lib/egl/libGLESv2_mtk.so
      #00  pc 0000000000041ddd  /vendor/lib/egl/libGLESv2_mtk.so
      #00  pc 000000000002bf71  /vendor/lib/egl/libGLESv2_mtk.so
      #00  pc 000000000006c867  /vendor/lib/egl/libGLESv2_mtk.so
      #00  pc 000000000006c3bd  /vendor/lib/egl/libGLESv2_mtk.so (glTexImage2D+156)
      #00  pc 000000000002ab8f  /vendor/lib/egl/libGLES_meow.so
      #00  pc 00000000003111fd  /data/app/com.youcam.videoeditor.reface.makeup-lj7FSCD_InzBINIJ2Vw9rg==/lib/arm/libflutter.so
      #00  pc 0000000000000001  <unknown>
    
  11. ndahlquist commented on Oct 18, 2022

    @ndahlquist

    The stacktrace here looks a bit different, so I apologize if it's not the same root cause, but we just had a customer report a crash in glTexImage2D in libGLESv2_mtk:

    Flutter 3.3.4
    Device: Samsung Galaxy A03s TracFone (SM-S134DL)

    OS Version: Android 12 (SP1A.210812.016.S134DLUDU3BVH3)
    Report Version: 104
    
    Exception Type: Unknown (SIGSEGV)
    
    Application Specific Information:
    Segfault
    
    Thread 0 Crashed:
    0   libGLESv2_mtk.so                0x6eef2c8e48        <unknown> + 476459077192
    1   libGLESv2_mtk.so                0x6eef32eba4        <unknown> + 476459494308
    2   libGLESv2_mtk.so                0x6eef32d7a8        glTexImage2D
    3   split_config.arm64_v8a.apk      0x6e7919a0fc        <unknown> + 474478125308
    4   split_config.arm64_v8a.apk      0x6e79194e3c        <unknown> + 474478104124
    5   split_config.arm64_v8a.apk      0x6e79120c9c        <unknown> + 474477628572
    6   split_config.arm64_v8a.apk      0x6e79129444        <unknown> + 474477663300
    7   split_config.arm64_v8a.apk      0x6e79124e68        <unknown> + 474477645416
    8   split_config.arm64_v8a.apk      0x6e7912b808        <unknown> + 474477672456
    9   split_config.arm64_v8a.apk      0x6e79150780        <unknown> + 474477823872
    10  split_config.arm64_v8a.apk      0x6e791508d4        <unknown> + 474477824212
    11  split_config.arm64_v8a.apk      0x6e79152340        <unknown> + 474477830976
    12  split_config.arm64_v8a.apk      0x6e7925bce0        <unknown> + 474478918880
    13  split_config.arm64_v8a.apk      0x6e78f874fc        <unknown> + 474475951356
    14  split_config.arm64_v8a.apk      0x6e7925ba10        <unknown> + 474478918160
    15  split_config.arm64_v8a.apk      0x6e78f860cc        <unknown> + 474475946188
    16  split_config.arm64_v8a.apk      0x6e78f89658        <unknown> + 474475959896
    17  libutils.so                     0x6fa9574bb0        android::Looper::pollInner
    18  libutils.so                     0x6fa95747b8        android::Looper::pollOnce
    19  libandroid.so                   0x6f0f21b284        ALooper_pollOnce
    20  split_config.arm64_v8a.apk      0x6e78f89764        <unknown> + 474475960164
    21  split_config.arm64_v8a.apk      0x6e78f87d8c        <unknown> + 474475953548
    22  libc.so                         0x6fa9912048        <unknown> + 479586230344
    23  libc.so                         0x6fa98b01c0        <unknown> + 479585829312
    
  12. blaugold commented on Dec 10, 2022

    @blaugold
    Contributor

    Here are the symbolicated stack frames within libflutter.so from a crash where glTexImage2D is eventually called:

    0x515a90
    GrGLFunction<void (unsigned int, int, int, int, int, int, unsigned int, unsigned int, void const*)>::operator()(unsigned int, int, int, int, int, int, unsigned int, unsigned int, void const*) const
    GrGLFunctions.h:291
    0x510c94
    GrGLGpu::onCreateTexture(SkISize, GrBackendFormat const&, GrRenderable, int, SkBudgeted, GrProtected, int, unsigned int)
    GrGLGpu.cpp:1389
    0x48f088
    GrGpu::createTextureCommon(SkISize, GrBackendFormat const&, GrTextureType, GrRenderable, int, SkBudgeted, GrProtected, int, unsigned int)
    GrGpu.cpp:129
    0x497f4c
    GrGpu::createTexture(SkISize, GrBackendFormat const&, GrTextureType, GrRenderable, int, SkBudgeted, GrProtected, GrColorType, GrColorType, GrMipLevel const*, int)
    GrGpu.cpp:215
    0x493014
    GrProxyProvider::createMippedProxyFromBitmap(SkBitmap const&, SkBudgeted)::$_1::operator()(GrResourceProvider*, GrSurfaceProxy::LazySurfaceDesc const&) const
    GrProxyProvider.cpp:399
    0x49a568
    std::__1::__function::__value_func<GrSurfaceProxy::LazyCallbackResult (GrResourceProvider*, GrSurfaceProxy::LazySurfaceDesc const&)>::operator()(GrResourceProvider*&&, GrSurfaceProxy::LazySurfaceDesc const&) const
    functional:1860
    0x4c79f4
    GrProxyProvider::createProxyFromBitmap(SkBitmap const&, GrMipmapped, SkBackingFit, SkBudgeted)
    GrProxyProvider.cpp:320
    0x4c7b28
    GrMakeUncachedBitmapProxyView(GrRecordingContext*, SkBitmap const&, GrMipmapped, SkBackingFit, SkBudgeted)
    SkGr.cpp:247
    0x4c9618
    SkImage::MakeCrossContextFromPixmap(GrDirectContext*, SkPixmap const&, bool, bool)
    SkImage_Gpu.cpp:661
    0x5ca2b8
    flutter::UploadRasterImage(sk_sp<SkImage>, fml::WeakPtr<flutter::IOManager>, fml::tracing::TraceFlow const&)::$_3::operator()() const
    image_decoder.cc:202
    0x301c3c
    fml::SyncSwitch::Execute(fml::SyncSwitch::Handlers const&) const
    sync_switch.cc:0
    0x5c9fd0
    flutter::UploadRasterImage(sk_sp<SkImage>, fml::WeakPtr<flutter::IOManager>, fml::tracing::TraceFlow const&)
    image_decoder.cc:187
    0x3007bc
    std::__1::function<void ()>::operator()() const
    functional:2419
    0x304088
    fml::MessageLoopAndroid::OnEventFired()
    message_loop_android.cc:92
    
    Full crash
    OS Version: Android 11 (00WW_3_380_SP08)
    Report Version: 104
    
    Exception Type: Unknown (SIGSEGV)
    
    Application Specific Information:
    Segfault
    
    Thread 0 Crashed:
    0   libGLESv2_mtk.so                0x781000a3b8        0x780ff40000 + 515664552888
    1   libGLESv2_mtk.so                0x7810070224        0x780ff40000 + 515664970276
    2   libGLESv2_mtk.so                0x781006ee10        glTexImage2D
    3   libGLES_meow.so                 0x7810cdb524        0x7810c4a000 + 515677992228
    4   libflutter.so                   0x77ab6daa90        0x77ab1c5000 + 513977199248
    5   libflutter.so                   0x77ab6d5c94        0x77ab1c5000 + 513977179284
    6   libflutter.so                   0x77ab654088        0x77ab1c5000 + 513976647816
    7   libflutter.so                   0x77ab65cf4c        0x77ab1c5000 + 513976684364
    8   libflutter.so                   0x77ab658014        0x77ab1c5000 + 513976664084
    9   libflutter.so                   0x77ab65f568        0x77ab1c5000 + 513976694120
    10  libflutter.so                   0x77ab68c9f4        0x77ab1c5000 + 513976879604
    11  libflutter.so                   0x77ab68cb28        0x77ab1c5000 + 513976879912
    12  libflutter.so                   0x77ab68e618        0x77ab1c5000 + 513976886808
    13  libflutter.so                   0x77ab78f2b8        0x77ab1c5000 + 513977938616
    14  libflutter.so                   0x77ab4c6c3c        0x77ab1c5000 + 513975020604
    15  libflutter.so                   0x77ab78efd0        0x77ab1c5000 + 513977937872
    16  libflutter.so                   0x77ab4c57bc        0x77ab1c5000 + 513975015356
    17  libflutter.so                   0x77ab4c9088        0x77ab1c5000 + 513975029896
    18  libutils.so                     0x7abeeac060        0x7abee92000 + 912
    19  libutils.so                     0x7abeeabc64        0x7abee92000 + 108
    20  libandroid.so                   0x7824d65d3c        0x7824d53000 + 100
    21  libflutter.so                   0x77ab4c9198        0x77ab1c5000 + 513975030168
    22  libflutter.so                   0x77ab4c748c        0x77ab1c5000 + 513975022732
    23  libc.so                         0x7abff7cbd8        0x7abfecc000 + 527206697944
    24  libc.so                         0x7abff1c5d0        0x7abfecc000 + 527206303184
    

    The Flutter version of the crash is 2.10.3 but the same crash still happens with version 3.3.9.

  13. bdezso commented on Jan 1, 2023

    @bdezso

    I have 99.2% crash free user, all crash come from this:

    backtrace:
    #00 pc 0x000000000002bfcc /vendor/lib/egl/libGLESv2_mtk.so
    #1 pc 0x0000000000041ddd /vendor/lib/egl/libGLESv2_mtk.so
    #2 pc 0x000000000002bf71 /vendor/lib/egl/libGLESv2_mtk.so
    #3 pc 0x000000000006c867 /vendor/lib/egl/libGLESv2_mtk.so
    #4 pc 0x000000000006c3bd /vendor/lib/egl/libGLESv2_mtk.so (glTexImage2D+156)
    #5 pc 0x000000000002ab8f /vendor/lib/egl/libGLES_meow.so
    #6 pc 0x0000000000352e29 /data/app/com.mrkresz.app-hso0GB9shZmuPWncYOfUoA==/lib/arm/libflutter.so
    #7 pc 0x000000000021a605 /data/app/com.mrkresz.app-hso0GB9shZmuPWncYOfUoA==/lib/arm/libflutter.so
    #8 pc 0x00000000002f9dc7 /data/app/com.mrkresz.app-hso0GB9shZmuPWncYOfUoA==/lib/arm/libflutter.so
    #9 pc 0x0000000000000438

  14. chenenyu commented on Jan 10, 2023

    @chenenyu

    We are using flutter 3.3.x, 2% crashes are produced by this issue in my app. 😢 Any progress?

  15. KaelTeck commented on Jan 23, 2023

    @KaelTeck

    Any updates? Is there a solution to this problem?

  16. SvenFang commented on Mar 14, 2023

    @SvenFang

    Any progress?

  17. ronnieCodeWang commented on Apr 3, 2023

    @ronnieCodeWang

    Any progress?

  18. zanderso commented on Apr 3, 2023

    @zanderso
    MemberAuthor

    This issue has been open for nearly a year, and since there is no new information about the device where it happens or repro steps, I'm going to close this as not actionable. In general, we are not able to take action on crash logs from crash reporting services without knowing the device where the crash happens and local repro instructions.

  19. github-actions commented on Apr 17, 2023

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  20. locked as resolved and limited conversation to collaborators on Apr 17, 2023
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

    P2Important issues not at the top of the work listc: crashStack traces logged to the consolecustomer: money (g3)dependency: skiaSkia team may need to help usengineflutter/engine related. See also e: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions