fix(startup): pin the WebView2 profile, and retry without the GPU after a hang
His log reaches 'entering wails.Run' and stops: WebView2 is installed (120.0.2210.91) and never hands control back. A hang, not a failure — there is no error to report, so the two remaining causes have to be addressed rather than diagnosed. The profile folder is now named explicitly, on the LOCAL disk. Wails defaults it into the ROAMING profile, which on a managed account can be redirected to a share; a WebView2 profile on a share that is slow or gone does not fail, it hangs. Naming it also gives someone a folder they can be told to delete, which is the fix when the profile itself is corrupt. And a marker is written before the window is attempted, removed when it paints. Finding it at the next launch means the last one never got there, so that launch runs with GPU acceleration off: a WebView2 that cannot get on with the graphics driver hangs exactly like one that cannot start, and this is the single lever that separates them — at no cost on machines where it was never the problem.
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/wailsapp/wails/v2"
|
||||
"github.com/wailsapp/wails/v2/pkg/options"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
|
||||
wailswindows "github.com/wailsapp/wails/v2/pkg/options/windows"
|
||||
)
|
||||
|
||||
//go:embed all:frontend/dist
|
||||
@@ -162,6 +163,8 @@ func main() {
|
||||
bootLog("STUCK: 12 s after wails.Run and the window has not started — WebView2 never handed control back")
|
||||
fatalBox("OpsLog", startupStuckMessage)
|
||||
}()
|
||||
noteLaunchAttempt()
|
||||
bootLog("WebView2 profile: %q", webviewDataPath())
|
||||
bootLog("entering wails.Run (window %dx%d, state %v)", width, height, startState)
|
||||
err := wails.Run(&options.App{
|
||||
Title: "OpsLog",
|
||||
@@ -187,10 +190,28 @@ func main() {
|
||||
// graphite theme's background (#16181d), which is the default on a fresh
|
||||
// install — otherwise every launch flashes white first.
|
||||
BackgroundColour: &options.RGBA{R: 0x16, G: 0x18, B: 0x1d, A: 1},
|
||||
OnStartup: app.startup,
|
||||
OnDomReady: app.domReady,
|
||||
OnBeforeClose: app.beforeClose,
|
||||
OnShutdown: app.shutdown,
|
||||
// WEBVIEW2, pinned down.
|
||||
//
|
||||
// Its profile folder is normally chosen by Wails under the roaming
|
||||
// profile — a place that on a managed or redirected account can be slow,
|
||||
// locked or simply gone, and the failure mode is a creation that never
|
||||
// returns rather than an error. Naming it puts it on the local disk,
|
||||
// beside the startup log, where it can also be DELETED when it is the
|
||||
// thing that is broken.
|
||||
//
|
||||
// GPU acceleration is switched off only when the previous launch hung
|
||||
// (see stuckMarker): a WebView2 that cannot get on with the graphics
|
||||
// driver hangs exactly like one that cannot start at all, and this is the
|
||||
// one lever that separates the two — without costing anything on the
|
||||
// machines where it was never the problem.
|
||||
Windows: &wailswindows.Options{
|
||||
WebviewUserDataPath: webviewDataPath(),
|
||||
WebviewGpuIsDisabled: lastLaunchHung,
|
||||
},
|
||||
OnStartup: app.startup,
|
||||
OnDomReady: app.domReady,
|
||||
OnBeforeClose: app.beforeClose,
|
||||
OnShutdown: app.shutdown,
|
||||
Bind: []interface{}{
|
||||
app,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user