Bug 175055 - ResourceLoadStatisticsClassifierCocoa::singletonPredictionModel() should check the return value of storagePath() before attempting to load
Summary: ResourceLoadStatisticsClassifierCocoa::singletonPredictionModel() should chec...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: John Wilander
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-08-01 15:49 PDT by John Wilander
Modified: 2017-08-02 10:45 PDT (History)
5 users (show)

See Also:


Attachments
Patch (2.22 KB, patch)
2017-08-01 15:56 PDT, John Wilander
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews117 for mac-elcapitan (2.00 MB, application/zip)
2017-08-02 08:57 PDT, Build Bot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Wilander 2017-08-01 15:49:43 PDT
ResourceLoadStatisticsClassifierCocoa::singletonPredictionModel() should check the return value of storagePath() before attempting to load the model file.
Comment 1 John Wilander 2017-08-01 15:50:27 PDT
rdar://problem/32671352
Comment 2 John Wilander 2017-08-01 15:56:23 PDT
Created attachment 316906 [details]
Patch
Comment 3 Build Bot 2017-08-02 08:57:53 PDT
Comment on attachment 316906 [details]
Patch

Attachment 316906 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/4240177

New failing tests:
fast/dom/Window/HTMLBodyElement-window-eventListener-attributes.html
Comment 4 Build Bot 2017-08-02 08:57:55 PDT
Created attachment 316963 [details]
Archive of layout-test-results from ews117 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews117  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 5 David Kilzer (:ddkilzer) 2017-08-02 09:50:10 PDT
Comment on attachment 316906 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=316906&action=review

r=me since this resolves a thread-safety issue when creating corePredictionModel (since thread-safe C++ statics are disabled in WebKit), but I'm not sure it will resolve all potential causes of this crash.

Need to check if the CorePrediction API being used is also thread-safe when using the same model on more than one thread at the same time.

> Source/WebKit/Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp:111
> +        if (path.isEmpty())
> +            return;

You should add some WTFLogAlways() logging output here, too, if it's unexpected that this path will ever be empty.
Comment 6 David Kilzer (:ddkilzer) 2017-08-02 09:58:31 PDT
Comment on attachment 316906 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=316906&action=review

>> Source/WebKit/Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp:111
>> +            return;
> 
> You should add some WTFLogAlways() logging output here, too, if it's unexpected that this path will ever be empty.

Oops, John correctly pointed out this will get logged below on Line 119 if it fails, so no need to make a change here.
Comment 7 John Wilander 2017-08-02 10:16:52 PDT
Comment on attachment 316906 [details]
Patch

Failed layout test looks unrelated. Successfully ran it 50 times (with guard malloc).

Thanks for the review, Dave!
Comment 8 WebKit Commit Bot 2017-08-02 10:45:56 PDT
Comment on attachment 316906 [details]
Patch

Clearing flags on attachment: 316906

Committed r220136: <http://trac.webkit.org/changeset/220136>
Comment 9 WebKit Commit Bot 2017-08-02 10:45:57 PDT
All reviewed patches have been landed.  Closing bug.