Bug 172533 - Camera/Canvas file input crash: A Problem Occurred with this Webpage so it was Reloaded
Summary: Camera/Canvas file input crash: A Problem Occurred with this Webpage so it wa...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: Safari 10
Hardware: iPhone / iPad iOS 10
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-05-23 19:54 PDT by zac spitzer
Modified: 2017-06-19 01:58 PDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zac spitzer 2017-05-23 19:54:41 PDT
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

https://github.com/kobotoolbox/enketo-express/issues/398
https://github.com/scottcheng/cropit/issues/226
https://github.com/Foliotek/Croppie/issues/243

this blog post goes into a lot of detail about this problem
http://digitalservicescompany.com/blog/case-study-image-resize-in-a-browser/
Comment 1 Simon Fraser (smfr) 2017-05-23 22:08:50 PDT
What iOS versions and which iOS devices show the problem?
Comment 2 zac spitzer 2017-05-23 22:26:57 PDT
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
Comment 3 Radar WebKit Bug Importer 2017-05-24 12:01:33 PDT
<rdar://problem/32383118>
Comment 4 zac spitzer 2017-05-29 21:14:52 PDT
another crash example
https://github.com/kangax/fabric.js/issues/3693
Comment 5 Simon Fraser (smfr) 2017-05-30 13:32:42 PDT
I filed bug 172728 about https://github.com/kangax/fabric.js/issues/3693
Comment 6 Simon Fraser (smfr) 2017-05-30 19:12:50 PDT
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.
Comment 7 zac spitzer 2017-05-30 19:22:13 PDT
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
Comment 8 zac spitzer 2017-05-30 19:25:49 PDT
this also crashes after taking 5 photos http://scottcheng.github.io/cropit/ using the first demo on the page, iPad 10.3.2
Comment 9 Simon Fraser (smfr) 2017-05-30 21:12:13 PDT
Thanks, I'll try those.
Comment 10 Simon Fraser (smfr) 2017-05-31 14:02:10 PDT
(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?
Comment 11 Simon Fraser (smfr) 2017-05-31 14:31:14 PDT
(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!
Comment 12 zac spitzer 2017-05-31 17:24:30 PDT
another similar problem with some detailed investigation via xcode
https://github.com/mapbox/mapbox-gl-js/issues/4695#issuecomment-305304043
Comment 13 Simon Fraser (smfr) 2017-05-31 17:37:10 PDT
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
Comment 14 Krister Bäckman 2017-06-19 01:58:05 PDT
Happens on iOS 9.3.5 as well