Bug 40074 - ApplicationCacheStorage::storeNewestCache() Crash WebKit when openDatabase(true) failed
Summary: ApplicationCacheStorage::storeNewestCache() Crash WebKit when openDatabase(tr...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-02 11:29 PDT by Lyon Chen
Modified: 2011-01-05 03:51 PST (History)
5 users (show)

See Also:


Attachments
patch for 40074 with coding style fix. (3.37 KB, patch)
2010-06-02 11:39 PDT, Lyon Chen
no flags Details | Formatted Diff | Diff
patch for 40074 with updated comments. (3.54 KB, patch)
2010-06-02 15:18 PDT, Lyon Chen
darin: review+
commit-queue: commit-queue-
Details | Formatted Diff | Diff
patch for 40074. (2.17 KB, patch)
2010-06-04 07:50 PDT, Lyon Chen
commit-queue: commit-queue-
Details | Formatted Diff | Diff
patch for 40074 with reviewer info updated (2.17 KB, patch)
2010-06-04 10:21 PDT, Lyon Chen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lyon Chen 2010-06-02 11:29:00 PDT
Right now in ApplicationCacheStorage.cpp when openDatabase(true) is called it always assume it will succeed, but it could fail, for example when appcache storage is set to a storage card and the storage card is now unplugged.

Plan to add m_database.isOpen() check after every openDatabase(true) call.
Comment 1 Lyon Chen 2010-06-02 11:39:17 PDT
Created attachment 57674 [details]
patch for 40074 with coding style fix.
Comment 2 Lyon Chen 2010-06-02 15:18:12 PDT
Created attachment 57708 [details]
patch for 40074 with updated comments.
Comment 3 Darin Adler 2010-06-02 17:48:35 PDT
Normally we require regression tests for fixes. Is there some way to test this? How did you test it?
Comment 4 Lyon Chen 2010-06-02 17:54:15 PDT
Hi, Darin, I actually got the crash first before I know this is an issue. I just set the storage location to somewhere nonexistent and then will get the crash without the fix.

(In reply to comment #3)
Comment 5 Darin Adler 2010-06-02 17:56:00 PDT
(In reply to comment #4)
> Hi, Darin, I actually got the crash first before I know this is an issue. I just set the storage location to somewhere nonexistent and then will get the crash without the fix.

I'm not sure I understand fully. Is there way to turn that into a test other people can run? Maybe something in DumpRenderTree?
Comment 6 Lyon Chen 2010-06-02 18:08:50 PDT
(In reply to comment #5)

I don't think we can test it with DumpRenderTree. And as there's no way to change the AppCache storage location of Chrome, Safari by user, I am not sure how to test this with these 2 browsers.
But for our test phone, I can use a SD card as AppCache location, and if that card is unplugged, then it will crash.
Comment 7 WebKit Commit Bot 2010-06-04 00:27:40 PDT
Comment on attachment 57708 [details]
patch for 40074 with updated comments.

Rejecting patch 57708 from commit-queue.

Failed to run "[u'/Users/eseidel/Projects/CommitQueue/WebKitTools/Scripts/svn-apply', u'--reviewer', u'Darin Adler', u'--force']" exit_code: 2
Parsed 2 diffs from patch file(s).
patching file WebCore/ChangeLog
Hunk #1 succeeded at 1 with fuzz 3.
patching file WebCore/loader/appcache/ApplicationCacheStorage.cpp
patch: **** malformed patch at line 65: @@ -742,6 +750,10 @@ bool ApplicationCacheStorage::storeNewestCache(ApplicationCacheGroup* group)


Full output: http://webkit-commit-queue.appspot.com/results/3101012
Comment 8 Lyon Chen 2010-06-04 07:50:24 PDT
Created attachment 57876 [details]
patch for 40074.

After reading the failed commit log, not sure exactly why it failed at line #65. But re-submit a new patch updated to newest master anyway.
Comment 9 WebKit Commit Bot 2010-06-04 10:16:47 PDT
Comment on attachment 57876 [details]
patch for 40074.

Rejecting patch 57876 from commit-queue.

Unexpected failure when landing patch!  Please file a bug against webkit-patch.
Failed to run "['./WebKitTools/Scripts/webkit-patch', '--status-host=webkit-commit-queue.appspot.com', 'land-attachment', '--force-clean', '--build', '--non-interactive', '--ignore-builders', '--build-style=both', '--quiet', 57876, '--test', '--parent-command=commit-queue', '--no-update']" exit_code: 1
Last 500 characters of output:
cgi?id=57876&action=edit
Fetching: https://bugs.webkit.org/show_bug.cgi?id=40074&ctype=xml
Processing 1 patch from 1 bug.
Cleaning working directory
Processing patch 57876 from bug 40074.
NOBODY (OOPS!) found in /Users/eseidel/Projects/CommitQueue/WebCore/ChangeLog does not appear to be a valid reviewer according to committers.py.
ERROR: /Users/eseidel/Projects/CommitQueue/WebCore/ChangeLog neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive).
Comment 10 Lyon Chen 2010-06-04 10:21:53 PDT
Created attachment 57892 [details]
patch for 40074 with reviewer info updated

Update patch for 40074 with correct reviewer info.
Comment 11 WebKit Commit Bot 2010-06-04 20:40:32 PDT
Comment on attachment 57892 [details]
patch for 40074 with reviewer info updated

Clearing flags on attachment: 57892

Committed r60729: <http://trac.webkit.org/changeset/60729>
Comment 12 WebKit Commit Bot 2010-06-04 20:40:38 PDT
All reviewed patches have been landed.  Closing bug.
Comment 13 Andrei Popescu 2011-01-05 03:51:42 PST
IMHO, I think this can be and should be tested with a layout test. This can be similar to how we test for the app cache hitting the maximum size:

http://trac.webkit.org/browser/trunk/LayoutTests/http/tests/appcache/max-size.html

One could add a method on the LayoutTestController to configure the storage location to some invalid path. I think that could trigger the bug.