The first startup after an update does main thread I/O to update.status several times
Categories
(Toolkit :: Application Update, enhancement, P3)
Tracking
()
Performance Impact | medium |
People
(Reporter: florian, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: perf:startup, Whiteboard: [fix suggestion in comment 8])
Updated•7 years ago
|
Comment 1•6 years ago
|
||
Comment 2•6 years ago
|
||
Reporter | ||
Comment 3•6 years ago
|
||
Comment 4•6 years ago
|
||
I'd like to work on this bug.
Reporter | ||
Comment 5•6 years ago
|
||
(In reply to Doug Thayer [:dthayer] from comment #2)
It seems like we could pass it as an
argument from the updater back to firefox.exe no[1]?
An environment variable might be even easier than a command line parameter.
Do you think this bug is ready for Abdelrahman to work on it?
Comment 6•6 years ago
|
||
Sure.
Along with the env variable the pref to indicate that an update was just successfully performed should be removed and the following code will need to check for the env variable exists and it will need to remove it when it does.
https://searchfox.org/mozilla-central/source/browser/components/BrowserContentHandler.jsm#140-179
Comment 7•6 years ago
•
|
||
Sorry, the pref check is actually here and the code in getPostUpdateOverridePage shouldn't need to be changed.
https://searchfox.org/mozilla-central/source/browser/components/BrowserContentHandler.jsm#564
Reporter | ||
Updated•6 years ago
|
Comment 8•6 years ago
|
||
I've been thinking about this a bit and I think the code can be changed as follows:
Replace the use of the app.update.postupdate pref in BrowserContentHandler.jsm with a check for if there is an activeUpdate for OVERRIDE_NEW_MSTONE and OVERRIDE_NEW_BUILD_ID. For the OVERRIDE_NEW_MSTONE case when there is an activeUpdate it can be passed to getPostUpdateOverridePage and when there isn't an activeUpdate it can just use the value of the startup.homepage_override_url pref.
https://searchfox.org/mozilla-central/source/browser/components/BrowserContentHandler.jsm#555-577
Remove the following from UpdateService.jsm
https://searchfox.org/mozilla-central/source/toolkit/mozapps/update/UpdateService.jsm#1889-1894
Replace the following so it just QI's the activeUpdate to nsIWritablePropertyBag.
https://searchfox.org/mozilla-central/source/browser/components/BrowserContentHandler.jsm#143-158
Comment 9•6 years ago
|
||
The above would of course load the updates.xml when the user has manually installed a different build ID / version. I think that is acceptable given the code simplification.
Comment 10•6 years ago
|
||
Florian, do you think the approach outlined in comment #8 and comment #9 would be acceptable?
Reporter | ||
Comment 11•6 years ago
|
||
I'm afraid I don't understand the suggestion in comment 8 (and sorry for the delay, I thought I had already commented here last week).
In case this helps, here is a profile of startup after an update, showing the main thread I/O we do: https://perfht.ml/2X4N4ve
Comment 12•6 years ago
|
||
This will make it so app update doesn't work with any files in post-update-processing which was only done so the pref would be set in time for the What New page code in BrowserContentHandler.jsm.
https://searchfox.org/mozilla-central/source/toolkit/mozapps/update/UpdateService.jsm#1885
It is a first step in lessening this without the need for the pref, env var, or command line arg. I may split that part of this out to a separate bug since there are several other improvements that can be made here.
Reporter | ||
Comment 13•6 years ago
|
||
(In reply to Robert Strong (Robert they/them) [:rstrong] (use needinfo to contact me) from comment #12)
Thanks! Seems like a good first step indeed.
Comment 14•5 years ago
|
||
Bug 1555088 won't work because there is another consumer of the pref which was added in bug 1389443. So, either that needs to be changed and bug 1555088 can move forward or another method will need to be devised.
Comment 15•5 years ago
|
||
(In reply to Robert Strong (Robert they/them) [:rstrong] (use needinfo to contact me) from comment #14)
Bug 1555088 won't work because there is another consumer of the pref which was added in bug 1389443. So, either that needs to be changed and bug 1555088 can move forward or another method will need to be devised.
I'm fairly sure that "we just updated" can be determined using different prefs, e.g. by setting some kind of flag in the code that reads and updates the buildid/version flags in https://searchfox.org/mozilla-central/source/browser/components/BrowserContentHandler.jsm#532-539 , and make that accessible using some kind of getter.
Reporter | ||
Comment 16•5 years ago
|
||
It would be good to have a central and easy to access way to check for "first startup on a fresh profile" and "first startup after an update" (and maybe even "first startup after a crash", but I don't have consummers in mind for that last one).
Comment 17•5 years ago
|
||
(In reply to :Gijs (he/him) from comment #15)
(In reply to Robert Strong (Robert they/them) [:rstrong] (use needinfo to contact me) from comment #14)
Bug 1555088 won't work because there is another consumer of the pref which was added in bug 1389443. So, either that needs to be changed and bug 1555088 can move forward or another method will need to be devised.
I'm fairly sure that "we just updated" can be determined using different prefs, e.g. by setting some kind of flag in the code that reads and updates the buildid/version flags in https://searchfox.org/mozilla-central/source/browser/components/BrowserContentHandler.jsm#532-539 , and make that accessible using some kind of getter.
The PdfJs.jsm code is using that pref before that code runs. I'm not saying there aren't ways, just that the way I thought would work that I filed that bug for won't because of that.
Comment 18•5 years ago
•
|
||
The Update Agent project will make it so updates are applied without running Firefox afterwards so it won't be possible to use an env var or a command line argument.
It might be acceptable to have bug 1389443 just check if the mstone version has changed instead of relying on the post update pref and then go with what I previously proposed. I suspect that it probably should already be doing that since that code won't run when a client that has manually updated by installing a newer version. If the code shouldn't run on downgrades it can just check if the version is greater.
edit the code for bug 1389443 also doesn't run for profiles that didn't perform the update and I think it isn't doing what I think the author thinks it is.
Comment 19•5 years ago
|
||
I talked with dthayer and he agrees with the assessment in comment #18 so I filed bug 1559195 to remove this use of the app.update.postupdate pref.
Comment 20•5 years ago
|
||
I'll go ahead and reopen / implement bug 1555088 after bug 1559195 is fixed.
Comment 21•5 years ago
|
||
:rstrong, do you know what's left to do here? It seems the startup tests still show us accessing this file, but the bugs in comment #20 are all marked fixed.
Comment 22•5 years ago
|
||
When there is an update in progress (should be rare on release) and after an update is applied (happens approximately 2 to 3 times on release depending on how many point releases there are) there is sync file IO for the update.status file during profile-after-change.
Comment 23•5 years ago
|
||
(In reply to Robert Strong [:rstrong] (Robert they/them - use needinfo to contact me) from comment #22)
When there is an update in progress (should be rare on release) and after an update is applied (happens approximately 2 to 3 times on release depending on how many point releases there are) there is sync file IO for the update.status file during profile-after-change.
Does this also happen for clean profiles, then? Maybe they get treated as the second case here? Otherwise I don't see why this is being tripped in the test... ( https://searchfox.org/mozilla-central/rev/7ed8e2d3d1d7a1464ba42763a33fd2e60efcaedc/browser/base/content/test/performance/browser_startup_mainthreadio.js#348-352 )
Comment 24•5 years ago
|
||
New profiles check if the old update directory needs to be migrated and creates the new update directory if it doesn't exist.
For all profiles, there is also a check if a file exists which informs the client whether there is an update in progress.
Comment 25•5 years ago
|
||
Florian captured another profile today where the file IO from the UpdateService was blocking the main thread in the parent process for ~1s.
Reporter | ||
Comment 26•5 years ago
|
||
(In reply to Mike Conley (:mconley) (:⚙️) (Wayyyy behind on needinfos) from comment #25)
Florian captured another profile today where the file IO from the UpdateService was blocking the main thread in the parent process for ~1s.
The syscall that blocked the main thread there was an fsync that I don't think is necessary. And what's also interesting in this profile is that the main thread I/O from the updater blocks the first network request of a page load, ie. this main thread I/O actively prevents the user from browsing.
Comment 27•5 years ago
|
||
We'll get to this as soon as we can.
Updated•5 years ago
|
Comment 28•3 years ago
|
||
The bug assignee didn't login in Bugzilla in the last 7 months.
:Amir, could you have a look please?
For more information, please visit auto_nag documentation.
Comment 29•3 years ago
|
||
It seems pretty safe to say that no one is currently working on this. The priority appears to already reflect this.
Updated•3 years ago
|
Updated•2 years ago
|
Description
•