Repository navigation
Exception: Image upload failed due to loss of GPU access on iOS Devices on 3.27.0-0.2.pre #159397
Copy link
Copy link
Closed
Labels
a: imagesLoading, displaying, rendering imagesLoading, displaying, rendering imagesa: productionIssues experienced in live production appsIssues experienced in live production appsc: crashStack traces logged to the consoleStack traces logged to the consolee: impellerImpeller rendering backend issues and features requestsImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.needs repro infoAutomated crash report whose cause isn't yet knownAutomated crash report whose cause isn't yet knownr: solvedIssue is closed as solvedIssue is closed as solvedteam-engineOwned by Engine teamOwned by Engine team
Description
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!Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
a: imagesLoading, displaying, rendering imagesLoading, displaying, rendering imagesa: productionIssues experienced in live production appsIssues experienced in live production appsc: crashStack traces logged to the consoleStack traces logged to the consolee: impellerImpeller rendering backend issues and features requestsImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.needs repro infoAutomated crash report whose cause isn't yet knownAutomated crash report whose cause isn't yet knownr: solvedIssue is closed as solvedIssue is closed as solvedteam-engineOwned by Engine teamOwned by Engine team
Activity
danagbemava-nc commentedon Nov 25, 2024
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?
knaeckeKami commentedon Nov 25, 2024
I upgraded from the latest stable, 3.24.5.
It seems to affect multiple iOS versions, I have these in my monitoring:
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.
danagbemava-nc commentedon Nov 26, 2024
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?
knaeckeKami commentedon Nov 26, 2024
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
danagbemava-nc commentedon Nov 27, 2024
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.Seem related to impeller, could you try with the skia renderer to see if you still experience this issue?
knaeckeKami commentedon Nov 27, 2024
The way I do it in these cases:
or
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.
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?
danagbemava-nc commentedon Nov 28, 2024
Thanks for the info.
Labeling this for further investigation and insight
jonahwilliams commentedon Dec 2, 2024
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.
github-actions commentedon Dec 17, 2024
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 -vand a minimal reproduction of the issue.