Closed Bug 1038414 Opened 9 years ago Closed 9 years ago

[B2G][Contacts][Camera][273MB Flame] Camera app OOMs when adding picture to contact

Categories

(Firefox OS Graveyard :: Gaia::Contacts, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(blocking-b2g:2.0+, b2g-v1.4 affected, b2g-v2.0 verified, b2g-v2.1 verified)

VERIFIED FIXED
2.1 S1 (1aug)
blocking-b2g 2.0+
Tracking Status
b2g-v1.4 --- affected
b2g-v2.0 --- verified
b2g-v2.1 --- verified

People

(Reporter: rkuhlman, Assigned: arcturus)

Details

(Keywords: smoketest, Whiteboard: [273MB-Flame-Support])

Attachments

(2 files)

The camera app frequently OOMs when user is attempting to attach a picture to a contact from the camera app.

Repro Steps:
1) Update a Flame to BuildID: 20140714000202
2) Launch Contacts app
3) Add new contact
4) Tap 'Add Picture' area and select 'Camera'
5) Take a picture

Actual:
Camera app OOMs and closes. User is returned to create contact screen, no picture is attached to contact

Expected:
Camera takes picture and attaches it to contact appropriately

v2.0 Environmental Variables:
Device: Flame v2.0 273mb
BuildID: 20140714000202
Gaia: ca022f811bcbbda0f89086094a9e92bb220fea18
Gecko: 376889ab0e02
Version: 32.0a2
Firmware Version: v122


Notes:
This issue is even more severe if the contacts app is sideloaded from another app. The camera will OOM before it has even finished drawing assets onscreen.
eg: Call Log > Tap on call > Create new contact > Attach picture from camera

Similar OOMs have been observed when attaching an image from camera to email and messaging apps.

Repro frequency: 4/5 80%
See attached: logcat
Smoketest blocker, adding qawanted to do branch checks.
blocking-b2g: --- → 2.0?
Whiteboard: [273MB-Flame-Support]
This issue does occur on the latest  Flame 2.1, Buri 2.0.

Environmental Variables:
Device: Flame Master
BuildID: 20140714061512
Gaia: 88e0a972280bb35847c010b8c3f1481fa80f3847
Gecko: 340b19c14d3d
Version: 33.0a1 (Master) 
Firmware Version: v122
User Agent: Mozilla/5.0 (Mobile; rv:33.0) Gecko/33.0 Firefox/33.0

Environmental Variables:
Device: Flame 1.4
BuildID: 20140711225112
Gaia: b7d36622c7df92c976c37520ccab25199c7ada91
Gecko: dbebcdab47aa
Version: 30.0 (1.4) 
Firmware Version: v122
User Agent: Mozilla/5.0 (Mobile; rv:30.0) Gecko/30.0 Firefox/30.0

Environmental Variables:
Device: Flame 2.0
BuildID: 20140714113711
Gaia: f2509d29f7ee4d670d0dbc47f16e1794529aee3f
Gecko: 8e9d3b4b52fd
Version: 32.0a2 (2.0) 
Firmware Version: v122
User Agent: Mozilla/5.0 (Mobile; rv:32.0) Gecko/32.0 Firefox/32.0

The camera will OOM close when attempting to take a picture.
QA Whiteboard: [QAnalyst-Triage?]
Flags: needinfo?(jmitchell)
Keywords: qaurgent, qawanted
QA Whiteboard: [QAnalyst-Triage?] → [QAnalyst-Triage+]
Flags: needinfo?(jmitchell)
Ni :hema here to get her input.
Flags: needinfo?(hkoka)
Camera performance is still slow using the provided repro steps, but much improved over previous builds.  The Camera doesn't seem to OOM anymore.

Environmental Variables:
Device: Flame v2.0 (273mb)
Build ID: 20140715000201
Gaia: 2c6c413ed729d465c52d6c2d5d458e2eee79e956
Gecko: d32649a24965
Version: 32.0a2 (2.0)
Firmware Version: v122
User Agent: Mozilla/5.0 (Mobile; rv:32.0) Gecko/32.0 Firefox/32.0
(In reply to Martin Shuman (Marty) from comment #5)
> Camera performance is still slow using the provided repro steps, but much
> improved over previous builds.  The Camera doesn't seem to OOM anymore.
> 
> Environmental Variables:
> Device: Flame v2.0 (273mb)
> Build ID: 20140715000201
> Gaia: 2c6c413ed729d465c52d6c2d5d458e2eee79e956
> Gecko: d32649a24965
> Version: 32.0a2 (2.0)
> Firmware Version: v122
> User Agent: Mozilla/5.0 (Mobile; rv:32.0) Gecko/32.0 Firefox/32.0

Marty: Good to know the you are not seeing OOMs anymore. Can you please help provide more information on the slowness.
Flags: needinfo?(hkoka) → needinfo?(mshuman)
I was able to OOM after trying to take a second picture.  ( To note I deleted all the pictures in the gallery before trying )

I do see the performance issue where it takes about ~17 seconds for the camera app to show a preview, ~10 for the picture to show after snapping the picture and getting to the retake/select page, 5 seconds for the picture to show in the contact.
blocking-b2g: 2.0? → 2.0+
Summary: [B2G][Contacts][Camera]Camera app OOMs when adding picture to contact → [B2G][Contacts][Camera][273MB Flame] Camera app OOMs when adding picture to contact
My experience is the same as Naoki's above.
Flags: needinfo?(mshuman)
Does this reproduce on QRD?
Flags: needinfo?(rkuhlman)
The camera pick activity has properties that can be set to specify the size of the desired photo. The SMS app uses this, and the contacts app ought to, if it does not already.  That will reduce camera memory usage and might be enough to fix this.
I've confimed that the Contacts app does a pick activity with no extra parameters. See contacts/js/views/form.js:1252:

    var activity = new MozActivity({
      name: 'pick',
      data: {
        type: 'image/jpeg'
      }
    });

The SMS message adds maxFileSizeBytes to the data object in the activity to request that the camera return an image that is smaller (in file size) than the requested size.  

When the homescreen requests an image (for use as wallpaper) it initiates the activity like this:

      var a = new MozActivity({
        name: 'pick',
        data: {
          type: ['wallpaper', 'image/*'],
          width: window.screen.width * window.devicePixelRatio,
          height: window.screen.height * window.devicePixelRatio
        }

The camera app should honor those dimensions if you add them to contacts. If contacts just needs a 300x300 photo, it can ask for it in the pick activity and the camera will return one of that size. If you want to do the cropping yourself, you could set the maxFileSizeBytes property to a value like 200000 that should give you something like a 1 or 2mp image instead of a 5mp image.  That would save memory in both apps.

Changing the component of this bug to Contacts and setting needinfo for Francisco.
Component: Gaia::Camera → Gaia::Contacts
Flags: needinfo?(francisco)
We don't have a QRD device to test against.  We would need caf's help.  It appears that djf found an issue; removing needinfo on rkuhlman.
Flags: needinfo?(rkuhlman)
Attached file Pointer to PR 21955
Thanks David for the explanation.

Just went for the maxFileSize solution.
Attachment #8459172 - Flags: review?(jmcf)
Flags: needinfo?(francisco)
Assignee: nobody → francisco
Comment on attachment 8459172 [details] [review]
Pointer to PR 21955

thanks Francisco
Attachment #8459172 - Flags: review?(jmcf) → review+
Landed in master:

https://github.com/mozilla-b2g/gaia/commit/0114839afc44aa98ae87db91004835f16a49dcab
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Verified fix in flame 2.1 and 2.0:
----------------------------------
Camera doesn't run Out Of Memory (OOM) when taking a picture for a contact.
============================================================================

Environmental Variables:
Device: Flame 2.1 (319mb)
Build ID: 20140905000202
Gaia: 95e9b099aa89ded133e44014dd40b19dc0193c01
Gecko: 92a6bbdfd945
Version: 34.0a2
Firmware Version: v123
User Agent: Mozilla/5.0 (Mobile; rv:34.0) Gecko/34.0 Firefox/34.0


Environmental Variables:
Device: Flame 2.0 (319mb)
BuildID: 20140905000204
Gaia: 4627014cc5c5eeec894183866d4c57291302f8b8
Gecko: 2fae20afe1fa
Version: 32.0 (2.0)
Firmware: V123
User Agent: Mozilla/5.0 (Mobile; rv:32.0) Gecko/32.0 Firefox/32.0
Status: RESOLVED → VERIFIED
QA Whiteboard: [QAnalyst-Triage+] → [QAnalyst-Triage?]
Flags: needinfo?(pbylenga)
QA Whiteboard: [QAnalyst-Triage?] → [QAnalyst-Triage+]
Flags: needinfo?(pbylenga)
You need to log in before you can comment on or make changes to this bug.