RESOLVED FIXED 89666
Separate WebKit2 instances use the same local storage
https://bugs.webkit.org/show_bug.cgi?id=89666
Summary Separate WebKit2 instances use the same local storage
Szilard Ledan
Reported 2012-06-21 08:18:39 PDT
WK1 uses separate temporary directories while WK2 does not. Similar to WK1, WK2 should also deal with own temporary directories.
Attachments
patch (3.67 KB, patch)
2012-06-21 08:19 PDT, Szilard Ledan
kbalazs: review-
patch (17.15 KB, patch)
2012-06-22 04:48 PDT, Szilard Ledan
kbalazs: review-
patch (4.60 KB, patch)
2012-06-27 08:39 PDT, Szilard Ledan
hausmann: review-
hausmann: commit-queue-
patch for ews (11.41 KB, patch)
2012-07-12 05:05 PDT, Szilard Ledan
buildbot: commit-queue-
patch for ews (12.99 KB, patch)
2012-07-25 08:41 PDT, Szilard Ledan
no flags
patch for ews (12.70 KB, patch)
2012-07-26 05:34 PDT, Szilard Ledan
buildbot: commit-queue-
patch for ews (15.36 KB, patch)
2012-08-13 06:13 PDT, Szilard Ledan
gustavo: commit-queue-
patch for ews (15.34 KB, patch)
2012-08-13 07:31 PDT, Szilard Ledan
hausmann: review-
hausmann: commit-queue-
patch (19.08 KB, patch)
2012-09-01 05:15 PDT, Szilard Ledan
no flags
patch v2 (19.54 KB, patch)
2012-09-10 00:30 PDT, Szilard Ledan
no flags
patch for ews (22.99 KB, patch)
2012-10-04 01:53 PDT, Szilard Ledan
buildbot: commit-queue-
patch (26.31 KB, patch)
2012-10-04 06:34 PDT, Szilard Ledan
buildbot: commit-queue-
patch (26.30 KB, patch)
2012-10-08 06:18 PDT, Szilard Ledan
hausmann: review+
hausmann: commit-queue-
patch for commit (26.45 KB, patch)
2012-10-15 02:50 PDT, Szilard Ledan
no flags
Szilard Ledan
Comment 1 2012-06-21 08:19:45 PDT
WebKit Review Bot
Comment 2 2012-06-21 08:21:25 PDT
Attachment 148807 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit2/ChangeLog', u'Source/WebKit..." exit_code: 1 Source/WebKit2/ChangeLog:1: ChangeLog entry has no bug number [changelog/bugnumber] [5] Tools/WebKitTestRunner/qt/TestControllerQt.cpp:41: Alphabetical sorting problem. [build/include_order] [4] Tools/WebKitTestRunner/qt/TestControllerQt.cpp:41: Alphabetical sorting problem. [build/include_order] [4] Tools/WebKitTestRunner/qt/TestControllerQt.cpp:56: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5] Tools/WebKitTestRunner/qt/TestControllerQt.cpp:56: Use 0 instead of NULL. [readability/null] [5] Tools/ChangeLog:1: ChangeLog entry has no bug number [changelog/bugnumber] [5] Source/WebKit2/Shared/qt/QtDefaultDataLocation.h:38: The parameter name "dataLocation" adds no information, so it should be removed. [readability/parameter_name] [5] Source/WebKit2/Shared/qt/QtDefaultDataLocation.cpp:35: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 8 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Balazs Kelemen
Comment 3 2012-06-21 08:37:49 PDT
Comment on attachment 148807 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=148807&action=review The idea is good but you need to polish the patch. Please listen to the style bot, and use check-webkit-style next time. (I did not mentioned style issues in the review.) > Source/WebKit2/ChangeLog:7 > + Reviewed by NOBODY (OOPS!). > + Normally we summarize the change in a few sentences here. > Source/WebKit2/Shared/qt/QtDefaultDataLocation.cpp:49 > + QString& s_dataLocation = globalDataLocation(); It's no more a static, so please remove the misleading s_ prefix. > Source/WebKit2/Shared/qt/QtDefaultDataLocation.cpp:65 > + QString& s_dataLocation = globalDataLocation(); ditto > Source/WebKit2/Shared/qt/QtDefaultDataLocation.h:36 > +QString& s_dataLocation(); What is this??? You don't use it anywhere. > Source/WebKit2/Shared/qt/QtDefaultDataLocation.h:38 > +QWEBKIT_EXPORT void setDataLocation(QString dataLocation); I would put this into global namespace. Maybe we could find a more expressing name, I'm not sure what could it be. setPersistentDataLocation maybe. (And than rename defaultDataLocation to persistentDataLocation and the files as well, in a following cleanup patch.) > Tools/WebKitTestRunner/qt/TestControllerQt.cpp:57 > + if (getenv("DUMPRENDERTREE_TEMP") != NULL) > + WebKit::setDataLocation(getenv("DUMPRENDERTREE_TEMP")); remove != NULL, and avoid calling qgetenv twice, please.
Balazs Kelemen
Comment 4 2012-06-21 08:38:45 PDT
> > > Source/WebKit2/Shared/qt/QtDefaultDataLocation.h:38 > > +QWEBKIT_EXPORT void setDataLocation(QString dataLocation); > And this needs a comment saying it is private api for WebKitTestRunner.
Szilard Ledan
Comment 5 2012-06-22 04:48:46 PDT
Created attachment 148997 [details] patch Thanks your advice. I fixed the patch.
Balazs Kelemen
Comment 6 2012-06-23 04:17:00 PDT
Comment on attachment 148997 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=148997&action=review I would like to see the change first, later we can do the renaming. So I would like you to upload a patch that contains only the behavioral change. > Source/WebKit2/ChangeLog:5 > + [Qt] Added a new API in the WebKit namespace > + for the WebKitTestRunner, which sets the DataDirectory. > + https://bugs.webkit.org/show_bug.cgi?id=89666 There should be the title of the bug, as prepare-changelog do it for you. You should not edit that part manually :) > Source/WebKit2/ChangeLog:13 > + I have renamed defaultDataLocation to persistentDataLocation. > + From now, with setPersistentDataLocation() we can set which > + directory should be used by WebKitTestRunner instead of the > + default one. Hence, parallelly run WKTRs don't use the same > + DataLocation. I would like to first do the behavior change, than the renamings in a following cleanup patch. It's hard to see from the history what has changed if you do it together. > Source/WebKit2/Shared/qt/QtPersistentDataLocation.cpp:63 > +QWEBKIT_EXPORT void setPersistentDataLocation(QString dataLocation) Please move it to global namespace, we don't use internal namespaces for API (even if it's private). > Tools/ChangeLog:6 > + [Qt] The WebKitTestRunner uses the default LocalStorage > + directory.If ther is the DUMPRENDERTREE_TEMP environment > + variables, use that, instead of the default. > + https://bugs.webkit.org/show_bug.cgi?id=89666 Changelog error again. Put your description below the default prologue generated by prepare-changelog. > Tools/WebKitTestRunner/qt/TestControllerQt.cpp:57 > + if (!qgetenv("DUMPRENDERTREE_TEMP").isNull()) > + WebKit::setPersistentDataLocation(qgetenv("DUMPRENDERTREE_TEMP")); Don't call qgetenv twice.
Szilard Ledan
Comment 7 2012-06-27 08:39:15 PDT
Balazs Kelemen
Comment 8 2012-06-27 09:23:18 PDT
Comment on attachment 149754 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=149754&action=review Looks good to me. > Source/WebKit2/Shared/qt/QtDefaultDataLocation.cpp:65 > +// It is private api for WebKitTestRunner API > Tools/WebKitTestRunner/qt/TestControllerQt.cpp:61 > + QString dumprendertreetemp = qgetenv("DUMPRENDERTREE_TEMP"); > + if (!dumprendertreetemp.isNull()) > + setPersistentDataLocation(dumprendertreetemp); dumpRenderTreeTemp
Simon Hausmann
Comment 9 2012-06-27 22:18:02 PDT
Comment on attachment 149754 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=149754&action=review I do think that the idea is good, but I don't think the implementation is correct. This is not an issue that is specific to the Qt port, so support for this should be present for all ports using WTR. And that appears to be the case, given that WTR's TestController.cpp already has code for reading the DUMPRENDERTREE_TEMP variable and then uses WKContextSetDatabaseDirectory to direct the databases to the location pointed to by the environment variable. I suspect that what's happening in our case is that we end up running our initialization code afterwards and over-write the previously set database directory - for example the PlatformWebView is created after the call to the C API. Consequently I think the cleanest fix would involve us correctly taking the existing cross-platform code path. > Source/WebKit2/ChangeLog:4 > + [Qt] Separate WebKit2 instances use the same local storage > + https://bugs.webkit.org/show_bug.cgi?id=89666 Can you elaborate a bit more (either in the changelog or bugzilla) what the _symptom_ is that you're trying to fix? Is this an issue when using NWRT with multiple WTR instances writing to the same directory? > Tools/ChangeLog:9 > + directory.If ther is the DUMPRENDERTREE_TEMP environment Space between punctuation and the If. And "ther" -> "there" :)
Szilard Ledan
Comment 10 2012-07-12 05:05:03 PDT
Created attachment 151914 [details] patch for ews
Build Bot
Comment 11 2012-07-12 05:11:58 PDT
Comment on attachment 151914 [details] patch for ews Attachment 151914 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/13198745
Build Bot
Comment 12 2012-07-12 05:33:09 PDT
Comment on attachment 151914 [details] patch for ews Attachment 151914 [details] did not pass win-ews (win): Output: http://queues.webkit.org/results/13208668
Szilard Ledan
Comment 13 2012-07-25 08:41:07 PDT
Created attachment 154367 [details] patch for ews
Balazs Kelemen
Comment 14 2012-07-26 02:30:40 PDT
Comment on attachment 154367 [details] patch for ews View in context: https://bugs.webkit.org/attachment.cgi?id=154367&action=review LGTM with the need of some fix. > Source/WebKit2/UIProcess/efl/WebContextEfl.cpp:52 > + notImplemented(); > + return ""; return String() > Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp:51 > + // FIXME: Implement > + return WTF::String(); I don't think you need WTF:: here. > Source/WebKit2/UIProcess/mac/WebContextMac.mm:-91 > + parameters.parentProcessName = [[NSProcessInfo processInfo] processName]; > > NSURLCache *urlCache = [NSURLCache sharedURLCache]; > - > - parameters.parentProcessName = [[NSProcessInfo processInfo] processName]; > - parameters.nsURLCachePath = [(NSString *)cachePath.get() stringByStandardizingPath]; You don't need to move the assigment of parentProcessName, it just adds noise to the patch. > Source/WebKit2/WebProcess/mac/WebProcessMac.mm:216 > - appendReadwriteSandboxDirectory(sandboxParameters, "NSURL_CACHE_DIR", parameters.nsURLCachePath); > + appendReadwriteSandboxDirectory(sandboxParameters, "NSURL_CACHE_DIR", static_cast<NSString*>(parameters.diskCacheDirectory)); Do you need to cast to NSString* here? Isn't appendRead... a webkit function that get's a String? > Source/WebKit2/WebProcess/mac/WebProcessMac.mm:264 > - if (!parameters.nsURLCachePath.isNull()) { > + if (!static_cast<NSString*>(parameters.diskCacheDirectory).isNull()) { > NSUInteger cacheMemoryCapacity = parameters.nsURLCacheMemoryCapacity; > NSUInteger cacheDiskCapacity = parameters.nsURLCacheDiskCapacity; You don't need the cast here. > Tools/WebKitTestRunner/TestController.cpp:315 > + // Can we remove it? > +// const char* path = libraryPathForTesting(); > +// if (path) { > +// Vector<char> databaseDirectory(strlen(path) + strlen("/Databases") + 1); > +// sprintf(databaseDirectory.data(), "%s%s", path, "/Databases"); > +// WKRetainPtr<WKStringRef> databaseDirectoryWK(AdoptWK, WKStringCreateWithUTF8CString(databaseDirectory.data())); > +// WKContextSetDatabaseDirectory(m_context.get(), databaseDirectoryWK.get()); > +// } I think we can. :)
Balazs Kelemen
Comment 15 2012-07-26 02:39:58 PDT
Adding API maintainers because this effects WebKit2 C API.
Szilard Ledan
Comment 16 2012-07-26 05:34:37 PDT
Created attachment 154618 [details] patch for ews Thanks for your advice!
Balazs Kelemen
Comment 17 2012-07-26 06:05:07 PDT
Comment on attachment 154618 [details] patch for ews View in context: https://bugs.webkit.org/attachment.cgi?id=154618&action=review > Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp:51 > + // FIXME: Implement > + return String(); Nit: missing a notImplemented() call.
Build Bot
Comment 18 2012-07-26 14:17:43 PDT
Comment on attachment 154618 [details] patch for ews Attachment 154618 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/13368050
Szilard Ledan
Comment 19 2012-08-13 06:13:50 PDT
Created attachment 157977 [details] patch for ews
Gustavo Noronha (kov)
Comment 20 2012-08-13 06:18:45 PDT
Comment on attachment 157977 [details] patch for ews Attachment 157977 [details] did not pass gtk-ews (gtk): Output: http://queues.webkit.org/results/13493071
Szilard Ledan
Comment 21 2012-08-13 07:31:36 PDT
Created attachment 157992 [details] patch for ews
Simon Hausmann
Comment 22 2012-08-23 23:09:31 PDT
Comment on attachment 149754 [details] patch Marking obviously obsolete attachmen to be obsolete :)
Simon Hausmann
Comment 23 2012-08-23 23:13:57 PDT
Comment on attachment 157992 [details] patch for ews View in context: https://bugs.webkit.org/attachment.cgi?id=157992&action=review This patch is missing a ChangeLog, which I suppose would provide an explanation as to why these changes are submitted? :) I'm particularly curious why the disk cache directory needs to be per DRT/WTR instance. > Source/WebKit2/UIProcess/mac/WebContextMac.mm:-95 > - ASSERT(!parameters.nsURLCachePath.isEmpty()); Technically this ASSERT should move somewhere else, shouldn't it? > Tools/WebKitTestRunner/TestController.cpp:320 > + WKContextSetDatabaseDirectory(m_context.get(), WKStringCreateWithUTF8CString(dumpRenderTreeTemp)); > + WKContextSetLocalStorageDirectory(m_context.get(), WKStringCreateWithUTF8CString(dumpRenderTreeTemp)); > + WKContextSetDiskCacheDirectory(m_context.get(), WKStringCreateWithUTF8CString(dumpRenderTreeTemp)); I think you need to store the strings created by WKStringCreate* in a RetainPtr to avoid them leaking.
Csaba Osztrogonác
Comment 24 2012-08-31 07:03:17 PDT
(In reply to comment #23) > (From update of attachment 157992 [details]) > I'm particularly curious why the disk cache directory needs to be per DRT/WTR instance. Because we would like to go forward and run layout tests parallel (https://bugs.webkit.org/show_bug.cgi?id=77730). It isn't a good thing if a WTR modifies another ones disk cache. For example purges it between tests, but the other one still uses it. It was implemented for WK1 long time ago and works fine. Additionally we run more bots on same machine (only one WK2 tester now because of this bug), and don't want to let a slave to break an other slaves disk cache.
Szilard Ledan
Comment 25 2012-08-31 07:24:01 PDT
(In reply to comment #23) > (From update of attachment 157992 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=157992&action=review > > This patch is missing a ChangeLog, which I suppose would provide an explanation as to why these changes are submitted? :) Sorry for the late response! These patches were only made for testing EWS, and I had the wrong intention that these patches need to be r=? and cq=? to test the EWS. I'm going to apply your recommendations and hints in the final patch (that will also contain ChangeLogs of course :) ). > > Source/WebKit2/UIProcess/mac/WebContextMac.mm:-95 > > - ASSERT(!parameters.nsURLCachePath.isEmpty()); > > Technically this ASSERT should move somewhere else, shouldn't it? From the final patch nsURLCachePath will be obsoleted. > > Tools/WebKitTestRunner/TestController.cpp:320 > > + WKContextSetDatabaseDirectory(m_context.get(), WKStringCreateWithUTF8CString(dumpRenderTreeTemp)); > > + WKContextSetLocalStorageDirectory(m_context.get(), WKStringCreateWithUTF8CString(dumpRenderTreeTemp)); > > + WKContextSetDiskCacheDirectory(m_context.get(), WKStringCreateWithUTF8CString(dumpRenderTreeTemp)); > > I think you need to store the strings created by WKStringCreate* in a RetainPtr to avoid them leaking. I'm going to do it.
Sam Weinig
Comment 26 2012-08-31 15:17:03 PDT
Removing [Qt] as this touches platform independent code.
Szilard Ledan
Comment 27 2012-09-01 05:15:43 PDT
Szilard Ledan
Comment 28 2012-09-10 00:30:36 PDT
Created attachment 163054 [details] patch v2
Andras Becsi
Comment 29 2012-09-10 03:37:44 PDT
Comment on attachment 163054 [details] patch v2 View in context: https://bugs.webkit.org/attachment.cgi?id=163054&action=review I think this patch is an improvement, though I still find the ChangeLog a bit too brief about the issue that is being fixed. > Source/WebKit2/ChangeLog:8 > + WebContext has been extended for the paralelly started WTRs to use *parallelly* > Source/WebKit2/ChangeLog:12 > + separate directories for their local storage. > + platformDiskCacheDirectory API has been added to the existing > + platformLocalStorageDirectory and platformDataBaseDirectory APIs. > + I think it would be good to explain a bit more why this change is needed and what the symptoms of the bug are. Probably also refer to https://bugs.webkit.org/show_bug.cgi?id=77730 and the special for Qt to run multiple run-webkit-test instances in parallel. > Source/WebKit2/Shared/WebProcessCreationParameters.h:-104 > // FIXME: These should be merged with CFURLCache counterparts below. > - String nsURLCachePath; > - SandboxExtension::Handle nsURLCachePathExtensionHandle; Following the FIXME comment to me it looks like the cfURLCachePath below is used for the same purpose on Windows as nsURLCachePath on Mac. Doesn't this patch also affect the need for cfURLCachePath on Windows?
Szilard Ledan
Comment 30 2012-10-04 01:53:03 PDT
Created attachment 167054 [details] patch for ews
Build Bot
Comment 31 2012-10-04 02:07:51 PDT
Comment on attachment 167054 [details] patch for ews Attachment 167054 [details] did not pass win-ews (win): Output: http://queues.webkit.org/results/14175021
Szilard Ledan
Comment 32 2012-10-04 06:34:42 PDT
Build Bot
Comment 33 2012-10-04 06:54:12 PDT
Szilard Ledan
Comment 34 2012-10-08 06:18:28 PDT
Simon Hausmann
Comment 35 2012-10-12 03:27:08 PDT
Comment on attachment 167530 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=167530&action=review I think the patch looks good. The only two issues I can find are the missing notImplemented() and the static_cast that appears to be unnecessary. Please fix those before landing :) (And I suppose this needs very careful perhaps manual landing, since it affects the quite a few ports) > Source/WebKit2/UIProcess/win/WebContextWin.cpp:107 > + // FIXME: not implemented! Use notImplemented(); here? > Source/WebKit2/WebProcess/mac/WebProcessMac.mm:271 > - RetainPtr<NSURLCache> parentProcessURLCache(AdoptNS, [[NSURLCache alloc] initWithMemoryCapacity:cacheMemoryCapacity diskCapacity:cacheDiskCapacity diskPath:parameters.nsURLCachePath]); > + RetainPtr<NSURLCache> parentProcessURLCache(AdoptNS, [[NSURLCache alloc] initWithMemoryCapacity:cacheMemoryCapacity diskCapacity:cacheDiskCapacity diskPath:static_cast<NSString*>(parameters.diskCacheDirectory)]); Why is the static_cast needed here? It seems that with diskPath:parameters.nsURLCachePath the nsURLCachePath as a String. With diskPath:static_cast<NSString*>(parameters.diskCacheDirectory) the diskCacheDirectory appears to be a String, too. So I don't understand why the cast is needed :)
Csaba Osztrogonác
Comment 36 2012-10-12 03:56:48 PDT
I tried the patch, but it seems WTR still uses this file: ~/.local/share/WebKitTestRunner/.QtWebKit/WebpageIcons.db Could you check it?
Balazs Kelemen
Comment 37 2012-10-12 04:36:48 PDT
(In reply to comment #36) > I tried the patch, but it seems WTR still uses this file: > ~/.local/share/WebKitTestRunner/.QtWebKit/WebpageIcons.db > > Could you check it? I guess we should override the icondatabase path as well. But it should not stop this patch from landing, we can do that in a follow-up.
Csaba Osztrogonác
Comment 38 2012-10-12 04:38:32 PDT
(In reply to comment #37) > (In reply to comment #36) > > I tried the patch, but it seems WTR still uses this file: > > ~/.local/share/WebKitTestRunner/.QtWebKit/WebpageIcons.db > > > > Could you check it? > > I guess we should override the icondatabase path as well. But it should not stop this patch from landing, we can do that in a follow-up. Sure, we can do it later.
Szilard Ledan
Comment 39 2012-10-15 02:50:45 PDT
Created attachment 168660 [details] patch for commit Thanks for your advice!
Csaba Osztrogonác
Comment 40 2012-10-16 01:43:10 PDT
Comment on attachment 168660 [details] patch for commit Clearing flags on attachment: 168660 Committed r131428: <http://trac.webkit.org/changeset/131428>
Csaba Osztrogonác
Comment 41 2012-10-16 01:43:23 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.