Repository navigation
Open
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: imagesLoading, displaying, rendering imagesLoading, displaying, rendering imagesbrowser: safari-iosonly manifests in Safari on iOSonly manifests in Safari on iOSc: crashStack traces logged to the consoleStack traces logged to the consolecustomer: thoughts (g3)found in release: 3.22Found to occur in 3.22Found to occur in 3.22found in release: 3.24Found to occur in 3.24Found to occur in 3.24has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyWeb applications specificallyteam-webOwned by Web platform teamOwned by Web platform teamtriaged-webTriaged by Web platform teamTriaged by Web platform team
Description
This reproduces reliably on all iPhones.
To repro:
- Open https://vitalsynergyoregon.web.app in iPhone
- Observe how the website opens couple times and then error page (below in comment)
- source code: https://github.com/vitalsynergy/vital_synergy
- deployed website: https://vitalsynergyoregon.web.app/
- i deployed this app by running
firebase deployin the folderwebsite. I tried both Flutter master and Flutter stable, also i tried to recreate firebase project and deploy to it.
what SDKs I tried:
flutter --version
Flutter 3.24.0-1.0.pre.214 • channel master • [email protected]:flutter/flutter.git
Framework • revision c63733310f (9 days ago) • 2024-07-20 19:26:30 -0400
Engine • revision 207f088f73
Tools • Dart 3.6.0 (build [3.6.0-55.0.dev](http://3.6.0-55.0.dev/)) • DevTools 2.37.1
flutter --version
Flutter 3.22.3 • channel stable • [email protected]:flutter/flutter.git
Framework • revision b0850beeb2 (13 days ago) • 2024-07-16 21:43:41 -0700
Engine • revision 235db911ba
Tools • Dart 3.4.4 • DevTools 2.34.3
Reacted by Pedro-Salvatore, Takuma Nishino, Eric Dhom, Konstantin Serov, Ilyas LEFEBVRE, BlackMatter Studios, Andreas Molinarius, Marcos Antonio, dice, rota2000 and 13 more
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: imagesLoading, displaying, rendering imagesLoading, displaying, rendering imagesbrowser: safari-iosonly manifests in Safari on iOSonly manifests in Safari on iOSc: crashStack traces logged to the consoleStack traces logged to the consolecustomer: thoughts (g3)found in release: 3.22Found to occur in 3.22Found to occur in 3.22found in release: 3.24Found to occur in 3.24Found to occur in 3.24has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyWeb applications specificallyteam-webOwned by Web platform teamOwned by Web platform teamtriaged-webTriaged by Web platform teamTriaged by Web platform team
Activity
polina-c commentedon Aug 1, 2024
[-]Flutter code crashes for web in iOS, while working well on Android and Desktop Chrome.[/-][+]Flutter code crashes for Chrome/Safari on iOS, while working well on Android and Desktop.[/+][-]Flutter code crashes for Chrome/Safari on iOS, while working well on Android and Desktop.[/-][+]Simple Flutter web app crashes for Chrome/Safari on iOS, while working well on Android and Desktop.[/+][-]Simple Flutter web app crashes for Chrome/Safari on iOS, while working well on Android and Desktop.[/-][+][Web] App crashes on safari on iOS when loading large images[/+]danagbemava-nc commentedon Aug 2, 2024
Reproducible using the code sample in the repo provided above.
I managed to reduce the code sample to what was actually causing the crash. The issue is caused by trying to load
https://github.com/vitalsynergy/vital_synergy/blob/main/website/assets/images/logo_large.jpg
The reduced code sample is posted below. The image is about 18.7mb so I can't upload it in the comment (GH apparently has a 10mb image limit)
As noted above, this works fine on android and desktop browsers.
code sample
flutter doctor -v
91 remaining items
harryterkelsen commentedon Jun 25, 2026
To give an update on this issue:
I previously addressed the iOS Safari crash by introducing an
ImageDecodingManagerthat throttled simultaneousHTMLImageElement.decode()calls. This significantly reduced concurrent memory spikes and helped alleviate the OOM crashes.Currently, I am in the process of landing a major refactor to the web engine's image decoding architecture (unifying the CanvasKit and Skwasm pipelines). As part of this refactor, we are completely removing the legacy HTML image element-based codec. Instead, for Safari and other browsers that do not support the native
ImageDecoderAPI, we are now usingcreateImageBitmapfor static image decoding.createImageBitmapis a much more robust browser API and does not suffer from the same concurrency bugs and limitations as the oldHTMLImageElement.decode()method.Once this unification refactor lands, we will monitor the performance and memory behavior of
createImageBitmapon iOS Safari. If we find that throttlingcreateImageBitmapcalls is still beneficial for keeping peak memory usage low on highly resource-constrained iOS devices, I will re-introduce theImageDecodingManagerthrottling in a follow-up PR.Bylinkk commentedon Jun 30, 2026
@harryterkelsen Thank you for your efforts to resolve this critical issue for our applications. Can we test these fixes in a beta version? It appears the fixes haven't been implemented in 3.46.0-0.2.pre, as the bug is still present. When do you plan to include them, at least in a beta release? Thanks in advance for your feedback.
fobos commentedon Jul 2, 2026
@harryterkelsen The same for my team. We are still catching the bug.
Thanks for your efforts.
fobos commentedon Jul 9, 2026
@harryterkelsen Hi, any updates?
Thanks
harryterkelsen commentedon Aug 4, 2026
The image decoding refactor has landed. I'm going to verify that decoding many large images is better with a real iOS device and report back
harryterkelsen commentedon Aug 4, 2026
By the way, you can work around this issue pretty effectively by setting
webHtmlElementStrategy: WebHtmlElementStrategy.preferif you are usingImage.network. Safari seems to heavily optimize<img>elements which make them much faster than creating a bitmap to upload to WebGL (the normal codepath on web). If you can, please try that out and let me know if it works for you.Bylinkk commentedon Sep 12, 2026
Thank you @harryterkelsen for your work on this! Do you know which Flutter version this patch will be included in?
Bylinkk commentedon Sep 12, 2026
Thank you for the suggestion. I tested
webHtmlElementStrategy: WebHtmlElementStrategy.prefer, and the issue is still present, but it occurs much less quickly than before.When navigating rapidly between pages, Safari now crashes after dozens of very fast navigations, whereas previously it would only take a few navigations to crash the browser.
I also noticed that the issue takes significantly longer to occur when using smaller/lighter images.
So this workaround definitely improves the situation, but unfortunately it doesn't completely resolve the issue in my case.
Bylinkk commentedon Sep 12, 2026
You can test it using the following link. Here is the video demonstrating the issue.
https://devmode.scan.feadys.com
issue_safari_app_crache.mp4
harryterkelsen commentedon Sep 14, 2026
@Bylinkk thanks for the repro. I'll investigate shortly
Garciconx commentedon Sep 26, 2026
Any update?
kevmoo commentedon Sep 27, 2026
I made a VERY agent-forward stab at this: #193408
if you're able to try it out on a physical device (I only have access to a simulator) I'd love to know if it helps!
[web] Clear HTMLImageElement.src when WebImageInfo and ImgElementPlat…
kevmoo commentedon Oct 19, 2026
Landed a partial fix in #193408 - I'd LOVE anyone to try out Flutter @ HEAD and let me know if it helps!
[web] Clear HTMLImageElement.src when WebImageInfo and ImgElementPlat…