Closed Bug 1047228 Opened 11 years ago Closed 11 years ago

[dolphin] Camera stuck on starting video recording page after removing SD card before camera is ready to record

Categories

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

x86_64
Linux
defect
Not set
normal

Tracking

(blocking-b2g:1.4+)

RESOLVED WORKSFORME
blocking-b2g 1.4+

People

(Reporter: angelc04, Assigned: lianxiang.zhou)

References

Details

(Whiteboard: [sprd338473][partner-blocker][povb])

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #1036259 +++ Dolphin's SD card holder is on the side of the device. So user could remove it and insert another one easily. Steps to reproduce ----------------------------------------------------------------------- 0. Insert a SD card and set default storage to SD card 1. Launch Camera and start recording 2. Remove SD card --> “no memory card found” overlay appears. 3. Insert SD card quickly and tap on Home button 4. Launch Camera again 5. Try to start recording --> Recording cannot be started. It stuck on the starting recording page. According to partner developer, The problem is caused by following code. createVideoFilepath in file gaia/apps/camera/js/lib/storage.js Storage.prototype.createVideoFilepath = function(done) { // done is callback var videoStorage = this.video; createFilename(this.video, 'video', function(filepath) { var dummyFilepath = getDir(filepath) + 'tmp.3gp'; var blob = new Blob([''], { type: 'video/3gpp' }); var req = videoStorage.addNamed(blob, dummyFilepath); req.onsuccess = function(e) { // It only handles onsuccess case videoStorage.delete(e.target.result); done(filepath); }; }); }; If there is onerror, done(filepath) is unable to execute. The case in above STR is the onerror case. So Camera recording stuck on the starting recording page. Test build ------------------------------------------------------------------------------ Gaia 3feb37ee2ed2319c9e556728723a5517dc1663ea Gecko https://hg.mozilla.org/releases/mozilla-b2g30_v1_4/rev/2b5defe2d811 BuildID 20140731160213 Version 30.0 ro.build.version.incremental=320 ro.build.date=Fri Jul 25 13:40:20 CST 2014
[Blocking Requested - why for this release]: This is a partner certification blocker. And once this happens, user can only recover from restarting device.
blocking-b2g: --- → 1.4?
Note, this is a random issue. Reproduce rate is: 2/10
Summary: [dolphin] unable to take video after removing and insert SD card again → [dolphin] Camera stuck on starting video recording page after removing and insert SD card again [repro rate: 2/10]
Attached file Camera.log
STR in comment 0 is only one way to reproduce this issue. I reproduced it again without following steps above. When it happens, picture taken cannot be saved and video recording was unable to start. I also tried to kill Camera and re-launch. It does not work. Attached is adb log. The first time it appears is: 08-01 15:37 I already see this problem three times in two hours.
Gary, could you do a investigation here? Thanks.
Flags: needinfo?(gchen)
Sure, keep ni flag status for tracking.
Hi Viral and Vicent Liu, According to comment #0, |DeviceStorage| can not |addName()| as normal even app received |StorageChange| and brought up 'available' status to app. After investigating, if we re-insert sd-card and wait |StorageChange| event again and then camera works fine. Is it possible gecko fire wrong |StorageChange| status on this scenario? Could you help to take a look? Thanks.
Flags: needinfo?(vwang)
Flags: needinfo?(vliu)
Flags: needinfo?(gchen)
Use 2 different SD cards for testing in both dolphin/openC, and only found this issue in dolphin (in both SD cards). It should be dolphin issue only. One possible reason is the initial sequence of SD card is different. I can also reproduce this issue without pressing home button: Recording-> remove SD card -> insert SD card -> Recording We can try to figure out the difference in each time plug in/out. But I'm not sure if plugging out SD card when recording is a normal behaviour for end users.
Flags: needinfo?(vwang)
Also update the version I tested in openC. Gaia b7d36622c7df92c976c37520ccab25199c7ada91 Gecko 82790e4fc33c718dd40b1be489ff8c4a336bde45 BuildID 20140714143226 Version 30.0
Hi James: openC with v1.4 can work very well under the same scenario. Is it possible that slog issue? Or any kernel driver issue in dolphin?
Flags: needinfo?(james.zhang)
I'll try user build. Slog is disabled on user build.
Flags: needinfo?(james.zhang)
Flags: needinfo?(vliu)
ni on me to test with user pac.
Flags: needinfo?(pcheng)
I figured out a way to consistently reproduce this: 1. Start recording 2. quickly remove sd card "before recording start timing" 3. insert sd card and wait --> You will see camera stays on recording start page. And camera cannot start recording or save pictures. So this issue happens when user remove sd card when camera is not ready to record. I think slog might have some affection on Camera performance. So it's not that easier to do step 2 and reproduce on user build. But when the device memory consumption is huge, camera performance might become bad. So we can do step 2 easily. And this issue is reproduced.
Flags: needinfo?(pcheng)
Summary: [dolphin] Camera stuck on starting video recording page after removing and insert SD card again [repro rate: 2/10] → [dolphin] Camera stuck on starting video recording page after removing SD card before camera is ready to record
Peipei, good catch!
[Blocking Requested - why for this release]: Hi James, Can you please follow up this on your end?
Whiteboard: [sprd338473][partner-blocker] → [sprd338473][partner-blocker][povb]
Flags: needinfo?(james.zhang)
Gary, per comment 0, do you think we can add error handling to catch up the issue here?
Flags: needinfo?(gchen)
Hi Evelyn, Add error handling might make sense for me, but it relies on platform should bring up right status to APP. In this case, camera always get 'available' status from gecko even SD-Card can not write file. It means although we add error handling such as "show prompt dialog" or "get devices storage again", we still can not write file into SD-Card until FxOS restart or re-insert SD-Card. Maybe we can file a follow up bug for "error handling" and request UX input for this. Thanks.
Flags: needinfo?(gchen)
Note: I tested on both user build and userdebug build and found both versions have this problem. So it should not be slog's problem because user build disabled slog.
Since OpenC can work very well in v1.4 with the same scenario and this issue comes from gecko or hal by Gary's comment, please dolphin engineers keep studying it.
Assignee: nobody → ming.li
Flags: needinfo?(james.zhang)
Hi all, According to comment #16, I've just filed a gaia side follow up bug #1050097. But I wanna clarify again, even bug #1050097 is fixed, platform still need to return corrected SD-Card status to APP side. Thanks.
Hi James, Please track this at your end, thank you!
blocking-b2g: 1.4? → 1.4+
Once this happens , we can't write to the sdcard. With some simple test ,it shows : root@scx15_sp7715ga:/storage/sdcard0 # rm -r * rm failed for 29_7_2014_3.vcf, Read-only file system So, i think we need to investigate hot plugin of the sdcard. Our team will handle this.
sdcard is read only: /dev/block/vold/179:1 /mnt/media_rw/sdcard0 vfat ro,dirsync,nosuid,nodev,noexec,relatime,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
(In reply to Peipei Cheng from comment #12) > I figured out a way to consistently reproduce this: > 1. Start recording > 2. quickly remove sd card "before recording start timing" > 3. insert sd card and wait > --> You will see camera stays on recording start page. And camera cannot > start recording or save pictures. > > So this issue happens when user remove sd card when camera is not ready to > record. > > I think slog might have some affection on Camera performance. So it's not > that easier to do step 2 and reproduce on user build. > But when the device memory consumption is huge, camera performance might > become bad. So we can do step 2 easily. And this issue is reproduced. and this is different issue ,most likely a gaia issue. At this case , camera app seems can't receive the touch event. So no actions when touch. But the sdcard is mounted rightly. So for this case ,it can be resumed by long pressing home button and killing the camera app. Plz track this in a new bug.
(In reply to Ming from comment #23) > (In reply to Peipei Cheng from comment #12) > > I figured out a way to consistently reproduce this: > > 1. Start recording > > 2. quickly remove sd card "before recording start timing" > > 3. insert sd card and wait > > --> You will see camera stays on recording start page. And camera cannot > > start recording or save pictures. > > > > So this issue happens when user remove sd card when camera is not ready to > > record. > > > > I think slog might have some affection on Camera performance. So it's not > > that easier to do step 2 and reproduce on user build. > > But when the device memory consumption is huge, camera performance might > > become bad. So we can do step 2 easily. And this issue is reproduced. > > > and this is different issue ,most likely a gaia issue. At this case , camera > app seems can't receive the touch event. So no actions when touch. But the > sdcard is mounted rightly. > So for this case ,it can be resumed by long pressing home button and killing > the camera app. > Plz track this in a new bug. No, I think it's the same issue. Bcz when this happens, after re-launch, if I take picture, I can see pictures can be taken but unable to save. And if I record, the page will stay on recording page. So the touch even actually works.
(In reply to Peipei Cheng from comment #24) > (In reply to Ming from comment #23) > > (In reply to Peipei Cheng from comment #12) > > > I figured out a way to consistently reproduce this: > > > 1. Start recording > > > 2. quickly remove sd card "before recording start timing" > > > 3. insert sd card and wait > > > --> You will see camera stays on recording start page. And camera cannot > > > start recording or save pictures. > > > > > > So this issue happens when user remove sd card when camera is not ready to > > > record. > > > > > > I think slog might have some affection on Camera performance. So it's not > > > that easier to do step 2 and reproduce on user build. > > > But when the device memory consumption is huge, camera performance might > > > become bad. So we can do step 2 easily. And this issue is reproduced. > > > > > > and this is different issue ,most likely a gaia issue. At this case , camera > > app seems can't receive the touch event. So no actions when touch. But the > > sdcard is mounted rightly. > > So for this case ,it can be resumed by long pressing home button and killing > > the camera app. > > Plz track this in a new bug. > > No, I think it's the same issue. Bcz when this happens, after re-launch, if > I take picture, I can see pictures can be taken but unable to save. And if I > record, the page will stay on recording page. > > So the touch even actually works. And the reason why it stays on recording page is bcz, ffos tried to start recording automatically after SD card is plug in. But since the SD card is readonly, so it just stays on starting page forever.
(In reply to Peipei Cheng from comment #25) Hi peipei Hot plugin sdcard may cause the sdcard being mounted to read only . So STR in comment 12 also has some rate to reproduce the sdcard issue. But it has nearly 100% rate to cause the camera app having no action when touch ,and can resume by relaunch the app when the sdcard is still ok. This is what i see on my side. Plz check.
Depends on: 1050097
Let's focus on why the card is mounted as read-only first, it seems to be the main cause of both STRs. Ming, can your team please continue the investigation here and decide if that (card becoming read-only) is a problem?
lianxiang is on this bug
Assignee: ming.li → lianxiang.zhou
(In reply to Wayne Chang [:wchang] from comment #27) > Let's focus on why the card is mounted as read-only first, it seems to be > the main cause of both STRs. > > Ming, can your team please continue the investigation here and decide if > that (card becoming read-only) is a problem? There's an option "errors=remount-ro" in sdcard mount options. If we catch an error on sdcard mount, then it will try to mount on ro mode. In our mount&umount processes, we can see the that the slog's files and the camera's files cause umount waiting for 10s. We try to "stop slog", and test this case, then we can not get a "sdcard ro" error. And when a "sdcard ro" error caused, we "stop slog", all will be well. But as I said before, not only the slog file may cause the error, mybe the camera's file would be too, I am not sure. I am debugging for this.
The error is "FAT-fs (mmcblk0p1): error, clusters badly computed", but I did not find the cause.
<4>[ 7993.545483] c0 FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck. <3>[ 7999.739501] c0 FAT-fs (mmcblk0p1): error, clusters badly computed (721 != 673) <3>[ 7999.739521] c0 FAT-fs (mmcblk0p1): Filesystem has been set read-only Maybe umount take too long time, the the FAT get something wrong.
On my test, the sdcard get errors and then would be mounted on ro mode, it is none business of camera. Not start any app, just at homescreen, plug and unplug the sdcard, it would cause a ro errors all the same. So we can split the bug from the camera. Maybe we need a new bug to follow it.
Actually I don't think sd card can be brutely removed without the normal umount procedures. The internal MCU, ram and flash table in sd card is possible to crash by brute operation. The weak fat file system may be crashed, too, so the read-only is the only way to protect the whole fat file system from being seriously damaged and loss of all the content in the SD card.
Disable slog or user build can't reproduce this issue. WORKSFORME.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: