Closed Bug 818909 Opened 12 years ago Closed 12 years ago

Bad behavior when installing hosted apps with app cache if the storage space is low

Categories

(Core Graveyard :: DOM: Apps, defect, P2)

ARM
Gonk (Firefox OS)
defect

Tracking

(blocking-basecamp:+)

RESOLVED DUPLICATE of bug 818848
B2G C3 (12dec-1jan)
blocking-basecamp +

People

(Reporter: julienw, Assigned: fabrice)

Details

STR:
* push a 2395140 kBytes (about 2.3 GB) file in /data
* "adb shell df /data" should report less than 8M free space (eg 6M)
* go to http://owapps.cloudfoundry.com with the browser
* install "big hosted app"
* accept the installation

expected:
* download begins
* download stops because of unsufficient space (we get the notification from system and the homescreen's icon is changing)
* all that was downloaded is discarded

(this actually happens when there is sufficient space and we interrupt the download by disabling the network for example)

actual:
* download begins
* download stops because of unsufficient space (we get the notification from system and the homescreen's icon is changing)
* nothing is discarded

Here is the not-so-useful logcat :

I/Gecko   (  109): -*-*- Webapps.jsm : Offlinecache setError to APP_CACHE_DOWNLOAD_ERROR
E/GeckoConsole(  407): [JavaScript Error: "UnknownError" {file: "app://homescreen.gaiamobile.org/js/state.js" line: 139}]
E/GeckoConsole(  407): [JavaScript Error: "AbortError" {file: "app://homescreen.gaiamobile.org/js/state.js" line: 142}]
E/GeckoConsole(  407): [JavaScript Error: "AbortError" {file: "app://homescreen.gaiamobile.org/js/state.js" line: 142}]
E/GeckoConsole(  407): [JavaScript Error: "AbortError" {file: "app://homescreen.gaiamobile.org/js/state.js" line: 142}]
E/GeckoConsole(  407): [JavaScript Error: "AbortError" {file: "app://homescreen.gaiamobile.org/js/state.js" line: 142}]
E/GeckoConsole(  109): [JavaScript Error: "UnknownError" {file: "app://homescreen.gaiamobile.org/js/state.js" line: 139}]
E/GeckoConsole(  109): [JavaScript Error: "AbortError" {file: "app://homescreen.gaiamobile.org/js/state.js" line: 142}]
E/GeckoConsole(  109): [JavaScript Error: "AbortError" {file: "app://homescreen.gaiamobile.org/js/state.js" line: 142}]
E/GeckoConsole(  109): [JavaScript Error: "AbortError" {file: "app://homescreen.gaiamobile.org/js/state.js" line: 142}]
E/GeckoConsole(  109): [JavaScript Error: "AbortError" {file: "app://homescreen.gaiamobile.org/js/state.js" line: 142}]

You can see the expected error at the beginning, and the various errors related to the fact that we have no space left after this.

I suspect this is related/caused by Bug 818848 but this is still bad that we don't discard the downloaded stuff, because this leaves the phone in a unusable state, so nominating BB+.
I just found that rebooting the phone discards the downloaded stuff, so the phone is not unusable after a reboot.
Fabrice is going to check with Honza about a potential workaround here.  The issue is that we don't know how big the appcache will be in advance.
Flags: needinfo?(fabrice)
I think that if we fix Bug 818848, this bug will be fixed automatically...
(In reply to Julien Wajsberg [:julienw] from comment #3)
> I think that if we fix Bug 818848, this bug will be fixed automatically...

No, because for appcache we don't know the size of the resources to download in advance.
Flags: needinfo?(fabrice)
in Bug 818848, there is two part, I should maybe open another bug.

I was talking about the 2nd part: interrupt the download before the partition is completely full, keeping a few megabytes.
Assignee: nobody → fabrice
blocking-basecamp: ? → +
Priority: -- → P2
Target Milestone: --- → B2G C3 (12dec-1jan)
Fabrice, is this going to make C3?
I think so.
Fernando, do we clear the offline cache storage when canceling an app cache download? If yes, this bug will be fixed by Bug 818848. I verified also that we remove partially downloaded packages.
I would say that we clear the offline cache when canceling the download, but I am not entirely sure as I didn't see it in the code, so I would ask Honza to confirm it.
Flags: needinfo?(honzab.moz)
Jason Duell has just confirmed it via IRC: "looks like Cancel marks mSucceeded=false, and then we throw away the cache result here: http://mxr.mozilla.org/mozilla-central/source/uriloader/prefetch/nsOfflineCacheUpdate.cpp#2132"
Flags: needinfo?(honzab.moz)
Does that mean this is fixed by bug 818848, or needs a fix here?
I think it should but I'd be able to test this on Monday if you like.
Just tested and this is WFM.   When I gobble up /data except for 5 MB, install fails, leaving an icon ("download big app": it fails the same way repeatedly if I click it) but no significant disk space is consumed, and I verified in the debugger that cache->Discard is called and that we still have 5 MB left.  

Once I removed 15 MB of space on /data the install works fine (takes up 8 MB of space).

I assume this was fixed by bug 818848 so marking as dupe for tracking purpose (seems better than setting fixed-19 flags, etc, here).
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.