RESOLVED WONTFIX185568
[Curl] Move cookie header handling into background thread.
https://bugs.webkit.org/show_bug.cgi?id=185568
Summary [Curl] Move cookie header handling into background thread.
Basuke Suzuki
Reported 2018-05-11 16:35:21 PDT
For async (normal) request, current implementation add header for cookie and store back the cookie data on main thread. Move them into background thread to get better responsiveness.
Attachments
PATCH (11.03 KB, patch)
2018-05-11 16:56 PDT, Basuke Suzuki
ews-watchlist: commit-queue-
Archive of layout-test-results from ews204 for win-future (12.75 MB, application/zip)
2018-05-11 18:43 PDT, EWS Watchlist
no flags
PATCH (11.05 KB, patch)
2018-05-11 20:20 PDT, Basuke Suzuki
no flags
PATCH (11.06 KB, patch)
2018-05-11 22:19 PDT, Basuke Suzuki
no flags
Basuke Suzuki
Comment 1 2018-05-11 16:56:08 PDT
EWS Watchlist
Comment 2 2018-05-11 18:43:37 PDT
Comment on attachment 340232 [details] PATCH Attachment 340232 [details] did not pass win-ews (win): Output: http://webkit-queues.webkit.org/results/7656621 New failing tests: http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-video.html
EWS Watchlist
Comment 3 2018-05-11 18:43:47 PDT
Created attachment 340237 [details] Archive of layout-test-results from ews204 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews204 Port: win-future Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Basuke Suzuki
Comment 4 2018-05-11 20:20:49 PDT
Created attachment 340241 [details] PATCH Fix method name and add WEBCORE_EXPORT.
Basuke Suzuki
Comment 5 2018-05-11 22:19:18 PDT
youenn fablet
Comment 6 2018-05-13 15:03:01 PDT
Is it thread-safe to read/write cookies from different concurrent threads?
Basuke Suzuki
Comment 7 2018-05-13 15:32:36 PDT
Yes, our library embed the sqlite build with thread safe. The library itself can open a database as single thread mode, but WebKit interface doesn’t have an option to specify that flag so that there’s no worry about that mode on.
youenn fablet
Comment 8 2018-05-14 03:13:47 PDT
Comment on attachment 340244 [details] PATCH Some additional comments or questions. View in context: https://bugs.webkit.org/attachment.cgi?id=340244&action=review > Source/WebCore/platform/network/curl/CurlRequest.cpp:489 > +void CurlRequest::appendCookieHeader(HTTPHeaderMap& header) s/header/headers/ > Source/WebCore/platform/network/curl/CurlRequest.cpp:497 > + header.add(HTTPHeaderName::Cookie, appendedCookieField); From what I see, we are creating appendedCookieField in a background thread and we are adding it to a HTTPHeaderMap. Since the HTTPHeaderMap will be destroyed in the same background thread, this is probably fine. I wonder though whether this is not a bit fragile. For instance, adding some string value caching to cookieJar.cookieRequestHeaderFieldValue could potentially break this by keeping a ref to appendedCookieField in two different threads. Or if we were changing m_request http header fields, we might also end up being in trouble. > Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp:145 > + curlRequest->setAppendCookieHeader(true); Shouldn't cookie header handling be based on whether to use credentials or not? Shouldn't we use the storage session of the NetworkingContext instead of the default one? Not to say this should be handled in this patch.
Basuke Suzuki
Comment 9 2018-05-15 10:30:38 PDT
Youenn, besides the things you reviewed, we figured out the usage of SQLite in entire code base of WebKit is not 100% sure thread-safe. When I sent a patch 185616, mac-debug-build start failing with crashes. I guess it hit the assertion of libsqlite compiled with thread-support. We temporally give up this patch for a while.
Note You need to log in before you can comment on or make changes to this bug.