Closed
Bug 334675
Opened 19 years ago
Closed 19 years ago
Notify user on async IO errors
Categories
(Core :: SQLite and Embedded Database Bindings, defect, P1)
Core
SQLite and Embedded Database Bindings
Tracking
()
RESOLVED
FIXED
mozilla1.8.1beta2
People
(Reporter: brettw, Assigned: brettw)
References
Details
(Keywords: fixed1.8.1)
Attachments
(2 files, 3 obsolete files)
11.65 KB,
patch
|
mconnor
:
approval1.8.1+
|
Details | Diff | Splinter Review |
9.62 KB,
patch
|
Details | Diff | Splinter Review |
When there is an asnycIO write error, we have already continued past that point, so it is impossible to return an error to the transaction that caused the write. We currently return errors for all future operations.
We should put a message up when this happens telling the user what the error was (if we can--some of the error codes are vague or could be many things) and telling them that they will need to restart the browser.
Comment 1•19 years ago
|
||
How about logging something to the JS console instead? This is mainly just to help with debugging places/storage, right?
Assignee | ||
Comment 2•19 years ago
|
||
This isn't for developers, it is to give better information to the user rather than just make parts of their browser break without telling them why. For example, if their disk is full or there is a write error due to some other reason.
Comment 3•19 years ago
|
||
Ah, I see. We have something like that for app update:
http://lxr.mozilla.org/mozilla/source/toolkit/locales/en-US/chrome/mozapps/update/updates.properties#67
I agree that it's a good idea to add something like this. It might still make sense to log more detailed error information to the JS console. Keep the prompt as simple as possible :)
Assignee | ||
Updated•19 years ago
|
Flags: blocking-firefox2?
Assignee | ||
Updated•19 years ago
|
OS: Linux → All
Priority: -- → P1
Hardware: PC → All
Target Milestone: --- → mozilla1.8.1beta1
Assignee | ||
Comment 4•19 years ago
|
||
Comment 5•19 years ago
|
||
Comment on attachment 222551 [details] [diff] [review]
Initial patch, no localizable strings
>+ nsCOMPtr<nsAsyncWriteErrorDisplayer> displayer(new nsAsyncWriteErrorDisplayer);
I've been using nsCOMPtr<nsIRunnable> in cases like this so that
we can share a little bit of code with other events when firefox
is statically linked :-)
Assignee | ||
Comment 6•19 years ago
|
||
I added a filename to the file structure so we can report the file with the error to the Javascript console. Unfortunately, the mrmory management around this is kind of a disaster, but I think I got it right.
Attachment #222551 -
Attachment is obsolete: true
Attachment #222564 -
Flags: first-review?(darin)
Comment 7•19 years ago
|
||
Comment on attachment 222564 [details] [diff] [review]
Patch
>Index: storage/src/mozStorageAsyncIO.cpp
>+#include "nsIProxyObjectManager.h"
not needed, right?
>+ nsCString* mFilename;
You could use placement new to avoid an extra heap allocation, and
then manually call the destructor :)
>+void DisplayAsyncWriteError();
Make this static
>+ nsCOMPtr<nsIConsoleService> consoleSvc =
>+ do_GetService("@mozilla.org/consoleservice;1", &rv);
>+ if (NS_FAILED(rv)) {
>+ NS_ERROR("Couldn't get the console service for logging file error");
nit: NS_ERROR results in an assertion. Maybe this should just be a
NS_WARNING since its not like a programmer's assumption failed?
>+ NS_ASSERTION(NS_SUCCEEDED(rv), "Couldn't log message on async error");
nit: NS_WARN_IF_FALSE
>+ nsCOMPtr<nsIPrompt> prompt = do_CreateInstance(
>+ "@mozilla.org/network/default-prompt;1", &rv);
nit: Use NS_DEFAULTPROMPT_CONTRACTID.
>+ nsCOMPtr<nsIRunnable> displayer(new nsAsyncWriteErrorDisplayer);
>+ if (! displayer) {
>+ NS_NOTREACHED("Unable to create displayer");
>+ return;
>+ }
>+ nsresult rv = NS_DispatchToMainThread(displayer);
>+ NS_ASSERTION(NS_SUCCEEDED(rv), "Can't call main thread");
Again, warnings preferred over failed assertions. NS_NOTREACHED
is not quite right since that code could be reached if we are
low on memory.
r=darin
Attachment #222564 -
Flags: first-review?(darin) → first-review+
Assignee | ||
Comment 8•19 years ago
|
||
Vlad: can you SR the additions to DOM, or should I get bsmedberg?
Attachment #222564 -
Attachment is obsolete: true
Attachment #222907 -
Flags: approval-branch-1.8.1?(vladimir)
Comment 9•19 years ago
|
||
Technically, any DOM changes should be reviewed by a DOM peer (see http://www.mozilla.org/owners.html); _however_, in this case we're just talking about a locale file...
Comment 10•19 years ago
|
||
Yeah, it just lives in dom/locales because that's where all gecko stuff goes. It should still be considered part of the storage "module" for review purposes.
Updated•19 years ago
|
Flags: blocking-firefox2? → blocking-firefox2+
Comment 11•19 years ago
|
||
Comment on attachment 222907 [details] [diff] [review]
Patch addressing darin's review
>Index: dom/locales/en-US/chrome/storage.properties
>===================================================================
>+storageWriteError=There was an error writing data to the disk. This error is sometimes caused by a full disk.\n\nPlease restart Firefox
You really want to use brandShortName here...
Assignee | ||
Updated•19 years ago
|
Whiteboard: has patch, waiting for a=
Updated•19 years ago
|
Attachment #222907 -
Flags: approval-branch-1.8.1?(vladimir) → approval1.8.1?
Comment 12•19 years ago
|
||
Comment on attachment 222907 [details] [diff] [review]
Patch addressing darin's review
This shouldn't say Firefox in the string, and because the string lives in dom, we can't even use brandShortName. Change "Firefox" to "this application" and file a followup on overriding the string from app/toolkit-land.
Attachment #222907 -
Flags: approval1.8.1? → approval1.8.1+
Assignee | ||
Updated•19 years ago
|
Whiteboard: has patch, waiting for a= → need checkin
Updated•19 years ago
|
Target Milestone: mozilla1.8.1beta1 → mozilla1.8.1beta2
Comment 13•19 years ago
|
||
Brett, is this patch still good to go?
Whiteboard: need checkin → [checkin needed]
Assignee | ||
Comment 14•19 years ago
|
||
I think so, I can't remember it very well.
Assignee | ||
Comment 15•19 years ago
|
||
Fixed on trunk. Leaving open for branch checkin, which I'll do if there are no trunk regressions.
Whiteboard: [checkin needed]
Assignee | ||
Comment 16•19 years ago
|
||
(In reply to comment #12)
> Change "Firefox" to "this application" and
> file a followup on overriding the string from app/toolkit-land.
I filed bug 345880 for this.
Blocks: 345880
Updated•19 years ago
|
Whiteboard: [checkin needed (1.8 branch)]
Assignee | ||
Comment 17•19 years ago
|
||
This has all new event triggering code because it turns out the code I used didn't work on Branch. I would like to get this new event code reviewed.
Attachment #231159 -
Flags: first-review?(darin)
Comment 18•19 years ago
|
||
Comment on attachment 231159 [details] [diff] [review]
Branch patch
>Index: storage/src/mozStorageAsyncIO.cpp
...
>+PR_STATIC_CALLBACK(void)
>+DestroyWriteErrorDisplayerPLEvent(PLEvent* aEvent)
>+{
>+}
I think this leaks memory because it does not delete the
nsAsyncWriteErrorDisplayer object in the case where the event
is successfully handled. I think you should remove the "delete
displayer" call from DisplayAsyncWriteError into
DestroyWriteErrorDisplayerPLEvent. Be sure to cast aEvent to
nsAsyncWriteErrorDisplayer* before deleting it.
r=darin with that fixed
Attachment #231159 -
Flags: first-review?(darin) → first-review+
Updated•19 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 19•19 years ago
|
||
Attachment #231159 -
Attachment is obsolete: true
Assignee | ||
Comment 20•19 years ago
|
||
Fixed on branch.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Keywords: fixed1.8.1
Resolution: --- → FIXED
Whiteboard: [checkin needed (1.8 branch)]
Updated•1 year ago
|
Product: Toolkit → Core
You need to log in
before you can comment on or make changes to this bug.
Description
•