Closed sinahamedi67 closed 1 year ago
I can echo that what I'm experiencing seems to be the same issue after upgrading to Flutter 3.10. I have yet to see it visually, but it's appearing in CI/CD logs of integration tests using the iOS simulator. I use AssetImage
.
this also happened to me on iOS, it seems to be caused by the impeller engine as it also happens on android when i enable it. it only occurs on debug mode, on profile and release seems to be okay
Hi everyone. I can not reproduce this issue on the latest stable and master channels using iOS emulator 16.4. It does not happen even with asset or network image.
@sinahamedi67 Since it's related to picsum
API, the image could not be existing. So, is there any percentage occurrence of the issue? Or does it occur everytime?
@zrpra Does the issue still persist if you disable Impeller?
I have the same issue on the IOS simulator.
This happened after upgrading to v3.10.0.
I ran the app with flutter run --no-enable-impeller
and it worked.
I tried this out and could not reproduce it on a simulator.
I do notice that the doctor output is showing you're on Xcode 14.0. Can you try upgrading to the latest Xcode and see if it still reproduces? I'm running on Xcode 14.3.
I have the same issue with the ios simulator. (Work fine with the Android emulator.)
I tried both Xcode 14.2 and Xcode 14.3
The same project worked fine with Flutter 2.7, then updated to Flutter 3.10 and got the same error!!
I searched for Hasan Alqaisi's above solution.
https://github.com/flutter/flutter/issues/126768#issuecomment-1547628866
Then follow the instruction :
To disable Impeller on iOS when deploying your app, add the following tags under the top-level
tag in your app's Info.plist file.
from
https://docs.flutter.dev/perf/impeller#ios
<key>FLTEnableImpeller</key> <false />
This allows using flutter run
.
And it has worked fine.
I have the same issue on the IOS simulator. This happened after upgrading to v3.10.0. I ran the app with
flutter run --no-enable-impeller
and it worked.
This worked for me and my GitHub Actions error when testing on iOS simulator.
@zrpra Does the issue still persist if you disable Impeller?
when impeller is disabled the image shows as normal
@sinahamedi67 Since it's related to
picsum
API, the image could not be existing. So, is there any percentage occurrence of the issue? Or does it occur everytime?
Yes it occurs every time, it happened on my own website first, all of the online images had the same problem. I used picsum just to write a sample.
Does the issue still persist if you disable Impeller?
βNo, by disabling the impeller both my own project and sample works fine.
@sinahamedi67 I also try on the same emulator as yours (iPhone 13 Pro, iOS 16.0) but still can not reproduce this. Can you try checking this on another emulator if any?
Meu smartphone tΓ‘ sendo monitorado e eu acho que Γ© por esse flutter ou sla, sei que tΓ‘ conectado ao ios 16 e nΓ£o sei o que fazer, tΓ΄ triste demais
we're experiencing the same issue, seems to only occur on CI but cannot reproduce locally - is there a workaround other than disabling Impeller?
I am experiencing the same issue.
I made a github repo to reproduce this issue. (https://github.com/mmcdon20/displayimage/tree/master)
This error seems to happen on some iOS simulators but not others. For me specifically the iPhone 5s with iOS 12.4 is one simulator where this error occurs.
In the screenshot above both simulators are running the same app.
The simulator on the right is producing this error.
======== Exception caught by image resource service ================================================
The following _Exception was thrown resolving an image frame:
Exception: Codec failed to produce an image, possibly due to invalid image data.
When the exception was thrown, this was the stack:
Image provider: AssetImage(bundle: null, name: "images/bottle.jpg")
Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#5d83e(), name: "images/bottle.jpg", scale: 1.0)
====================================================================================================
The app runs on both if the --no-enable-impeller
flag is passed, so appears to be directly related to impeller.
Flutter does not support iPhone 5s anymore. Lowest version we support is 11.
@dnfield iOS 11? The simulator is running iOS 12.4 on the 5s. You can see it in the screenshot that its 12.4.
No, iPhone 11 :)
The lowest iPhone simulator I can create is an 8 locally. I can't even get runtimes at this point for lower than that. On an iPhone 8 simulator your demo app works fine for me locally.
@dnfield The table you are referencing appears to be iOS versions though, not iPhone versions (especially considering iPhone 16 doesn't exist yet). iOS 11-15 falls in the best effort category not the unsupported category.
Ahh you are right.
Sorry about that. Let me check.
I am unable to reproduce this on the oldest phone I can access. It still seems like this might be more of an issue on older simulators on older versions of macOS which I also don't currently have access to.
@sinahamedi67 π¨ Just a heads up, I think that this is not an impeller issue. I'm experiencing the same issue on both:
android & iOS on emulator and device debug, profile, and release mode
Extra info:
.avif
file ![image](https://github.com/flutter/flutter/assets/59662912/3ceb9c9b-efa9-44e5-af14-7a1c47a35e3f)
Logs
W/Parcel (12476): Expecting binder but got null!
E/HeifDecoderImpl(12476): decode: videoFrame is a nullptr
E/FlutterJNI(12476): Failed to decode image
E/FlutterJNI(12476): java.io.IOException: getPixels failed with error invalid input
E/FlutterJNI(12476): at android.graphics.ImageDecoder.nDecodeBitmap(Native Method)
E/FlutterJNI(12476): at android.graphics.ImageDecoder.decodeBitmapInternal(ImageDecoder.java:1780)
E/FlutterJNI(12476): at android.graphics.ImageDecoder.decodeBitmapImpl(ImageDecoder.java:1942)
E/FlutterJNI(12476): at android.graphics.ImageDecoder.decodeBitmap(ImageDecoder.java:1927)
E/FlutterJNI(12476): at io.flutter.embedding.engine.FlutterJNI.decodeImage(FlutterJNI.java:538)
Versions
Flutter 3.7.12 β’ channel stable β’ https://github.com/flutter/flutter.git
Framework β’ revision 4d9e56e694 (4 weeks ago) β’ 2023-04-17 21:47:46 -0400
Engine β’ revision 1a65d409c7
Tools β’ Dart 2.19.6 β’ DevTools 2.20.1
@Juliotati - you are seeing a similar exception message for a different reason. You are also on an older version of Flutter. AVIF support is platform specific in Flutter and not all platforms support it.
@sinahamedi67 I also try on the same emulator as yours (iPhone 13 Pro, iOS 16.0) but still can not reproduce this. Can you try checking this on another emulator if any?
Yes it happens on other simulators too. Also I've upgraded my macos & xcode to the latest versions and still have this bug. New flutter doctor:
[β] Flutter (Channel stable, 3.10.0, on macOS 13.3.1 22E772610a darwin-x64, locale en-US)
β’ Flutter version 3.10.0 on channel stable at /Users/flutter/Downloads/flutter
β’ Upstream repository https://github.com/flutter/flutter.git
β’ Framework revision 84a1e904f4 (9 days ago), 2023-05-09 07:41:44 -0700
β’ Engine revision d44b5a94c9
β’ Dart version 3.0.0
β’ DevTools version 2.23.1
[β] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
β’ Android SDK at /Users/flutter/Library/Android/sdk
β’ Platform android-33, build-tools 33.0.2
β’ Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
β’ Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
β’ All Android licenses accepted.
[β] Xcode - develop for iOS and macOS (Xcode 14.3)
β’ Xcode at /Users/flutter/Downloads/Xcode14.3/Xcode.app/Contents/Developer
β’ Build 14E222b
β’ CocoaPods version 1.12.1
[β] Chrome - develop for the web
β’ Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[β] Android Studio (version 2022.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 17.0.6+0-17.0.6b802.4-9586694)
[β] Connected device (3 available)
β’ iPhone 14 Pro (mobile) β’ 4B87186A-F646-430F-89EC-4A221B9C4CEB β’ ios β’ com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
β’ macOS (desktop) β’ macos β’ darwin-x64 β’ macOS 13.3.1 22E772610a darwin-x64
β’ Chrome (web) β’ chrome β’ web-javascript β’ Google Chrome 113.0.5672.126
[β] Network resources
β’ All expected network resources are available.
β’ No issues found!
I still can not reproduce this issue on my end. The image is always shown as expected. If anyone is able to replicate this consistently and can find a pattern to replicate it, please write a comment.
I have the same issues, for all pictures, with asset images, when using emulator.
Not sure if that has anything to do with it, but I'm using macOS on a VMware virtual machine. It seems that other users in this thread also have this bug in their CI/CD process. So perhaps Impeller relies on a library or dependency that doesn't function well on virtual machines.
Same issue here, using iOS simulator
This is failing for me on iOS in CI as well, but not every time. I haven't been able to reproduce locally. The differences between environments:
Both should be using iPhone 14 simulators on the latest versions of XCode and iOS.
Going go work around by using --no-enable-impeller
on CI for now.
@sinahamedi67 @fuzzybinary The observation that this happens on CI that may have a virtualized environment is intriguing. And could also explain our difficulty in reproducing it.
W.r.t texture management, Impeller differs from the existing backend in one key way. Before Impeller, when decompressing images, the engine would create an uncompressed texture onto the heap before transferring this to GPU device memory and further modifying its usage there. Impeller elides this copy on the heap and directly decompresses into GPU device memory mapped into the process. This reduces memory usage spikes during texture decompression. But this also depends on carefully considering device capabilities. We thought we did our due diligence by testing on the devices and simulators but haven't considered the implications of a virtualized environment with GPU passthrough.
We still haven't reproduced this issue ourselves but we are speculatively disabling this optimization on the simulators in https://github.com/flutter/engine/pull/42161 while we investigate some more.
Some potential threads to keep pulling on:
- @jonahwilliams @dnfield Can we land and cherry-pick the speculative "fix" by Monday? Its low risk and simulator only. We can then get more feedback. With luck, folks won't have to work around this like @fuzzybinary had to.
I think it's a low risk cherry pick, but once it rolls into the framework it' dbe great if someone on this thread who's been able to reproduce the issue (e.g. on CI) can make sure the issue goes away with that change. Otherwise we're cherry picking a pretty speculative fix that might cause other issues and has no tests...
I would add that unless someone can confirm that the patch works (once it rolls into main) we will not cherry pick it.
The flutter commit d211dc141a98d21bb5ebb2baddc3cd4cc9e64f27 contains an updated version of image decoding for the simulators. Someone who can reproduce the issue will need to verify the change had an impact. We're also working on bubbling up the exact error message from the engine.
The flutter commit d211dc1 contains an updated version of image decoding for the simulators. Someone who can reproduce the issue will need to verify the change had an impact. We're also working on bubbling up the exact error message from the engine.
I checked again with latest version Channel master, 3.11.0-10.0.pre.44
which had that commit, but didn't change the result.
This is happening on my test runs, not sure how to disable impeller using flutter test
Flutter test does not use impeller
I no longer get the error in this thread (Codec failed to produce an image
) during flutter test
when I downgrade
https://github.com/baconcheese113/handle-it-app/actions/runs/5041544099/jobs/9041331691
Downgrading from flutter 3.10.0 back to 3.7.7, dart 3.0.0 to 2.17.4, and collection 1.17.1 to 1.17.0
I tested with the iPhone 11 and iPhone 12 simulators
- Seeking proof by contradiction, can anyone on this thread reproduce this in a known non-virtualized environment? If so, can you paste the information in the "About this Mac" and "System Information -> Graphics/Displays" sections?
I have this issue and am not working in a virtualised environment.
Apple M1 Pro:
Chipset Model: Apple M1 Pro
Type: GPU
Bus: Built-In
Total Number of Cores: 16
Vendor: Apple (0x106b)
Metal Support: Metal 3
Displays:
Colour LCD:
Display Type: Built-in Liquid Retina XDR Display
Resolution: 3024x1964 Retina
Main Display: Yes
Mirror: Off
Online: Yes
Automatically Adjust Brightness: Yes
Connection Type: Internal
C34H89x:
Resolution: 3440x1440 (UWQHD - Ultra-Wide Quad HD)
UI Looks like: 3440 x 1440 @ 100.00Hz
Mirror: Off
Online: Yes
Rotation: Supported
Leading to
======== Exception caught by image resource service ================================================
The following _Exception was thrown resolving an image frame:
Exception: Codec failed to produce an image, possibly due to invalid image data.
When the exception was thrown, this was the stack:
Image provider: AssetImage(bundle: null, name: "assets/logo/circular.png")
Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#686e0(), name: "assets/logo/circular.png", scale: 1.0)
On
Flutter 3.10.0 β’ channel stable β’ https://github.com/flutter/flutter.git
Framework β’ revision 84a1e904f4 (13 days ago) β’ 2023-05-09 07:41:44 -0700
Engine β’ revision d44b5a94c9
Tools β’ Dart 3.0.0 β’ DevTools 2.23.1
How can I help?
Edit: After posting this, I upgraded to the latest Flutter and latest MacOS to see if that would make any chance and now it runs fine! Sorry, I guess I can no longer reproduce it. It had also been quite a long time since I restarted my Mac, so either it was due to the upgrade or due to simply restarting my machine.
@sinahamedi67 @fuzzybinary If possible, can you give us details on the kind of virtualization used by your CI providers? > @sinahamedi67 mentioned VMWare. @fuzzybinary Are you using the same?
We are using Bitrise's Mac OS Intel images. I'm not sure if they're using virtualization or not (likely yes).
@jonahwilliams Flutter test does not use impeller
So far as I can tell, Flutter integration tests do use Impeller. At least removing impeller with the below method fixed my issues
@baconcheese113 This is happening on my test runs, not sure how to disable impeller using flutter test
I could not figure out how to disable this in tests, so I disabled it in the app by adding the following to our plist:
<key>FLTEnableImpeller</key>
<false />
This worked for us because I work on a library and I have a separate app for integration tests, so I just disabled it there.
Flutter test does not use impeller
flutter test
can run integration tests now.
Reproduced this in the iOS simulator within a VM running macOS Monterey.
In that environment ShouldUseMetalRenderer
is returning false because the Metal device does not support the desired feature set. GetRenderingAPIForProcess
then selects the Skia-based software renderer instead of the Impeller Metal renderer.
When an image is decoded ImageDecoder::Make
selects the ImageDecoderImpeller
based on the settings.enable_impeller
flag. But if the engine is using the software renderer, then the ImageDecoderImpeller
can not obtain an Impeller context and therefore fails.
TL;DR: Metal needs to be enabled on a virtualized macOS environment for Flutter simulators.
We discussed Jason's findings as a team and tried to reason about the observed behavior as it was extremely surprising to us.
Our understanding as of right now is as follows. Please disregard our initial hunch as that didnβt pan out and turned out to be the wrong line of investigation.
Iβll follow up on trying to figure out the impact of this as Iβm not sure how many CI providers that use virtualization just flat out refuse Metal device creation.
Doing some more investigating on the impact of this on CI environments:
Since CI environments should support GPU passthrough. We are inclined to make the non-availability of Metal on simulators a fatal error since we weren't even aware folks were routinely running into this unsupported configuration.
Thanks everyone for help pinpointing this. Closing this as there are no pending action items.
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.
Is there an existing issue for this?
Steps to reproduce
Image.Network
orImage.asset
on iOS simulatorIt happens on different ios simulator with any images from network or assets. Using cached_network_image package also produces the same result. This bug produced after upgrading from Flutter 3.3.0 to 3.10
Update: It works fine until 3.7.12
Expected results
Showing the image successfully
Actual results
Following exception throws:
Code sample
Code sample
```dart import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', home: Scaffold( body: Center( child: Image.network( 'https://picsum.photos/200/300', ), ), ), ); } } ```Screenshots or Video
Screenshots / Video demonstration
![image](https://github.com/flutter/flutter/assets/78305390/40f45b15-17da-4ec5-a311-d53fd1966f8f)Logs
Logs
``` [ +816 ms] com.example.images: 64717 [ ] Waiting for VM Service port to be available... [ +899 ms] VM Service URL on device: http://127.0.0.1:55892/U1waQeMPT4c=/ [ +6 ms] Caching compiled dill [ +255 ms] Connecting to service protocol: http://127.0.0.1:55892/U1waQeMPT4c=/ [ +347 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at http://127.0.0.1:55892/U1waQeMPT4c=/. [ +256 ms] DDS is listening at http://127.0.0.1:55895/LMq3joqnDbk=/. [ +95 ms] Successfully connected to service protocol: http://127.0.0.1:55892/U1waQeMPT4c=/ [ +91 ms] DevFS: Creating new filesystem on the device (null) [ +95 ms] DevFS: Created new filesystem on the device (file:///Users/flutter/Library/Developer/CoreSimulator/Devices/D4909C3C-EA95-4F22-A52C-62D212410360/data/Containers/Data/Application/A70E296E-62C3-420B-849C-DF75398898BA/t mp/imagesgj5pit/images/) [ +2 ms] Updating assets [ +356 ms] Manifest contained wildcard assets. Inserting missing file into build graph to force rerun. for more information see #56466. [ +8 ms] Syncing files to device iPhone 13 Pro... [ +3 ms] Compiling dart to kernel with 0 updated files [ ] Processing bundle. [ +1 ms] <- recompile package:images/main.dart 7793d8de-8aba-442e-9871-f95e67dd6cd1 [ ] <- 7793d8de-8aba-442e-9871-f95e67dd6cd1 [ +11 ms] Bundle processing done. [ +154 ms] Updating files. [ ] DevFS: Sync finished [ +2 ms] Syncing files to device iPhone 13 Pro... (completed in 173ms) [ +1 ms] Synced 0.0MB. [ +2 ms] <- accept [ +18 ms] Connected to _flutterView/0x7ff36102ca20. [ +206 ms] Flutter run key commands. [ +15 ms] r Hot reload. π₯π₯π₯ [ +2 ms] R Hot restart. [ ] h List all available interactive commands. [ +91 ms] d Detach (terminate "flutter run" but leave application running). [ ] c Clear the screen [ ] q Quit (terminate the application on the device). [ +1 ms] A Dart VM Service on iPhone 13 Pro is available at: http://127.0.0.1:55895/LMq3joqnDbk=/ [ +53 ms] The Flutter DevTools debugger and profiler on iPhone 13 Pro is available at: http://127.0.0.1:9100?uri=http://127.0.0.1:55895/LMq3joqnDbk=/ [+1704 ms] βββ‘ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE βββββββββββββββββββββββββββββββββββββββββββββββββββββ The following _Exception was thrown resolving an image frame: Exception: Codec failed to produce an image, possibly due to invalid image data. When the exception was thrown, this was the stack Image provider: NetworkImage("https://picsum.photos/200/300", scale: 1.0) Image key: NetworkImage("https://picsum.photos/200/300", scale: 1.0) ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ ``` Complete `flutter run --verbose`: https://pastebin.com/w1gyiz9MFlutter Doctor output
Doctor output
```console [β] Flutter (Channel stable, 3.10.0, on macOS 12.6 21G115 darwin-x64, locale en-US) β’ Flutter version 3.10.0 on channel stable at /Users/flutter/Downloads/flutter β’ Upstream repository https://github.com/flutter/flutter.git β’ Framework revision 84a1e904f4 (5 days ago), 2023-05-09 07:41:44 -0700 β’ Engine revision d44b5a94c9 β’ Dart version 3.0.0 β’ DevTools version 2.23.1 [β] Android toolchain - develop for Android devices (Android SDK version 33.0.0) β’ Android SDK at /Users/flutter/Library/Android/sdk β’ Platform android-33, build-tools 33.0.0 β’ Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java β’ Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) β’ All Android licenses accepted. [β] Xcode - develop for iOS and macOS (Xcode 14.0) β’ Xcode at /Users/flutter/Downloads/Xcode14/Xcode.app/Contents/Developer β’ Build 14A309 β’ CocoaPods version 1.12.1 [β] Chrome - develop for the web β’ Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [β] Android Studio (version 2022.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 17.0.6+0-17.0.6b802.4-9586694) [β] Connected device (3 available) β’ iPhone 13 Pro (mobile) β’ D4909C3C-EA95-4F22-A52C-62D212410360 β’ ios β’ com.apple.CoreSimulator.SimRuntime.iOS-16-0 (simulator) β’ macOS (desktop) β’ macos β’ darwin-x64 β’ macOS 12.6 21G115 darwin-x64 β’ Chrome (web) β’ chrome β’ web-javascript β’ Google Chrome 113.0.5672.92 [β] Network resources β’ All expected network resources are available. β’ No issues found! ```