-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/mobile: rendering freeze #48434
Comments
Change https://golang.org/cl/350212 mentions this issue: |
/cc @hyangah |
Change https://golang.org/cl/351769 mentions this issue: |
I simplified the DoWork function a little bit to the following (Removed cgo batching): func (ctx *context) DoWork() {
for {
select {
case w := <-ctx.work:
ret := C.processFn((*C.struct_fnargs)(unsafe.Pointer(&w.args)), (*C.char)(w.parg))
if w.blocking {
ctx.retvalue <- ret
}
default:
return
}
}
} And also captured some information from stack traces, it looks the problem is caused by a cgo call that has not yet returned.
From the goroutine stack trace side, it looks like the goroutine is not yet returned from a Cgo call.
The relevant thread backtrace from darwin/arm64:
As far as I can confirm this occurs in all arch of macOS (amd64, arm64), iOS (arm64). I first thought this might be a driver issue, but since Android is also reported in arm64, by @hajimehoshi. It seems unlikely to have a driver issue on two different platforms (?), especially the backend if different (darwin/arm64 is using Metal as backend, apparently Android can't use that). From the stack traces, the Any hint would be highly appreciated... |
This is a feedback from Apple (9665054): Getting a hang, or long pauses here, usually means there's a Metal resource, or GL texture leak. The kernel side of IOGPUFamily will eventually start stalling for long periods of time once we reach the per-process limit on the number of resources created by the process (which is in the tens of thousands). |
#52116 Isn't this related? |
@hajimehoshi could you maybe elaborate a bit more on how they are related? |
NVM, #52116 was a crash rather than freezing so this was not related |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
This issue is observed in practice, see hajimehoshi/ebiten#1332, hajimehoshi/ebiten#1322, fyne-io/fyne#950.
While working on an (almost) reproducer. The problem seems to happen more often on iOS/Android and was not observed on the desktop.
A recent debugging on the rendering freeze seems to suggest gl package might block forever when using golang.org/x/mobile/app and golang.org/x/mobile/gl packages, as the rendering loop, stops processing GL calls after a while and the workAvaliable fails to receive more events.
Furthermore, according to a discussion in CL 350212, it seems #48433 might be related.
What did you expect to see?
No rendering freeze
What did you see instead?
Rendering freeze
The text was updated successfully, but these errors were encountered: