Opened 4 years ago

Last modified 10 months ago

#18292 assigned defect

staged updates fail on Windows

Reported by: mcs Owned by: mcs
Priority: Medium Milestone:
Component: Applications/Tor Browser Version:
Severity: Normal Keywords: TorBrowserTeam201702, tbb-update
Cc: brade, gk Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

On Windows, staged updates currently fail (I am not sure if they ever worked correctly, but I think they have not been working at least since MAR signing was introduced). The good news is that typically users do not notice the failure because the updater silently falls back to doing an in-place update. The failure occurs after the user restarts their browser to apply the update: switching to the staged copy that is under Browser/updated fails because files are in use under the Browser directory, and Windows does not allow a directory to be renamed if any open handles point to files within the directory or if any DLLs located in the directory are in use (at least that is my understanding based on my limited knowledge of system behavior on Windows).

To fix this we will need to do two things:
1) Copy updater.exe and the DLLs it uses into a temporary directory and run it from there.
2) Modify the updater.exe code to not open and hold onto a handle for a log file that is located under Browser/TorBrowser.

Because these changes will not be trivial to implement and test, I propose that for the stable branch of Tor Browser (5.5) we disable staged updates on Windows. That is a safe thing to do and it will speed up updates since currently updates are applied twice (one time to stage the update, which then fails, and a second time to do an in-place update, which succeeds). Of course we should fix this correctly for TB 6.0 and test it during one or more of our alpha cycles.

One challenge is knowing which of our bundled DLLs the updater depends on. The set of DLLs might change over time, and some components such as NSS load DLLs at runtime (so it is not just a matter of checking DLL dependencies by dumping linker info from updater.exe).

This ticket was split off from #18170.

Child Tickets

Change History (22)

comment:1 Changed 4 years ago by mcs

Keywords: TorBrowserTeam201602 added

comment:2 Changed 4 years ago by bugzilla

Create "Updater" folder in main TBB folder (next to "Browser" folder) and update like Mozilla.

(Aha, that's why HIPS detected overwrites before and after restart.)

comment:3 Changed 4 years ago by mcs

Keywords: TorBrowserTeam201602R added; TorBrowserTeam201602 removed
Status: newneeds_review

comment:4 Changed 4 years ago by gk

Keywords: TorBrowserTeam201602 added; TorBrowserTeam201602R removed
Status: needs_reviewassigned

Looks good to me. This is commit 3da3a2c4dc4a1d8313a3312025f5ca4dab2e242d on tor-browser-38.6.1esr-5.5-1. FWIW and to give some background: https://wiki.mozilla.org/Background_Updates. There it is detailed how this is probably implemented in Firefox itself (see: Replacing the existing installation).

Last edited 4 years ago by gk (previous) (diff)

comment:5 Changed 4 years ago by gk

Keywords: TorBrowserTeam201603 added; TorBrowserTeam201602 removed

comment:6 Changed 4 years ago by mcs

Keywords: TorBrowserTeam201604 added; TorBrowserTeam201603 removed

We left the month of March behind a couple of weeks ago.

comment:7 Changed 4 years ago by bugzilla

updater.ini

; This Source Code Form is subject to the terms of the Mozilla Public
; License, v. 2.0. If a copy of the MPL was not distributed with this
; file, You can obtain one at http://mozilla.org/MPL/2.0/.

; This file is in the UTF-8 encoding
; All strings must be less than 600 chars.
[Strings]
Title=Tor Browser Update
Info=Tor Browser is installing your updates and will start in a few moments…
MozillaMaintenanceDescription=The Mozilla Maintenance Service ensures that you have the latest and most secure version of Mozilla Firefox on your computer. Keeping Firefox up to date is very important for your online security, and Mozilla strongly recommends that you keep this service enabled.

; IMPORTANT: This file should always start with a newline in case a locale
; provided updater.ini does not end with a newline.
; Application to launch after an update has been successfully applied. This
; must be in the same directory or a sub-directory of the directory of the
; application executable that initiated the software update.
[PostUpdateWin]
; ExeRelPath is the path to the PostUpdateWin executable relative to the
; application executable.
ExeRelPath=uninstall\helper.exe
; ExeArg is the argument to pass to the PostUpdateWin exe
ExeArg=/PostUpdate

#9837

Last edited 3 years ago by bugzilla (previous) (diff)

comment:8 Changed 4 years ago by gk

Keywords: TorBrowserTeam201605 added; TorBrowserTeam201604 removed

Moving tickets

comment:9 Changed 4 years ago by gk

Keywords: TorBrowserTeam201606 added; TorBrowserTeam201605 removed

comment:10 Changed 3 years ago by gk

Keywords: TorBrowserTeam201607 added; TorBrowserTeam201606 removed

comment:11 Changed 3 years ago by gk

Keywords: TorBrowserTeam201608 added; TorBrowserTeam201607 removed

Moving items to August 2016.

comment:12 Changed 3 years ago by gk

Keywords: TorBrowserTeam201609 added; TorBrowserTeam201608 removed

Tickets for September.

comment:13 Changed 3 years ago by gk

Keywords: TorBrowserTeam201610 added; TorBrowserTeam201609 removed

Moving tickets to October.

comment:14 Changed 3 years ago by gk

Keywords: TorBrowserTeam201611 added; TorBrowserTeam201610 removed

Moving tickets over to November.

comment:15 Changed 3 years ago by gk

Keywords: TorBrowserTeam201612 added; TorBrowserTeam201611 removed

Moving tickets to December.

comment:16 Changed 3 years ago by gk

Keywords: TorBrowserTeam201701 added; TorBrowserTeam201612 removed

Moving our tickets to January 2017

comment:17 Changed 3 years ago by gk

Keywords: TorBrowserTeam201702 added; TorBrowserTeam201701 removed

Moving our tickets to Feb 2017.

comment:19 in reply to:  18 Changed 2 years ago by cypherpunks

Replying to gk:

Just found this while working on #16010: https://bugzilla.mozilla.org/show_bug.cgi?id=1370576 and https://bugzilla.mozilla.org/show_bug.cgi?id=1368600.

status-firefox-esr52: --- → unaffected

But also found
status-firefox-esr52: affected → wontfix
https://bugzilla.mozilla.org/show_bug.cgi?id=1362267

comment:20 Changed 2 years ago by mcs

I guess we are lucky that Tor Browser staged updates are already disabled on Windows. Reading https://bugzilla.mozilla.org/show_bug.cgi?id=1370576 was interesting but did not tell me the root cause; I guess no one really knows except maybe Microsoft who changed something in Windows 10.

comment:21 Changed 10 months ago by gk

Keywords: tbb-updater added

comment:22 Changed 10 months ago by gk

Keywords: tbb-update added; tbb-updater removed

Renaming keyword to make it a bit broader

Note: See TracTickets for help on using tickets.