Open Bug 930397 Opened 11 years ago Updated 1 year ago

Failure to handle error during writing to an almost full file system (Thunderbird saving an attachment/Firefox downloading)

Categories

(Toolkit :: Downloads API, defect, P3)

All
Linux
defect

Tracking

()

People

(Reporter: ishikawa, Unassigned)

References

(Blocks 1 open bug)

Details

When mozilla software tries to save an attachment or download a file to an almost full file system under linux and filling it up completely during copying, the error handling is not perfect in TB, and non-existent in FF. The latter is very bad IMHO. Tested with comm-central TB (local build) and Firefox (32bit and 64-bit). Preparation: 1MB filesystem. First the preparation of almost full partition. I create a 1MB filesystem. Create a 1MB filesystem (the actual file storage space is less because of the file system metadata.) Uses a file : /tmp/1MB-FILE to store the filesystem. a directory : /tmp/mount-1MB-volume to mount the filesystem. How to: Run the following series of commands. dd if=/dev/zero of=/tmp/1MB-FILE bs=1k count=1024 as a super user: losetup /dev/loop0 /tmp/1MB-FILE <--- assuming |/dev/loop0| is not used. mkfs -t ext2 /dev/loop0 <--- if in use, use |loop1|, |loop2|, etc. mkdir /tmp/mount-1MB-volume mount /dev/loop0 /tmp/mount-1MB-volume/ ls /tmp/mount-1MB-volume/ <--- should show only |lost+found|. chmod a+rwx /tmp/mount-1MB-volume <--- anyone can write back to ordinary user. ls -l /tmp/mount-1MB-volume/ <---- check that it is visible. df <---- it will show 1MB- available file space. Test and Failure Scenario. I: Thunderbird (comm-central local build. nsHelperAppDlg.js patched as in Bug 928250) Saving an attachment (/usr/lib/libc.a, 3+ MB) from a message to this /tmp/mount-1MB-volume., thus filling it up and we know, in advance, complete saving cannot be performed. EXPECTED: Error should be shown. What happens: This action caused an error: An error dialog is displayed (good!). The message in the dialog is as follows. --- beqin quote The download cannot be saved because an unknown error occurred. --- end quote Observation/Nits: Message is not adequate. I-(a) Minor nit: we are saving an attachment from an e-mail message to a local directory. "download" is not an appropriate term. I-(b) : The message is not clear enough. "Unknown"? I think we should tell the user the failure is caused by the full file system. I traced the shown message string to a C++ source file. There the return code value from lower-level routine is not analyzed at all and the above generic catch-all message is used always: IMHO, we should try to analyze the error code and try to show more user-friendly messages for common cases like this one. I-(c) And it leaves the unfinished save in the destination directory. ls -ltr /tmp/mount-1MB-volume/ total 1006 drwx------ 2 root root 12288 Oct 23 23:13 lost+found/ -rw------- 1 mtest2 mtest2 974848 Oct 23 23:15 libc.a <=== INCOMPLETE FILE drwxrwxrwx 3 root root 1024 Oct 23 23:15 ./ drwsrwsrwt 91 root root 32768 Oct 23 23:31 ../ I think we should either - remove it (?) completely, or - at least like many downloader does often, it should leave it with a name with a suffix that alerts the user that the file is still in transient state, and not complete: libc.a._download_ (?) or some such. I-(d) Since the error during writing is handled by a C++ file, it seems, the chage in nsHelperAppDlg.js discussed in Bug 928250 should have no bearing on this error message issue. II Firefox. No error warning at ALL! After the above test, I tested FF under 64-bit Debian GNU/linux. To my surprise, TB does not show any error message at all. It behaves worse than TB :-( Firefox :27.0a1 (nsHelperAppDlg.js unpatched) Saving a local file (3MB+) to the said /tmp/mount-1MB-volume EXPECTED: FF shows an error to alert the failure of download. What Happened Instead: FF does not show error at all when the target is full when the download starts. FF does not show error at all when the target is not full when the download starts. It does not seem to leave an incomplete file either (!?) Maybe FF detects that there is not enough space and decided not to save the file, but failed to tell the user that it has not saved it??? No warning/error at all. This is worse than TB :-( I noticed that the downloaded file list of FF which I can see after hitting the downward-arrow on the upper-right corner (pull-down) did not show the saved folder where the saving took place in the entry. I have learned that this lack of saved directory entry indicates a failure of download, but FF SHOULD issue proper error warning for such a major error!!! TIA Buggy behavior anyway.
Blocks: 435025
Depends on: 931720
I have filed bug 931720 so that the error to write to an almost full file system that fails the saving of an attachment properly returns NS_ERROR_FILE_DISK_FULL to FailedDownload() routine. With the patch in 931720, I could obtain the error properly. From a log of the patched thunderbird: WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x8052000A: file /new-hd1/extra/ishikawa/TB-3HG/NEW-COMMSRC/mozilla/toolkit/components/downloads/nsDownloadManager.cpp, line 3315 Warning: download failed.: module = 0x0000000d, code=0x0000000a module 0xd means NS_ERROR_MODULE_FILES, and code 0xa means NS_ERROR_DISK_FILE_FULL. So once the infrastructure is in place, we can use the low-level error code to decide what error message to show to the user. TIA
(In reply to ISHIKAWA, Chiaki from comment #0) > II Firefox. No error warning at ALL! > > > Firefox :27.0a1 (nsHelperAppDlg.js unpatched) > > Saving a local file (3MB+) to the said /tmp/mount-1MB-volume > > EXPECTED: FF shows an error to alert the failure of download. > Firefox 25.0 (that is updated on my Debian GNU/Linux 32 bit) showed different behavior. And history-sensitive behavior at that. FF 25.0 shows error dialog when the download failed. When /tmp/mount-1MB-volume is almost empty, trying to download a large file there resulted in "unknown" error dialog above. But on on the 2nd and subsequent try, it showed "there is not enough memory for executing the specified operation" pr some such error message... (I am using Japanese locale on this 32-bit installation and so the message shown actually is Japanese.) Just a data point. comm-central TB requires fix for better message anyway. TIA
Summary: Failure to handle error during writing to an almost full file system (TB saving an attachment/FF downloading) → Failure to handle error during writing to an almost full file system (Thunderbird saving an attachment/Firefox downloading)

In the process of migrating remaining bugs to the new severity system, the severity for this bug cannot be automatically determined. Please retriage this bug using the new severity system.

Severity: major → --

The severity field is not set for this bug.
:mak, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(mak)
Severity: -- → S3
Flags: needinfo?(mak)
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.