[v3] updater: helper exits 14 and 17 leave the app closed although the original exe is intact
Wails version family
v3
Exact Wails version
v3.0.0-beta.26 (pkg/updater; helper.go is identical on master, which already includes #6080)
Operating System
Windows (the same design applies elsewhere)
Description
In two helper failure paths the original executable is intact, but nothing is relaunched. The user is left with the app closed.
- Exit 14: the target exe is held open by another process without
FILE_SHARE_DELETEfor longer than the retry window (20 × 500 ms). All swap attempts fail, thenrestoreFromBackupstarts withos.RemoveAll(target), which hits the same lock and fails, so the helper returns 14 without launching anything. The target was never modified. - Exit 17: the parent takes longer than 30 s to exit, for example a slow
OnShutdown. The helper returns 17 and exits. The parent then finishes exiting, and nothing is running.
In both cases a working old exe is on disk. For the backup-copy failure, the helper already does the right thing ("The original is untouched; relaunch it instead of restoring a potentially incomplete backup").
To Reproduce
Exit 14:
- Start the app and stage an update.
- From another process, open the installed exe with
CreateFilesharingFILE_SHARE_READonly (noFILE_SHARE_DELETE), and hold it for 20 s. - Call
Restart(). The helper log shows 20 failed replace attempts, then "restore failed". Exit code 14, and no app is running. With the same lock held for only 3 s, the swap succeeds on attempt 7.
Exit 17:
- Register an
OnShutdownthat takes 35 s, then callRestart(). - The helper exits with 17 after 30 s, the app exits 5 s later, and nothing is running.
Expected behaviour
If the target was never replaced (all swap attempts failed, or the parent timeout was hit), relaunch the original exe, or at least try to. In the exit-14 path, skip RemoveAll(target) when the target is still the original.
Attempted Fixes
In our app: keep OnShutdown short, and run a small watchdog that relaunches the installed exe if no instance is running 60 s after Restart.
System Details
Windows 11 Pro 26200 (x64), Go 1.26.0, CGO_ENABLED=0, github.com/wailsapp/wails/v3 v3.0.0-beta.26. wails3 doctor was not run: the test app is built with plain go build.
Additional context
Related: #6134 (Linux EXDEV, which also leaves the user with no working binary). Killing the helper at any point (0 to 1000 ms, and during the parent's OnShutdown) never broke the install, which is good.
Source: wailsapp/wails