wailsapp/go-webview2

Long string param will make "Overlapped I/O operation is in progress" panic of v1.0.13

Closed this issue · 3 comments


type Data struct {
	Msg string `json:"msg"`
}

// Greet returns a greeting for the given name
func (a *App) Greet(d Data) string {
	return "hello"
}

Error "Overlapped I/O operation is in progress" occurs if the length of the parameter is relatively long (approximately len(msg) >= 9000).

Steps to reproduce:

Download this project
myproject.zip

Run wails dev
Click the Greet button
Then you will see the error message on the console.

Error happens on Windows, the app works well on Linux.

Fixed on master: #13

I found the panic occurs here:

_, _, err = sender.vtbl.PostWebMessageAsString.Call(
uintptr(unsafe.Pointer(sender)),
uintptr(unsafe.Pointer(_message)),
)
if err != nil && !errors.Is(err, windows.ERROR_SUCCESS) {
e.errorCallback(err)
}

This panic happens when the backend attempts to send the received message back to the frontend without any modification, and the message is long string.

It seems that when the data sent from the backend to the frontend via WebView is too large, the "Overlapped I/O operation is in progress" error occurs.

So, while it appears that the panic is caused by the frontend sending large data to the backend, it is actually similar to #12, where the issue is caused by the backend sending large data to the frontend(or more precisely, is caused by syscall).

Additionally, I don't quite understand why MessageReceived, after receiving the message and executing the callback function, needs to send the message back to the frontend via PostWebMessageAsString without any modification.
@leaanthony @mediawall maybe you should reopen this issue.

I can't reopen this issue, maybe only @leaanthony can do that.
I think your comment is correct.