Skip to content

Exception: Image upload failed due to loss of GPU access on iOS Devices on 3.27.0-0.2.pre #159397

Closed

Description

@knaeckeKami

Steps to reproduce

I don't have a reproducible sample yet.

This happens on a large-ish production app.

Expected results

No exceptions to be thrown

Actual results

Since upgrading to 3.27.0-0.2.pre, I see a lot of Exceptions in my Monitoring Service for iOS devices (iOS only, for now).

Unfortunately, I don't have a usable stack trace:

_Exception
Exception: Image upload failed due to loss of GPU access.

stacktrace_utils.dart in getCurrentStackTrace at line 10 within sentry
sentry_exception_factory.dart in SentryExceptionFactory.getSentryException at line 44 within sentry
sentry_client.dart in SentryClient._prepareEvent at line 235 within sentry
sentry_client.dart in SentryClient.captureEvent at line 119 within sentry
hub.dart in Hub.captureEvent at line 114 within sentry
<asynchronous suspension>
flutter_error_integration.dart in FlutterErrorIntegration.call.<fn> at line 82 within sentry_flutter
mechanism: FlutterError handled: false

additional context:

Either

flutter_error_details
context: thrown resolving an image frame
library: image resource service

or

flutter_error_details
context: thrown image failed to precache
library: image resource service

100% of these exceptions happen in .inactive lifecycle state:

flutter_context
current_lifecycle_state: inactive
default_route_name: /
has_render_view: true
initial_lifecycle_state: AppLifecycleState.inactive

I do not know if the user experience is impacted by this or what causes this exceptions to be thrown specifically.

Code sample

I can't produce a code sample at the moment.

I am open to spend more time on this if someone provides guidance on how to narrow the issue down if needed.

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
 fvm flutter doctor -v
[✓] Flutter (Channel beta, 3.27.0-0.2.pre, on macOS 14.4.1 23E224 darwin-arm64, locale en-GB)
    • Flutter version 3.27.0-0.2.pre on channel beta at /Users/kami/fvm/versions/3.27.0-0.2.pre
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision fc011960a2 (10 days ago), 2024-11-14 12:19:18 -0800
    • Engine revision 397deba30f
    • Dart version 3.6.0 (build 3.6.0-334.4.beta)
    • DevTools version 2.40.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/kami/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)

[✓] IntelliJ IDEA Community Edition (version 2021.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.94.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.98.0

[✓] Connected device (5 available)
    • Martin’s iPhone (mobile)        • 00008030-000505902E91402E            • ios            • iOS 17.5.1 21F90
    • iPhone 15 Pro Max (mobile)      • CDCD1CF4-778F-4E49-99C0-A24B141B1FEC • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-5 (simulator)
    • macOS (desktop)                 • macos                                • darwin-arm64   • macOS 14.4.1 23E224 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                • darwin         • macOS 14.4.1 23E224 darwin-arm64
    • Chrome (web)                    • chrome                               • web-javascript • Google Chrome 131.0.6778.86

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Activity

  1. danagbemava-nc commented on Nov 25, 2024

    @danagbemava-nc
    Member

    Hi @knaeckeKami, what version of flutter did you upgrade from? What version(s) of iOS are experiencing this issue?

    Do you know what operation is being performed at the time of the issue? What device(s) have you seen this issue on so far?

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Nov 25, 2024
  3. knaeckeKami commented on Nov 25, 2024

    @knaeckeKami
    ContributorAuthor

    I upgraded from the latest stable, 3.24.5.

    It seems to affect multiple iOS versions, I have these in my monitoring:

    • iOS 18.1.1
    • iOS 17.6.1
    • iOS 18.1
    • iOS 18.2
    • iOS 18.0.1
    • iOS 17.1.2

    It does not seem to be device specific, I see these exceptions from iPhone 12 - iPhone 17.

    I don't have good information on what caused this, but from the logs, it seems it might be related to precaching images.

    I precache some images before some navigation events to avoid pop-ins.

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Nov 25, 2024
  5. danagbemava-nc commented on Nov 26, 2024

    @danagbemava-nc
    Member

    Hi @knaeckeKami, are these network images or some heavy assets? Can you check to see if caching the images earlier resolves this issue or would the images be unavailable?

  6. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Nov 26, 2024
  7. knaeckeKami commented on Nov 26, 2024

    @knaeckeKami
    ContributorAuthor

    I think it's related to loading network images, yes.

    What do you mean by "caching the images earlier"?

    I might be able to gather more information if someone has a clue from where an exception with the message "Image upload failed due to loss of GPU access." could come from, googling this message only leads to this GitHub issue unfortunately.

    Searching in the engine code base, it seems that this line is hit:
    https://github.com/flutter/engine/blob/acc32b477e944e44ea3b092209dccb0564a86fd2/lib/ui/painting/image_decoder_impeller.cc#L442

  8. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Nov 26, 2024
  9. danagbemava-nc commented on Nov 27, 2024

    @danagbemava-nc
    Member

    What do you mean by "caching the images earlier"?

    You mentioned you cache images before navigation, I precache some images before some navigation events to avoid pop-ins., so I was wondering if you could do it earlier.

    Searching in the engine code base, it seems that this line is hit:
    flutter/engine@acc32b4/lib/ui/painting/image_decoder_impeller.cc#L442

    Seem related to impeller, could you try with the skia renderer to see if you still experience this issue?

  10. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Nov 27, 2024
  11. knaeckeKami commented on Nov 27, 2024

    @knaeckeKami
    ContributorAuthor

    You mentioned you cache images before navigation, I precache some images before some navigation events to avoid pop-ins., so I was wondering if you could do it earlier.

    The way I do it in these cases:

    • user navigates to a screen A, there is a likely next screen B, images for the screen B are precached immediately when entering screen A

    or

    • user action
    • there is a loading state to precache the images
    • when done, transition to new screen, which has all the images precached and available from the first frame

    Other than precaching at app start (which would delay the start and could cause memory issues) I don't know how I could precache the images even earlier.

    Seem related to impeller, could you try with the skia renderer to see if you still experience this issue?

    I can't release a Skia version to my users due to performance issues.
    I did not manage to reproduce this issue locally yet.

    Maybe someone with experience in Impeller can give some guidance on why this might happen, so I can find I way to reproduce it?

  12. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Nov 27, 2024
  13. danagbemava-nc commented on Nov 28, 2024

    @danagbemava-nc
    Member

    Thanks for the info.

    Labeling this for further investigation and insight

  14. added
    c: crashStack traces logged to the console
    engineflutter/engine related. See also e: labels.
    a: imagesLoading, displaying, rendering images
    a: productionIssues experienced in live production apps
    needs repro infoAutomated crash report whose cause isn't yet known
    e: impellerImpeller rendering backend issues and features requests
    and removed
    in triagePresently being triaged by the triage team
    on Nov 28, 2024
  15. jonahwilliams commented on Dec 2, 2024

    @jonahwilliams
    Contributor

    This exception is thrown when many images are queued up for decoding while the engine does not have access to a GPU context. If the number of queued images exceeds some threshold, then older queued up images are evicted. From my perspective, this is working as expected?

    This can only happen when the app runs in the background, at which point the images are not visible anyway. My recommendation would be to either ignore these errors or use the flutter lifecycle observer to avoid decoding in the background on iOS.

  16. github-actions commented on Dec 17, 2024

    @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.

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

    a: imagesLoading, displaying, rendering imagesa: productionIssues experienced in live production appsc: crashStack traces logged to the consolee: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.needs repro infoAutomated crash report whose cause isn't yet knownr: solvedIssue is closed as solvedteam-engineOwned by Engine team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions