Closed
Bug 861903
Opened 12 years ago
Closed 12 years ago
Avoid apps to write in indexed DB while device free storage is low
Categories
(Core :: Storage: IndexedDB, defect)
Tracking
()
People
(Reporter: ferjm, Assigned: bent.mozilla)
References
Details
Attachments
(2 files, 4 obsolete files)
(deleted),
patch
|
bent.mozilla
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
bent.mozilla
:
review+
|
Details | Diff | Splinter Review |
Bug 853350 is going to add a fanotify-based component that will notify about a low storage situation. We need to observe this notification and avoid any non-certified app to write in indexedDB until the low device storage situation is solved.
Reporter | ||
Updated•12 years ago
|
Blocks: low-storage
blocking-b2g: --- → tef?
Comment 1•12 years ago
|
||
Ben, can you dig in here?
Assignee: nobody → bent.mozilla
blocking-b2g: tef? → ---
Comment 2•12 years ago
|
||
Did you mean to unnom, minus, or +? Can't tell by comment 1 what the blocking call is.
Flags: needinfo?(jst)
Reporter | ||
Updated•12 years ago
|
blocking-b2g: --- → tef?
Reporter | ||
Comment 3•12 years ago
|
||
I guess Johnny meant to tef+.
IMHO this bug needs to block for the same reasons as for example bug 861920 and bug 861894.
Updated•12 years ago
|
blocking-b2g: tef? → tef+
Updated•12 years ago
|
Flags: needinfo?(jst)
Whiteboard: [status: no patch yet]
Reporter | ||
Updated•12 years ago
|
Summary: Avoid non-certified apps to write in indexed DB while device free storage is low → Avoid apps to write in indexed DB while device free storage is low
Updated•12 years ago
|
Whiteboard: [status: no patch yet] → [status: no patch yet, blocked on low storage work and kernel change]
Assignee | ||
Comment 4•12 years ago
|
||
This works for b2g18. Minimal changes, we're going to return a QuotaExceededError whenever we get into low disk mode. Depends on the patch in bug 853350. Also has a huge test.
Attachment #741306 -
Flags: review?(khuey)
Assignee | ||
Comment 5•12 years ago
|
||
That was an old patch. This is the right one.
Attachment #741306 -
Attachment is obsolete: true
Attachment #741306 -
Flags: review?(khuey)
Attachment #741307 -
Flags: review?(khuey)
Assignee | ||
Updated•12 years ago
|
Attachment #741307 -
Flags: review?(khuey) → review?(Jan.Varga)
Comment 6•12 years ago
|
||
Comment on attachment 741307 [details] [diff] [review]
Patch for mozilla-b2g18
Review of attachment 741307 [details] [diff] [review]:
-----------------------------------------------------------------
looks good, r=me
::: dom/indexedDB/OpenDatabaseHelper.cpp
@@ +1753,5 @@
> + NS_WARNING("Refusing to create database because disk space is low!");
> + return NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR;
> + }
> + }
> +
Nit: It seems there are only two callers of OpenDatabaseHelper::CreateDatabaseConnection() and the one in FileManager.cpp always calls it when the db file exists.
So the check added here could just live in OpenDatabaseHelper::DoDatabaseWork() I think.
But that's not a big deal.
Attachment #741307 -
Flags: review?(Jan.Varga) → review+
Assignee | ||
Updated•12 years ago
|
Attachment #741307 -
Attachment description: Patch for mozilla-b2g18 → Part 1: Add low disk space mode (mozilla-b2g18)
Assignee | ||
Comment 7•12 years ago
|
||
Now we need to make sure that we have a sane way to do error conversions from SQLITE_FULL to QuotaError. This is the groundwork for a messy patch that changes a bunch of |NS_ENSURE_SUCCESS(rv, NS_ERROR_INDEXEDDB_UNKNOWN_ERR)|...
Attachment #742312 -
Flags: review?(Jan.Varga)
Assignee | ||
Comment 8•12 years ago
|
||
Comment on attachment 742312 [details] [diff] [review]
Part 2: Simplify error compression (mozilla-b2g18)
It's not clear that we need this for b2g really... Let's wait on the review.
Attachment #742312 -
Flags: review?(Jan.Varga)
Updated•12 years ago
|
Target Milestone: --- → 1.0.1 IOT1 (10may)
Comment 9•12 years ago
|
||
FTR a "FreeSpaceWatcher" was created in Bug 818848 for the Webapps API. It was done in JS but I wonder if it's not possible to do it once (maybe in C++) and use it from everywhere it is needed.
Reporter | ||
Comment 10•12 years ago
|
||
The space watcher component created in Bug 818848 is using a polling mechanism to check for device space while an app is being installed. We decided not to use the same strategy for Bug 853350 as having a component continuously polling for device space would be bad for performance and battery consumption. We chose to use a real time notifications strategy based on fanotify. Check Bug 853350 for more details about it.
Also, Bug 863596 will change the Webapps FreeSpaceWatcher component to observe notifications triggered by the fanotify based component.
Comment 11•12 years ago
|
||
What are the next steps here?
Whiteboard: [status: no patch yet, blocked on low storage work and kernel change] → [status: has r+ patch, waiting on low storage work and kernel change]
Assignee | ||
Comment 12•12 years ago
|
||
Bug 853350 needs to land. And then I need to write a trunk patch (probably a different bug though).
Assignee | ||
Updated•12 years ago
|
Attachment #741307 -
Attachment description: Part 1: Add low disk space mode (mozilla-b2g18) → Patch for mozilla-b2g18
Assignee | ||
Comment 13•12 years ago
|
||
Merged to trunk.
Attachment #742312 -
Attachment is obsolete: true
Attachment #747566 -
Flags: review+
Reporter | ||
Comment 14•12 years ago
|
||
Comment on attachment 747566 [details] [diff] [review]
Patch for mozilla-central
Review of attachment 747566 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/indexedDB/IndexedDatabaseManager.cpp
@@ +119,5 @@
> + nsCOMPtr<nsIDiskSpaceWatcher> watcher =
> + do_GetService(DISKSPACEWATCHER_CONTRACTID);
> + if (watcher) {
> + bool lowDiskSpaceMode;
> + if (NS_SUCCEEDED(watcher->GetLowFreeSpace(&lowDiskSpaceMode))) {
You probably noticed this, but the idl for nsIDiskSpaceWatcher changed. So you have to s/GetLowFreeSpace/GetIsDiskFull
@@ +123,5 @@
> + if (NS_SUCCEEDED(watcher->GetLowFreeSpace(&lowDiskSpaceMode))) {
> + sLowDiskSpaceMode = lowDiskSpaceMode ? 1 : 0;
> + }
> + else {
> + NS_WARNING("GetLowFreeSpace failed!");
ditto
Reporter | ||
Comment 15•12 years ago
|
||
The same comments apply for the b2g18 patch
Updated•12 years ago
|
Whiteboard: [status: has r+ patch, waiting on low storage work and kernel change] → [status: has r+ patch, needs minor work, waiting on low storage work]
Assignee | ||
Comment 16•12 years ago
|
||
Updated for newer nsIDiskSpaceWatcher changes.
Attachment #741307 -
Attachment is obsolete: true
Attachment #748214 -
Flags: review+
Assignee | ||
Comment 17•12 years ago
|
||
Attachment #748218 -
Flags: review+
Assignee | ||
Updated•12 years ago
|
Attachment #747566 -
Attachment is obsolete: true
Assignee | ||
Updated•12 years ago
|
Whiteboard: [status: has r+ patch, needs minor work, waiting on low storage work] → [status: has r+ patch, waiting on low storage work]
Assignee | ||
Comment 18•12 years ago
|
||
Updated•12 years ago
|
Whiteboard: [status: has r+ patch, waiting on low storage work] → [status: needs uplift]
Comment 19•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/22a77fd7ab35
https://hg.mozilla.org/mozilla-central/rev/7a362c86108c
https://hg.mozilla.org/mozilla-central/rev/462c163822b3
https://hg.mozilla.org/mozilla-central/rev/c26ceab09064
https://hg.mozilla.org/mozilla-central/rev/ee537efbe1e2
https://hg.mozilla.org/mozilla-central/rev/8db9762409f4
Hilarity.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Comment 20•12 years ago
|
||
Ben, I'm going to leave this uplift for you since I have no confidence that the b2g18 patch attached here includes the fixes it took to get this compiling and I have no time to go through it today myself.
Assignee | ||
Comment 21•12 years ago
|
||
Turned the test on for most platforms.
https://hg.mozilla.org/integration/mozilla-inbound/rev/77b8505fdd33
Assignee | ||
Comment 22•12 years ago
|
||
status-b2g18:
--- → fixed
Comment 23•12 years ago
|
||
status-b2g18-v1.0.0:
--- → wontfix
status-b2g18-v1.0.1:
--- → fixed
status-firefox21:
--- → wontfix
status-firefox22:
--- → wontfix
status-firefox23:
--- → fixed
Whiteboard: [status: needs uplift]
Comment 24•12 years ago
|
||
Flags: in-testsuite+
Comment 25•11 years ago
|
||
lgtm on 1.01 with a partner build.
Tested in a similar fashion to what was done with appcache here - https://bugzilla.mozilla.org/show_bug.cgi?id=861894#c60.
Keywords: verifyme
You need to log in
before you can comment on or make changes to this bug.
Description
•