I just discovered that on one of my friends phones Firefox Mobile has leaked 800 MB of Storage space: https://mail.mozilla.org/pipermail/mobile-firefox-dev/2013-November/000385.html There are at least three separate issues there that I'm going to file bugs on and mark them as blocking this one.
Cleaning up temp files is hard and bound to fail on edge cases like crash etc.. (Compare Thunderbird). OTOH, you don't want to ever leave such files behind. So you need more drastic solutions than "cleanup after use". Suggestions: * Avoid them altogether * Make a subdir, and ensure that all temp files, no matter which kind, are always placed there. This whole subdir will be deleted on close (not startup).
>This whole subdir will be deleted on close (not startup). There is no such thing as doing things on close in Android, and even for desktop this is something we're trying to get rid of (bug 662444).
Would it be possible to have the code make two temp directories - one for this session, another for the next - and each session flip from using one to the other? That way the contents of the not-in-use directory could be deleted without fear of deleting something that's in-use, and presumably be done at a point in time where its less likely to be bad/impossible, such as startup or shutdown. (Earlier would probably be better to try and clear Storage before any "no storage space" causing crashes prevent us from getting the chance to, if that's a concern.) We wouldn't even necessarily need to rely on storing any information about which directory should be used next session if we're worried about crashes stopping us from doing that and clearing up. We could simply choose one of the two at random, and then it won't be too many restarts before any cruft is cleared up (well, for most users, statistically speaking).
I've also encountered the bug when doing this, on my Motorola Defy+ (Android 2.3.6) / Firefox Mobile 27 (and earlier releases) : - uploading a large file (video) to a website - selecting the file to upload from the android source selector, choosing a source (stock Android cam or gallery app) - file will be fully copied into Firefox's data directory in /data/data/org.mozilla.firefox/ (file prefixed by tmp_) So that when uploading a few big files or many smaller files, my Android's internal space is full. Why does Firefox mobile need to copy the source file in its data directory, when it can access it directly from the source directory (/mnt/sdcard/dcim/... in the case of pictures and videos)?
Thanks for the report. We have a patch in-place to hopefully fix that issue over in bug 942611.