~eliasnaur/gio#413: 
[bug] Windows: crash closing custom render window

I saw this after closing a custom render window on Windows OS.

panic: PostMessage failed: Not enough quota is available to process this command.

goroutine 61 [running]:
gioui.org/app.(*window).Wakeup(0xc00060e360)
        C:/Users/Jack Mordaunt/go/pkg/mod/gioui.org@v0.0.0-20220510194137-0e2e02a66237/app/os_windows.go:521 +0x85
gioui.org/app.(*Window).run(0xc0008df800, {0xc000473b80, 0x7, 0x8})
        C:/Users/Jack Mordaunt/go/pkg/mod/gioui.org@v0.0.0-20220510194137-0e2e02a66237/app/window.go:917 +0x33e
created by gioui.org/app.NewWindow
        C:/Users/Jack Mordaunt/go/pkg/mod/gioui.org@v0.0.0-20220510194137-0e2e02a66237/app/window.go:164 +0x7b4
Status
REPORTED
Submitter
~jackmordaunt
Assigned to
No-one
Submitted
6 months ago
Updated
6 months ago
Labels
No labels applied.

~eliasnaur 6 months ago

I don't have much bandwidth. Can you dig a little deeper, bisect, maybe get the (I assume) native error code for the error message and look it up?

Just from the error message itself, it sounds like the window message queue is overflowing. Are you calling some app.Window method on the closed window? If so, the fix may simply be a missing check for w.dead. Now that I think about it, Wakeup should not even be available for dead windows, so there may be a race somewhere.

~eliasnaur 6 months ago

According to https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-postmessagew ERROR_NOT_ENOUGH_QUOTA is returned when the message queue overflows. The default queue size is enough for 10000 messages, so it seems to me something is piling up wakeup messages to a dead or deadlocked window. Does that help you? Are you calling app.Window.Perform or Option on unresponsive windows?

~jackmordaunt 6 months ago

Thanks for the tip Elias! I will investigate further based on this.

Register here or Log in to comment, or comment via email.