Closed Bug 1027001 Opened 10 years ago Closed 10 years ago

[B2G][Email] Attachment files download failed

Categories

(Firefox OS Graveyard :: Gaia::E-Mail, defect, P2)

ARM
Linux
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 845816
2.0 S5 (4july)

People

(Reporter: edchen, Assigned: jrburke)

Details

(Keywords: regression)

Attachments

(2 files)

Attached image Screenshot
[Environment]
Gaia      2402076e6299ab36f492eab17795478c9d2a7ad7
Gecko     https://hg.mozilla.org/releases/mozilla-aurora/rev/c41d7012974e
BuildID   20140617160202
Version   32.0a2
ro.build.version.incremental=94
ro.build.date=Tue May 20 09:29:20 CST 2014

[STR]
1. Set up google/yahoo account
2. Send a mail with attachment files
3. Receive the mail
4. Tap download button 

[Actual result]
1. Some normal files cannot download (Is it spec?)
2. music and jpg file download failed.
3. Logcat.txt

[Expected result]
All files can be download and preview it.

[Attachment]
1. Video : https://www.youtube.com/watch?v=Qqpl9SUVmj4
2. Screenshot
Attached file logcat.txt
blocking-b2g: --- → 2.0?
qawanted to check if this impacts other branches.
blocking-b2g: 2.0? → 2.0+
Keywords: qawanted, regression
Assignee: nobody → jrburke
Target Milestone: --- → 2.0 S5 (4july)
Looking at the logcat, I see a couple of "failed to save attachment to sdcard" messages. I will contact :edchen off list to have the email forward, so that I can try to reproduce. It could also be an issue with the sdcard. I'll also see if we can log a bit more information in that case.
Forward the sample mail to James.
Hey James,

Also you can setup Gmail account in your devices (flame).

=============================
Account: moztpeqa@gmail.com
pwd: mozillaqa!
=============================

Please find mail subject "attachment" which is a testing sample.
:edchen - Thanks for forwarding the email, I have marked this bug as confidential since you put in a name and password in the bug, and that would be publicly visible. In the meantime, I suggest that you change the password on that account, and then if I need access to it, I will contact you via private email to get the credentials. Once you confirm that the password has been changed then we can unmark this as a confidential bug.

Due to some work backlog and an upcoming country holiday on Tuesday, I do not expect to get to look more into this bug before Wednesday.
Group: mozilla-employee-confidential
Edward - Can you complete the QA Wanted request here? This is confidential, so QAnalysts won't be able to look at this.
Flags: needinfo?(edchen)
If :edchen can change the password on the above mentioned moztpeqa@gmail.com, then we can remove the confidential status on the bug.

As to the bug, there are two questions raised in the bug:

1) Why are the .doc, .pdf and .xlsx files not given an option to be downloaded at all?

Email only allows downloading basically image, video audio and vcard files, since there has not been a traditional way to view other files on the device. It is my understanding that the Download Manager, once fully implemented, would allow more flexibility in downloading of files. But the current restriction of just audio/video/image/vcard downloads has been the behavior for email for quite some time.

2) For the .jpg and .mp3 file, those can be downloaded, but when that is attempted, it fails. Why?

When I tried, it worked for me, so I suspect something to do with the specific sdcard state on the device, perhaps it was already close to being full. The errors in the supplied logcat:

06-18 18:32:35.794 I/Gecko   (11755): [33mWWAR: failed to save attachment to sdcard Header_Changes_Scope.jpg type: image/jpeg [0m

That message is generated by gelam's jobmixins:

https://github.com/mozilla-b2g/gaia-email-libs-and-more/blob/8cd48b189889c687d40659495c9764da82991232/data/lib/mailapi/jobmixins.js#L307

Unfortunately the error that causes the failure is no in the console statement, but it is in the structured logging pathway.

So, :edchen, could you try to reproduce the failure using the "secret debug mode" to capture the structurd log:

https://wiki.mozilla.org/Gaia/Email/SecretDebugMode

That would give us the specific error and what we need to guard against. 

My expectation though is that it is something like an "out of space" or "no sdcard" issue, and we may need provide a way to propagate the error up to the UI. 

Perhaps that would also help with bug 845816 and bug 847781. my understanding was that we were hoping the Download Manager would obviate the need for us to do this work, or rather we might have revisited while doing that work, but if the Download Manager is further off, we may need to do something sooner, particularly given the 2.0+ status of this bug. 

Asking :asuth if he has other background info or suggestions.
Flags: needinfo?(bugmail)
Re: point 2, it looks like the filename may be illegal on FAT32.  :jrburke, is it possible you were reproducing in a way that a better file-system was in use?  (ex, b2g-desktop where a fake-sdcard directory is used)

Specifically, the log excerpt shows:
===
06-18 18:19:23.724 I/Gecko   (11755): WWAR: failed to save attachment to sdcard 周杰倫【愛你沒差 官方完整MV】Jay Chou "Love you, no matter what
" MV.mp3 type: audio/mpeg
06-18 18:19:23.724 I/GeckoDump(11755): DeviceStorage: process save
06-18 18:19:24.014 I/Gecko   (11755): WWAR: failed to save attachment to sdcard 周杰倫【愛你沒差 官方完整MV】Jay Chou "Love you, no matter what
" MV-1403086763740.mp3 type: audio/mpeg
===

The bug there would likely be for the email app to perform a sanitization pass, although I guess a question is whether we can blame this on DeviceStorage or not; I haven't checked the spec yet.
Flags: needinfo?(bugmail)
I tested on the flame device using a master pull and build of gaia. I believe that the pvt nightly build that I used would have set up the file system and gecko part, that or the v122 base image I used as a baseline for the flame device.
Group: mozilla-employee-confidential
Flags: needinfo?(edchen)
Keywords: qawanted
We still need the branch checks here.
Keywords: qawanted
On :asuth's theory about possibly a file encoding issue, I logged in directly to the mozilla qa account and tried downloading. I did see some errors, but it seemed to recover on what I believe was a retry. 

Log (I downloaded the song first, then viewed it and started playing it in the music app, then downloaded the image):

I/Gecko   (15204): WLOG: queueOp 1 download
I/Gecko   (15204): WLOG: runOp(local_do: {"type":"download","longtermId":"1/B","lifecycle":"do","localStatus":"doing","serverStatus":null,"tryCount":0,"humanOp":"download","messageSuid":"1/0/27","messa)
I/Gecko   (15204): WLOG: runOp_end(local_do: {"type":"download","longtermId":"1/B","lifecycle":"do","localStatus":"doing","serverStatus":null,"tryCount":0,"humanOp":"download","messageSuid":"1/0/27","messa)
I/Gecko   (15204): 
I/Gecko   (15204): WLOG: runOp(do: {"type":"download","longtermId":"1/B","lifecycle":"do","localStatus":"done","serverStatus":"doing","tryCount":0,"humanOp":"download","messageSuid":"1/0/27","mes)
I/Gecko   (15204): WLOG: Downloaded 6271182 bytes of attachment data.
I/GeckoDump(15204): DeviceStorage: process save
I/Gecko   (15204): WWAR: failed to save attachment to sdcard 周杰倫【愛你沒差 官方完整MV】Jay Chou "Love you, no matter what" MV.mp3 type: audio/mpeg
I/GeckoDump(15204): DeviceStorage: process save
I/Gecko   (15204): WLOG: saved attachment to sdcard /sdcard/周杰倫【愛你沒差 官方完整MV】Jay Chou "Love you, no matter what" MV-1404357172191.mp3 type: audio/mpeg
I/Gecko   (15204): WLOG: runOp_end(do: {"type":"download","longtermId":"1/B","lifecycle":"do","localStatus":"done","serverStatus":"doing","tryCount":0,"humanOp":"download","messageSuid":"1/0/27","mes)
I/Gecko   (15204): 
I/GeckoDump(15204): LOG: trying to open sdcard,/sdcard/周杰倫【愛你沒差 官方完整MV】Jay Chou "Love you, no matter what" MV-1404357172191.mp3 type: audio/mpeg
I/GeckoDump( 4612): XXX FIXME : Got a mozContentEvent: activity-choice
I/Gecko   (19397): ###################################### forms.js loaded
I/Gecko   (19397): ############################### browserElementPanning.js loaded
I/Gecko   (19397): ######################## BrowserElementChildPreload.js loaded
I/GeckoDump(15204): LOG: "open" activity allegedly succeeded
E/GeckoConsole(15325): [JavaScript Error: "IndexSizeError: Index or size is negative or greater than the allowed amount" {file: "app://music.gaiamobile.org/gaia_build_defer_open.js" line: 203}]
I/Gecko   (15325): 
I/Gecko   (15325): ###!!! [Child][MessageChannel] Error: Channel closing: too late to send/recv, messages will be lost
I/Gecko   (15325): 
I/Gecko   (15204): WLOG: queueOp 1 download
I/Gecko   (15204): WLOG: runOp(local_do: {"type":"download","longtermId":"1/C","lifecycle":"do","localStatus":"doing","serverStatus":null,"tryCount":0,"humanOp":"download","messageSuid":"1/0/27","messa)
I/Gecko   (15204): WLOG: runOp_end(local_do: {"type":"download","longtermId":"1/C","lifecycle":"do","localStatus":"doing","serverStatus":null,"tryCount":0,"humanOp":"download","messageSuid":"1/0/27","messa)
I/Gecko   (15204): 
I/Gecko   (15204): WLOG: runOp(do: {"type":"download","longtermId":"1/C","lifecycle":"do","localStatus":"done","serverStatus":"doing","tryCount":0,"humanOp":"download","messageSuid":"1/0/27","mes)
I/Gecko   (15204): WLOG: Downloaded 1035674 bytes of attachment data.
I/GeckoDump(15204): DeviceStorage: process save
I/Gecko   (15204): WWAR: failed to save attachment to sdcard Header_Changes_Scope.jpg type: image/jpeg
I/GeckoDump(15204): DeviceStorage: process save
I/Gecko   (15204): WLOG: saved attachment to sdcard /sdcard/Header_Changes_Scope-1404357199192.jpg type: image/jpeg
I/Gecko   (15204): WLOG: runOp_end(do: {"type":"download","longtermId":"1/C","lifecycle":"do","localStatus":"done","serverStatus":"doing","tryCount":0,"humanOp":"download","messageSuid":"1/0/27","mes)
I/Gecko   (15204): 
I/GeckoDump(15204): LOG: trying to open sdcard,/sdcard/Header_Changes_Scope-1404357199192.jpg type: image/jpeg

So I will put in some logging to dump out the error for the first failure, and report back. I may not get to it until tomorrow though. :edchen, if you end up changing the password for the QA account, please feel free to send it privately to me to my mozilla.com address.
Please disregard my last post: it initially failed because I had already downloaded those files (under a different account) so it was just a naming conflict. The second save attempt with the different name worked. So I do not have any new helpful information to add.
Hm, so yeah, I got my flame out of my luggage and the internal storage is mounted as vfat too (as can be seen from "adb shell mount"), so I think :jrburke's analysis for case 2 is accurate.  As is case 1.  We have existing bugs covering all of these things (multiple ones in the case 2 case since there are many intersecting edge cases there).

So yeah, if :edchen can clarify if the sdcard was possibly full or corrupt or something else, that will let us dupe this bug appropriately or determine if it's something even more new and exotic.
[Update]

Hey,

I figure out the likely root cause, see my steps below:

(1) You have to plug in usb line to your phone
(2) Turn on "USB storage" (Settings -> USB storage)

After setup above 2 steps, you would download files failed.
Ah, yeah, if it's USB mounted we can't access DeviceStorage.  All the email app can do is have a usable error message (assuming there is a very specific exception we can key off of).  Bug 847781 or bug 845816 would generally be where the fix for this would come from.  We should probably update the subjects of one of them and consolidate.
So given that the user has to take even more, subtle actions via the Settings app USB storage enabling, and that can be in the same error class as removing the SD card, I am duping this to bug 845816. I updated the title of that bug and added a comment about providing a specific error to the user in the USB storage case.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
issue has been marked resolved
blocking-b2g: 2.0+ → ---
Keywords: qawanted
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: