When taking a photo using HTML file input with an iPhone, Safari often crashes cryptically
with the "A Problem Occurred with this Webpage so it was Reloaded". It seems this is due
to an out of memory error, crash logs include reason:vm-thrashing
It may be related to canvas resizing, as the captured image, especially with
the iPhone's higher megapixel camera producing much larger files that usually
need to be resized before uploading
I did some research on github and people have been experiencing similar problems
this blog post goes into a lot of detail about this problem
What iOS versions and which iOS devices show the problem?
Been seeing this problem occur on a iPhone 6 running 10.3.1, one user dropped back to an iPhone 5 with 10.3.1 and it didn't happen for a while, but then it started happening again. I can't reproduce this on an iPad (guessing due to smaller camera)
It was also happening with 9.3.x
another crash example
I filed bug 172728 about https://github.com/kangax/fabric.js/issues/3693
It would be helpful to provide URLs where the issues reported in the links in the first comment can be reproduced.
After analyzing https://github.com/kangax/fabric.js/issues/3693 in some detail, I believe it's not directly related, unless all the other sites are using the fabric canvas library.
I just reproduced the crash on the "Upload Example (with exif orientation compatability)" demo here http://foliotek.github.io/Croppie/ (near the bottom of the page) with an iPad running 10.3.2, you need to take quite a few photos (sorry I didn't keep an exact count!) and then it reloads
this also crashes after taking 5 photos http://scottcheng.github.io/cropit/ using the first demo on the page, iPad 10.3.2
Thanks, I'll try those.
(In reply to zac spitzer from comment #8)
> this also crashes after taking 5 photos http://scottcheng.github.io/cropit/
> using the first demo on the page, iPad 10.3.2
Do you mean that you tap the "Choose File" button once, take a photo, and then take 4 more photos using the "Retake" button in the camera UI? Or something else?
(In reply to zac spitzer from comment #7)
> I just reproduced the crash on the "Upload Example (with exif orientation
> compatability)" demo here http://foliotek.github.io/Croppie/ (near the
> bottom of the page) with an iPad running 10.3.2, you need to take quite a
> few photos (sorry I didn't keep an exact count!) and then it reloads
I reproduced it here. Thanks!
another similar problem with some detailed investigation via xcode
Interesting but let's not pile everything onto this bug. Please file a new bug for https://github.com/mapbox/mapbox-gl-js/issues/4695
Happens on iOS 9.3.5 as well
http://foliotek.github.io/Croppie/ creates a 3024x4032 canvas, which is 418MB, which is one reason why the web process gets killed.
http://foliotek.github.io/Croppie/ also has an <img clas="cr-image"> with a 3D transforms and a 1280 x 720 image, which creates a layer of 2x or 3x that size (depending on device resolution), which also eats a lot of memory. So I think the http://foliotek.github.io/Croppie page is just using too much memory for images, layer backing store and and canvas.
http://scottcheng.github.io/cropit/ is also very memory hungry, with <img class="cropit-preview-background"> taking 209MB, and <img class="cropit-preview-image"> taking 188MB.
But they work first time, why does it crash only after several attempts?
I haven't figure that part out yet :)
Sorry to pester, but any progress on this?
I have some very frustrated clients who are contemplating buying Android devices
(In reply to zac spitzer from comment #20)
> Sorry to pester, but any progress on this?
> I have some very frustrated clients who are contemplating buying Android
Nothing to report yet. We'll get to it soon.
any updates? so many developers are battling against this bug and wasting hours trying to find workarounds
In my investigations, this was mostly caused by web pages creating very large canvas elements (or leaking canvases, in the case of Fabric.js). If this affects your content, the best option is to optimize canvas memory usage.
So why is this only a problem with Safari and only after processing several images via canvas?
I've been using https://github.com/gokercebeci/canvasResize and have tried manually setting every canvas object to null, but Safari still just runs out of memory and crashes
Neither Chrome or Firefox on Android exhibit this problem?
Is a Native API for image resizing needed? Modern cameras produce really large images and they need to be down sized before being uploaded and currently Canvas is the only option