Closed Bug 1200401 Opened 9 years ago Closed 8 years ago

[B2G][Music] Gaia Video player crash loading files from sdcard

Categories

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

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: rillian, Unassigned)

References

Details

(Keywords: foxfood)

Attachments

(1 file)

I copied a bunch of music and video files onto an sdcard and added it to my z3c device. The gaia music and video players didn't see the files when I launched them. Music said 'please add files to your sdcard' and Video just had a black page with the blue ant line crawling across the top.

Restarting didn't help.

I recorded a video on the device, and that shows in the Video app, but still none of the files I pre-loaded.

I just tried Music again and it imported 416 songs before getting stuck. Since then the album view is partially populated and the import spinner is still going with no further progress. I'd used foxcasts to save a podcast; maybe that unblocked something?

Do I need to do something special to bless media folders on a new sd card?
Can you make an image of the SDCard for us to test and reproduce?

Video != Music so we might want to clone this for the other app.
Flags: needinfo?(giles)
I don't seem to have the card reader with me today. I'll pull a dd image when I've brought it into work next. How can I get it to you? It's a 32GB card and I can't post the image publicly (it contains both confidential and non-free data).
Providing it privately is fine. In confidence.

I just need to be able to reproduce.
Passing dd image of the sdcard (competely device, including partition table) to hub privately. Hopefully that will allow reproduction.
Flags: needinfo?(giles)
Which version of gaia do you run?
Flags: needinfo?(giles)
I tried here and all the songs are imported into Music on "b2g desktop". This is gaia master.
BUT, there are a few issues with opus file album art popping a:

JavaScript error: app://music.gaiamobile.org/js/metadata/album_art_cache.js, line 298: Error: unknown picture flavor: undefined

This is because "picture" contain a base64 encoded blob of data and now what we are expecting.
Hmph. I've been testing with recent aries configs from the b2g master branch, most recently git commit 7d915992 built 20150902. How can I query the specific gaia version?

Did you try on an aries device? Did the video work as well?

I haven't checked the opus files for conformance, but opusenc uses the METADATA_BLOCK_PICTURE comment from the flac spec. See https://wiki.xiph.org/VorbisComment#METADATA_BLOCK_PICTURE for details. That's a separate bug, obviously.
Flags: needinfo?(giles)
I haven't tested on a device yet. That's the next step (I have to clobber my current 32GB SDcard for that)
(In reply to Ralph Giles (:rillian) from comment #7)
> I haven't checked the opus files for conformance, but opusenc uses the
> METADATA_BLOCK_PICTURE comment from the flac spec. See
> https://wiki.xiph.org/VorbisComment#METADATA_BLOCK_PICTURE for details.
> That's a separate bug, obviously.

Since Opus uses VorbisComments, the format *should* be the same as for Ogg Vorbis - which we have tests for - but I could be wrong. (Opus always seemed an odd choice for relatively-long, high-bitrate files anyway.)

(In reply to Hubert Figuiere [:hub] from comment #8)
> I haven't tested on a device yet. That's the next step (I have to clobber my
> current 32GB SDcard for that)

Could you let me know what you find when you test it out? I'd be interested to see what the issue is, and I'll probably have some free time to write a patch, since I'm just finishing up the search patch for NGA, and then I'll need to find something else to work on.
I have a 32GB card on its way. I'm not clobbering the one I use in the dogfooding phone, so it will take a few more days. But we'll get there.

The bug might be more subtle than we think the only two differences I see with testing on b2g-desktop and the device are:
1. we don't have the same codecs at all
2. different perf characteristic, like RAM available.

Definitely hard to draw conclusions when not testing on the device - I was hoping it would be easy.
I flashed a SD card with the content, and unlike on b2g-desktop, it stall at (1) when loading the content in Music. Kill Music, start over, it will continue until it reaches (413). And then hang again. Kill Music again and we are done. Not sure if there is everything, but this hang during scan isn't good.


At the first hang I only get this in the logcat:
I/Music   ( 5729): Content JS LOG: defaultAdapter changed. address:  
I/Music   ( 5729):     at onManagerAttributeChanged (app://music.gaiamobile.org/shared/js/bluetooth_helper.js:69:1)
W/Music   ( 5729): Content JS WARN: MediaDB: error parsing metadata for /sdcard1/sdcard/DCIM/100MZLLA/VID_0087.3gp : Error: Found video track in MP4 container 
W/Music   ( 5729):     at metadataError (app://music.gaiamobile.org/shared/js/mediadb.js:1916:1)
Also resource forks - from a video file. See bug 1186146.
Likely a dupe of bug 1191760

Will wait until we know more.
Bug 1191760 will track the fix for Music. I have teste it and it works. 

This bug will track Video.
Component: Gaia::Music → Gaia::Video
See Also: → 1191760
Summary: [B2G][Music] Gaia Music and Video players can't find files on sdcard → [B2G][Music] Gaia Video players can't find files on sdcard
Depends on: 1191760
The Music side of things has landed with bug 1191760. I you run master, please test.

Thanks,
Ralph, with the attached patch to the video app, Gecko (the video app instance) crashes when scanning your SD card. At least on Flame.
Assignee: nobody → hub
Status: NEW → ASSIGNED
Flags: needinfo?(giles)
#0  strlen () at bionic/libc/arch-arm/cortex-a15/bionic/strlen.S:83
#1  0xb6ec6692 in strlen (s=0x5a5a5a5a <Address 0x5a5a5a5a out of bounds>) at bionic/libc/include/string.h:217
#2  __vfprintf (fp=fp@entry=0xafb6a774, fmt0=0xb5586db7 "Configure video mime type: %s, widht:%d, height:%d", fmt0@entry=0xaff68180 'Z' <repeats 200 times>..., ap=...)
    at bionic/libc/stdio/vfprintf.c:625
#3  0xb6ec7990 in vsnprintf (str=<optimized out>, str@entry=0xafb6a7c4 "\003", n=n@entry=1024, fmt=fmt@entry=0xaff68180 'Z' <repeats 200 times>..., ap=..., ap@entry=...)
    at bionic/libc/stdio/vsnprintf.c:61
#4  0xb6efb40e in vsnprintf (ap=..., format=0xaff68180 'Z' <repeats 200 times>..., size=1024, dest=0xafb6a7c4 "\003") at bionic/libc/include/stdio.h:461
#5  __android_log_print (prio=3, tag=0xb5586a19 "GonkVideoDecoderManager", fmt=0xb5586db7 "Configure video mime type: %s, widht:%d, height:%d") at system/core/liblog/logd_write.c:220
#6  0xb4746b3a in mozilla::GonkVideoDecoderManager::codecReserved (this=0xaff68180) at /home/hub/source/mozilla/B2G-flame/gecko/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp:486
#7  0xb3d66c28 in apply<nsMemoryReporterManager, nsresult (nsMemoryReporterManager::*)()> (
    m=(nsresult (nsMemoryReporterManager::*)(nsMemoryReporterManager * const)) 0xb4746af1 <mozilla::GonkVideoDecoderManager::codecReserved()>, o=<optimized out>, this=<optimized out>)
    at ../../dist/include/nsThreadUtils.h:661
#8  nsRunnableMethodImpl<nsresult (nsMemoryReporterManager::*)(), true>::Run (this=<optimized out>) at ../../dist/include/nsThreadUtils.h:868
#9  0xb3d893e8 in mozilla::TaskQueue::Runner::Run (this=0xafe10d70) at /home/hub/source/mozilla/B2G-flame/gecko/xpcom/threads/TaskQueue.cpp:170
#10 0xb3d870c2 in nsThreadPool::Run (this=0xaffebae0) at /home/hub/source/mozilla/B2G-flame/gecko/xpcom/threads/nsThreadPool.cpp:231
#11 0xb3d86c44 in ProcessNextEvent (aResult=0xafb6ad1f, aMayWait=<optimized out>, this=0xaff601c0) at /home/hub/source/mozilla/B2G-flame/gecko/xpcom/threads/nsThread.cpp:874
#12 nsThread::ProcessNextEvent (this=0xaff601c0, aMayWait=<optimized out>, aResult=0xafb6ad1f) at /home/hub/source/mozilla/B2G-flame/gecko/xpcom/threads/nsThread.cpp:762
#13 0xb3d9816e in NS_ProcessNextEvent (aThread=<optimized out>, aMayWait=aMayWait@entry=true) at /home/hub/source/mozilla/B2G-flame/gecko/xpcom/glue/nsThreadUtils.cpp:277
#14 0xb3ee9a22 in mozilla::ipc::MessagePumpForNonMainThreads::Run (this=0xafeaae40, aDelegate=0xaff2a3e0) at /home/hub/source/mozilla/B2G-flame/gecko/ipc/glue/MessagePump.cpp:355
#15 0xb3eda840 in MessageLoop::RunInternal (this=this@entry=0xaff2a3e0) at /home/hub/source/mozilla/B2G-flame/gecko/ipc/chromium/src/base/message_loop.cc:234
#16 0xb3eda8f4 in RunHandler (this=0xaff2a3e0) at /home/hub/source/mozilla/B2G-flame/gecko/ipc/chromium/src/base/message_loop.cc:227
#17 MessageLoop::Run (this=this@entry=0xaff2a3e0) at /home/hub/source/mozilla/B2G-flame/gecko/ipc/chromium/src/base/message_loop.cc:201
#18 0xb3d8753a in nsThread::ThreadFunc (aArg=0xaff601c0) at /home/hub/source/mozilla/B2G-flame/gecko/xpcom/threads/nsThread.cpp:363
#19 0xb67b991a in _pt_root (arg=0xb0291700) at ../../../../../gecko/nsprpub/pr/src/pthreads/ptthread.c:212
#20 0xb6eac22c in __thread_entry (func=0xb67b9881 <_pt_root>, arg=0xb0291700, tls=0xafb6add0) at bionic/libc/bionic/pthread_create.cpp:105
#21 0xb6eac3c4 in pthread_create (thread_out=0xb05ffb04, attr=<optimized out>, start_routine=0xb67b9881 <_pt_root>, arg=0x78) at bionic/libc/bionic/pthread_create.cpp:224
#22 0xb026f400 in ?? ()
Cannot access memory at address 0x0
#23 0xb026f400 in ?? ()
Cannot access memory at address 0x0
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
Sotaro, gecko/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp seems to be where the crash is happening. Would you have an idea?
Flags: needinfo?(sotaro.ikeda.g)
bwu, can you investigate the crash?
Flags: needinfo?(sotaro.ikeda.g) → needinfo?(bwu)
Crash happens with Aries too.
Depends on: 1204672
(In reply to Sotaro Ikeda [:sotaro] from comment #20)
> bwu, can you investigate the crash?
Sure. 

Ralph, 
Could Pass your dd image of the sdcard to me?
Thanks!
Flags: needinfo?(bwu)
Only the contents of the "Videos" folder should be needed. I couldn't figure out which exact files where causing the crash. It is 12GB already.
As Hub says, stripping out the non-video files doesn't save much space. How can I reproduce the backtrace from comment #18? Maybe I can find the offending file.
Flags: needinfo?(giles)
Apply the PR above to the Video app in Gaia, install it and fire it up. It will just crash.
Flags: needinfo?(giles)
The video portion of this bug appears to be the same as bug 1198169.
Sounds like it.
Hub: in my testing in bug 1198169, the suspend event seems to be sent even on valid videos. I don't know what is causing the crash, but I can't fix the bug by adding onsuspend, because it is getting fired even for valid videos from the camera.

I'll probably try a timeout instead: if we don't get metadata loaded or error within 3 seconds or something I'll treat that as an error.
I don't think it is the right fix, but the crash is happening and that's not good by any stretch of imagination. The crash should be addressed first IMHO.
With the patch in bug 1198169 everything works better but we still trigger *a* crash in gecko.
Depends on: 1198169
I suspect the gecko thing is a separate bug. In any case, thanks to hub's help I can reproduce the stack trace from comment #18 in the debugger. I haven't been able to get the offending filename yet, but note that mozilla::GonkVideoDecoderManager::codecReserved is called from the nsMemoryReporterManager task queue, with what looks in general like garbage in the instance variables. It then crashes trying to dereference the nsAutoCString mMimeType, which is an invalid pointer.

STR:
cd b2g_checkout
cd gaia
[patch gaia]
APP=video make install-gaia (maybe doesn't work? first time I did a full build and ./flash.sh gaia)
cd ..
[connect device over usb]
adb root
./run-gdb.sh attach $(adb shell b2g-ps | awk '/Preallocated/ {print $5}')
[wait for gdb prompt...]
[optional: set breakpoint]
continue
[connect to device in WebIDE (check device screen for prompt)]
[Select installed 'Video' app, launch it.]
Flags: needinfo?(giles)
re-titling. Unassigning myself. This is for the Gecko bug.
Assignee: hub → nobody
Status: ASSIGNED → NEW
Summary: [B2G][Music] Gaia Video players can't find files on sdcard → [B2G][Music] Gaia Video player crash loading files from sdcard
Hub: with the patch from bug 1198169, and Jim's MediaDB patch to ignore dot files, are you able to figure out which video file is causing the crash? With your knowledge of Gaia debugging, you might be able to isolate the problem to a particular video more quickly than Ralph can.
Flags: needinfo?(hub)
Yes I'll try to figure out which exact file it is.
Flags: needinfo?(hub)
I could crash Video using the PR in attachement 8660778 with this file: /sdcard/DCIM/100MZLLA/VID_0087.3gp

But it doesn't crash with :djf fix for bug 1198169. - Need to figure that one out.

Ralph, can we pass it on to Blake if needed?
Flags: needinfo?(giles)
Flags: needinfo?(dflanagan)
Hmm. So maybe there is a bug in gecko where unloading a video right after a suspend event is fired causes a crash. I had thought that maybe there was some corrupt file causing the crash and that we weren't seeing it before because the video app was hanging on the dot files.  But if the video plays normally with the onsuspend thing, then maybe it is a simpler bug.
 
If we avoid using the suspend event in Gaia then this won't affect us. Something for the platform team to investigate, though.
Flags: needinfo?(dflanagan)
I haven't been able to pinpoint the other crash, the one with your fix. It is a crash like a memory corruption, and not 100% reproducible.
So I can't reproduce this any more now that bug 1198169 has landed. There was a gecko crash, but it seems to be avoided by not loading the dotfiles.

Blake, let me know if you're still interested in my 32GB image, in the meantime I've posted https://people.mozilla.org/~rgiles/2015/VID_0087.3gp which hub said reproduced the problem in comment #35.
Flags: needinfo?(giles)
Closing. Bug might have been fixed, but I'm not using the software any more.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: