wails
wails copied to clipboard
Blank window
Description
Yesterday my app worked just fine. This morning, after making no changes to the code, I executed wails dev and it resulted in a full gray window. However when I randomly move my mouse on the window I can see the tooltips of my app.
Can't even open the dev tools in the wails window. Works in the browser though (wails dev --browser).
My main.go does correctly include the assets:
//go:embed frontend/dist
var assets embed.FS
Wails dev output:
INF | Serving assets from frontend DevServer URL: http://localhost:5173/
Overriding existing handler for signal 10. Set JSC_SIGNAL_FOR_GC if you want WebKit to use a different signal
DEB | [DevWebServer] Serving DevServer at http://localhost:34115
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
Failed to create GBM buffer of size 800x800: Permission denied
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
Failed to create GBM buffer of size 800x800: Permission `denied`
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
Failed to create GBM buffer of size 800x800: Permission denied
When I try to run the binary after building:
Overriding existing handler for signal 10. Set JSC_SIGNAL_FOR_GC if you want WebKit to use a different signal
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
Failed to create GBM buffer of size 800x800: Permission denied
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
Failed to create GBM buffer of size 800x800: Permission denied
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
Failed to create GBM buffer of size 800x800: Permission denied
Failed to create EGL images for DMABufs with file descriptors -1, -1 and -1
dom ready
My coworker's output:
└──>>> Wed Oct 11 - 12:44:28 $ ./build/bin/testwebkit
Overriding existing handler for signal 10. Set JSC_SIGNAL_FOR_GC if you want WebKit to use a different signal
src/nv_gbm.c:99: GBM-DRV error (nv_gbm_bo_create): DRM_IOCTL_NVIDIA_GEM_ALLOC_NVKMS_MEMORY failed (ret=-1)
Failed to create GBM buffer of size 1024x768: Invalid argument
src/nv_gbm.c:99: GBM-DRV error (nv_gbm_bo_create): DRM_IOCTL_NVIDIA_GEM_ALLOC_NVKMS_MEMORY failed (ret=-1)
Failed to create GBM buffer of size 1024x768: Invalid argument
src/nv_gbm.c:99: GBM-DRV error (nv_gbm_bo_create): DRM_IOCTL_NVIDIA_GEM_ALLOC_NVKMS_MEMORY failed (ret=-1)
Failed to create GBM buffer of size 1024x768: Invalid argument
Failed to create EGL images for DMABufs with file descriptors -1, -1 and -1
To Reproduce
wails init -n testwebkit
wails dev
Expected behaviour
I expect a properly working Wails app window
Screenshots
wails dev --browser
Attempted Fixes
Remove webkit packages. Break my system. Cry. Reinstall webkit. Reinstall Gnome. No solution.
System Details
Me: Kubuntu 22.04 Wails v2.4.1 Vite v3.1.8 Webkit: libwebkit2gtk-4.0-37 libwebkit2gtk-4.0-dev
My co-worker who has the same issue: Arch Linux (kernel: 6.5.6-arch2-1) Wails v2.6.0 Webkit: webkit2gtk 2.42.1-1 webkit2gtk-4.1 2.42.1-1 webkitgtk-6.0 2.42.1-1
Additional context
Similar to #2975 and #9
Same issue for every Wails project (with this Archlinux config). Not just for a new created project.
I wonder if your systems silently upgraded some deps. There's no reason anything should change overnight with your code or deps....
Have you tried disabling compositing? https://bugs.webkit.org/show_bug.cgi?id=180739
You could also adjust this: https://wails.io/docs/reference/options/#webviewgpupolicy
linux.WebviewGpuPolicyNever does the job . However I will keep looking into it to find a solution that doesn't require disabling hardware acceleration. Could you leave this issue open ?
Thank you !
https://github.com/elementary/browser/discussions/104 https://retropie.org.uk/forum/topic/24436/drm_ioctl_mode_create_dumb-failed-cannot-allocate-memory
What will be the permanent fix?
Standardisation in Linux distros 😅
I saw similar issue when open my cisco anyconnect client. so I search the error and I found this. I have a WAR that use WEBKIT_DISABLE_DMABUF_RENDERER=1 /opt/cisco/anyconnect/bin/vpnui or export WEBKIT_DISABLE_DMABUF_RENDERER=1 before launch the application. I'm managing to find a thorough solution.
Thanks for the info. Sounds like an ecosystem wide issue 😞
If anyone who is having the issue is comfortable with local Dev, then setting this environment in this function might fix the issue: https://github.com/wailsapp/wails/blob/master/v2/internal/frontend/desktop/linux/frontend.go#L139
If it does we can make it a flag.
There are several webkit bug reports related to this: https://bugs.webkit.org/show_bug.cgi?id=228268 and https://bugs.webkit.org/show_bug.cgi?id=261874#c32
This is clearly webkit/nvidia related and there's no real fix yet (even the nv drivers update mentioned in 281874 does not fix this bug for me).
IMO, the best way to tackle this in wails and its ecosystem is:
- add a bool command line flag like
-webkit-dmabuf-rendererset to false by default (which would setWEBKIT_DISABLE_DMABUF_RENDERER=1by default on linux). - end users who can read a README and need better performance can then re-enable it.
- keep this issue open until the upstream bug is resolved, then change the default flag value to true
This way, end-users won't even see the bug and this would put less pressure on devs.
Assuming that very little client code uses the options.App.Linux field, I my have an even simpler solution:
diff --git a/v2/internal/frontend/desktop/linux/window.go b/v2/internal/frontend/desktop/linux/window.go
index 82030f43..71516097 100644
--- a/v2/internal/frontend/desktop/linux/window.go
+++ b/v2/internal/frontend/desktop/linux/window.go
@@ -25,6 +25,7 @@ import (
"github.com/wailsapp/wails/v2/internal/frontend"
"github.com/wailsapp/wails/v2/pkg/menu"
"github.com/wailsapp/wails/v2/pkg/options"
+ "github.com/wailsapp/wails/v2/pkg/options/linux"
)
func gtkBool(input bool) C.gboolean {
@@ -90,6 +91,9 @@ func NewWindow(appoptions *options.App, debug bool, devtoolsEnabled bool) *Windo
var webviewGpuPolicy int
if appoptions.Linux != nil {
webviewGpuPolicy = int(appoptions.Linux.WebviewGpuPolicy)
+ } else {
+ // TODO: see https://github.com/wailsapp/wails/issues/2977
+ webviewGpuPolicy = int(linux.WebviewGpuPolicyNever)
}
Then add a warning in the docs for linux.Options.WebviewGpuPolicy about the potential issues and the default behavior. The only problem I see is that not setting options.App.Linux would have a different behavior than providing an empty {}&linux.Options.
Happy to accept a PR on this. Agree - it's probably the best way forward.
Here you go #3027.
I ran into this issue trying use webkit2gtk on arch linux (with an nvidia card) and I was able to fix it without setting WEBKIT_DISABLE_DMABUF_RENDERER=1.
Here is how I fixed it:
-
Check if you have modesetting enabled via
cat /sys/module/nvidia_drm/parameters/modeset -
If you see printed
Nthen you need to enable it withecho options nvidia_drm modeset=1 | sudo tee /etc/modprobe.d/nvidia_drm.conf -
Restart your computer
Thank you so much @nobane this works perfectly on my Arch machine.