WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
189822
Apache can return a corrupt manifest file while ManifestGenerator::store is running
https://bugs.webkit.org/show_bug.cgi?id=189822
Summary
Apache can return a corrupt manifest file while ManifestGenerator::store is r...
dewei_zhu
Reported
2018-09-21 02:14:50 PDT
Generating manifest.json should be transactional.
Attachments
Patch
(8.38 KB, patch)
2018-09-21 02:23 PDT
,
dewei_zhu
no flags
Details
Formatted Diff
Diff
Patch
(10.35 KB, patch)
2018-09-24 21:39 PDT
,
dewei_zhu
rniwa
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
dewei_zhu
Comment 1
2018-09-21 02:23:35 PDT
Created
attachment 350341
[details]
Patch
Ryosuke Niwa
Comment 2
2018-09-21 22:47:51 PDT
Comment on
attachment 350341
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=350341&action=review
r-. There are enough problems in this patch that I'd like to see another iteration.
> Websites/perf.webkit.org/ChangeLog:3 > + Updating file on perf-safari should be transactional between php and apache.
We shouldn't mention perf-safari. I've updated the bug title. Please update the change log as well.
> Websites/perf.webkit.org/public/api/measurement-set.php:41 > + $json = NULL;
Please declare these variables inside the loop. Also, there is no point in declaring $json.
> Websites/perf.webkit.org/public/api/measurement-set.php:55 > + $content['elapsedTime'] = $elapsed_time; > + $json = json_encode($content); > + generate_json_data_conditionally($cache_filename, $json, 'elapsedTime');
I don't think we want to rely on elapsedTime being the last item like this. Pass in $elapsed_time as the last argument to generate_json_data_conditionally instead: generate_json_data_conditionally($cache_filename, $content, $elapsed_time); It's better to invoke json_encode in generate_json_data_conditionally instead. Also, we should probably call this generate_json_data_if_needed to match the naming convention used elsewhere in WebKit.
> Websites/perf.webkit.org/public/include/db.php:65 > + $target_file_path = config_path('dataDirectory', $filename); > + $temp_file_path = tempnam(config_path('dataDirectory', ''), $filename . '-temp-');
Why do we need to make a temporary file before comparing the content?
> Websites/perf.webkit.org/public/include/json-header.php:17 > +function set_success(&$details = array()) {
This should be set_successful instead.
dewei_zhu
Comment 3
2018-09-24 14:43:10 PDT
Comment on
attachment 350341
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=350341&action=review
>> Websites/perf.webkit.org/public/api/measurement-set.php:55 >> + generate_json_data_conditionally($cache_filename, $json, 'elapsedTime'); > > I don't think we want to rely on elapsedTime being the last item like this. > Pass in $elapsed_time as the last argument to generate_json_data_conditionally instead: > generate_json_data_conditionally($cache_filename, $content, $elapsed_time); > It's better to invoke json_encode in generate_json_data_conditionally instead. > Also, we should probably call this generate_json_data_if_needed to match the naming convention used elsewhere in WebKit.
If do so, we need to make generate_json_date_conditinally returns an encoded json to void calling json_encode twice as it is needed in Lin 58.
Ryosuke Niwa
Comment 4
2018-09-24 15:21:53 PDT
Comment on
attachment 350341
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=350341&action=review
>>> Websites/perf.webkit.org/public/api/measurement-set.php:55 >>> + generate_json_data_conditionally($cache_filename, $json, 'elapsedTime'); >> >> I don't think we want to rely on elapsedTime being the last item like this. >> Pass in $elapsed_time as the last argument to generate_json_data_conditionally instead: >> generate_json_data_conditionally($cache_filename, $content, $elapsed_time); >> It's better to invoke json_encode in generate_json_data_conditionally instead. >> Also, we should probably call this generate_json_data_if_needed to match the naming convention used elsewhere in WebKit. > > If do so, we need to make generate_json_date_conditinally returns an encoded json to void calling json_encode twice as it is needed in Lin 58.
Yeah, that's fine.
dewei_zhu
Comment 5
2018-09-24 21:39:42 PDT
Created
attachment 350736
[details]
Patch
Ryosuke Niwa
Comment 6
2018-09-24 21:50:52 PDT
Comment on
attachment 350736
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=350736&action=review
> Websites/perf.webkit.org/ChangeLog:8 > + Updating a file on should be transactional between php and apache.
Updating a file *on* what??
> Websites/perf.webkit.org/ChangeLog:11 > + * public/api/measurement-set.php: Adapted invocation of 'generate_json_date_with_elapsed_time_if needed'.
Nit: Somehow the function name has a space instead of _ between if and needed.
> Websites/perf.webkit.org/ChangeLog:12 > + * public/api/runs.php: Adapted invocation of 'generate_json_date_with_elapsed_time_if needed'.
Ditto.
dewei_zhu
Comment 7
2018-09-26 23:30:37 PDT
Landed in
r236454
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug