Comment by ~inkeliz on ~eliasnaur/gio
It's 100% related to https://github.com/golang/go/issues/68285
Compiling with go 1.22.6 (or 1.23.1) causes the issue. The latest working version is go1.22.4, which don't cause any crash.
Ticket created by ~inkeliz on ~eliasnaur/gio
I manage to reproduce it by having multiple "Editor" in a single page and switch between them, very fast. Almost clicking one each one.
The cause of the issue is in
func (w *window) EditorStateChanged(old, new editorState)
function, exactly on:callVoidMethod(env, w.view, gioView.updateCaret, f(m00), f(m01), f(m02), f(m10), f(m11), f(m12), f(c.Pos.X), f(c.Pos.Y-c.Ascent), f(c.Pos.Y), f(c.Pos.Y+c.Descent))
Logs:
09-09 17:05:12.404 27306 0 E Go : runtime: newstack at runtime.printlock+0x78 sp=0x40008ff000 stack=[0x40008f8000, 0x4000900000] 09-09 17:05:12.404 27306 0 E Go : morebuf={pc:0x72d486d000 sp:0x40008ff000 lr:0x0} 09-09 17:05:12.404 27306 0 E Go : sched={pc:0x72d48a4468 sp:0x40008ff000 lr:0x72d486d000 ctxt:0x0} 09-09 17:05:12.404 27306 0 E Go : runtime.callbackUpdateSystemStack(0x4000064008, 0x7fd311d0c0, 0x0) 09-09 17:05:12.404 27306 0 E Go : /usr/lib/go/src/runtime/cgocall.go:241 +0x90 fp=0x40008ff060 sp=0x40008ff000 pc=0x72d486d000 09-09 17:05:12.404 4223 4223 I GoogleInputMethodService: GoogleInputMethodService.updateDeviceLockedStatus():2246 repeatCheckTimes = 1, locked = false 09-09 17:05:12.404 27306 0 E Go : runtime.cgocallbackg(0x72d4b54450, 0x7fd311d1b0, 0x0) 09-09 17:05:12.404 27306 0 E Go : /usr/lib/go/src/runtime/cgocall.go:306 +0x68 fp=0x40008ff0e0 sp=0x40008ff060 pc=0x72d486d1c8 09-09 17:05:12.404 27306 0 E Go : runtime.cgocallbackg(0x72d4b54450, 0x7fd311d1b0, 0x0) 09-09 17:05:12.404 27306 0 E Go : :1 +0x1c fp=0x40008ff110 sp=0x40008ff0e0 pc=0x72d48e026c 09-09 17:05:12.404 4223 4223 W SessionManager: SessionManager.beginSession():53 Try to begin an already begun session [INPUT_SESSION], end it first 09-09 17:05:12.404 27306 0 E Go : runtime.cgocallback(0x40008ff188, 0x72d4b49b30, 0x72d50838f0) 09-09 17:05:12.404 27306 0 E Go : /usr/lib/go/src/runtime/asm_arm64.s:1130 +0xb0 fp=0x40008ff140 sp=0x40008ff110 pc=0x72d48de590 09-09 17:05:12.404 27306 0 E Go : runtime.systemstack_switch() 09-09 17:05:12.404 27306 0 E Go : /usr/lib/go/src/runtime/asm_arm64.s:200 +0x8 fp=0x40008ff150 sp=0x40008ff140 pc=0x72d48dc158 09-09 17:05:12.404 27306 0 E Go : runtime.cgocall(0x72d50838f0, 0x40008ff1c8) 09-09 17:05:12.404 4223 4223 W SessionManager: SessionManager.endSession():96 Child session [INPUT_VIEW_SESSION] is not ended while ending session [{INPUT_SESSION=1725897909024, INPUT_VIEW_SESSION=1725897910465, TRAINING_CACHE_SESSION=1725897910486, IME_SESSION=1725897910485}], ending it now. 09-09 17:05:12.404 27306 0 E Go : /usr/lib/go/src/runtime/cgocall.go:175 +0x70 fp=0x40008ff190 sp=0x40008ff150 pc=0x72d486cf10 09-09 17:05:12.404 27306 0 E Go : gioui.org/app._Cfunc_jni_CallVoidMethodA(0x73c4eb2900, 0x2796, 0x73c317b660, 0x4000d406e0) 09-09 17:05:12.404 27306 0 E Go : _cgo_gotypes.go:694 +0x30 fp=0x40008ff1c0 sp=0x40008ff190 pc=0x72d4b49b30 09-09 17:05:12.404 4223 4223 W SessionManager: SessionManager.endSession():96 Child session [IME_SESSION] is not ended while ending session [{INPUT_SESSION=1725897909024, INPUT_VIEW_SESSION=1725897910465, TRAINING_CACHE_SESSION=1725897910486, IME_SESSION=1725897910485}], ending it now. 09-09 17:05:12.404 27306 0 E Go : gioui.org/app.callVoidMethod.func1(0x73c4eb2900, 0x2796, 0x73c317b660, {0x4000d406e0?, 0x4000002701?, 0x200000003?}) 09-09 17:05:12.404 27306 0 E Go : /Volumes/Test/inkeliz/gioapp/gio/app/os_android.go:1269 +0xa8 fp=0x40008ff200 sp=0x40008ff1c0 pc=0x72d4b51d78 09-09 17:05:12.404 27306 0 E Go : gioui.org/app.callVoidMethod(0x73c4eb2900, 0x400003e008?, 0x40008ff298?, {0x4000d406e0?, 0x40008ff288?, 0x72d486cee4?}) 09-09 17:05:12.404 27306 0 E Go : /Volumes/Test/inkeliz/gioapp/gio/app/os_android.go:1269 +0x24 fp=0x40008ff240 sp=0x40008ff200 pc=0x72d4b51c74 09-09 17:05:12.404 27306 0 E Go : gioui.org/app.(*window).EditorStateChanged.func1(0x73c4eb2900) 09-09 17:05:12.404 27306 0 E Go : /Volumes/Test/inkeliz/gioapp/gio/app/os_android.go:1175 +0x28c fp=0x40008ff330 sp=0x40008ff240 pc=0x72d4b5154c 09-09 17:05:12.404 27306 0 E Go : gioui.org/app.runInJVM(0x73c4e471c0, 0x40008ff3d8) 09-09 17:05:12.404 27306 0 E Go : /Volumes/Test/inkeliz/gioapp/gio/app/os_android.go:941 +0x16c fp=0x40008ff3c0 sp=0x40008ff330 pc=0x72d4b4fc0c 09-09 17:05:12.405 27306 0 E Go : gioui.org/app.(*window).EditorStateChanged(0x40002fe780, {{{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, {0x0, 0x0}, {{...}, ...}}, ...}, ...}, ...) 09-09 17:05:12.405 27306 0 E Go : /Volumes/Test/inkeliz/gioapp/gio/app/os_android.go:1159 +0xec fp=0x40008ff4c0 sp=0x40008ff3c0 pc=0x72d4b5120c 09-09 17:05:12.405 27306 0 E Go : gioui.org/app.(*Window).updateState(0x4000f90608) 09-09 17:05:12.405 27306 0 E Go : /Volumes/Test/inkeliz/gioapp/gio/app/window.go:257 +0x448 fp=0x40008ff9e0 sp=0x40008ff4c0 pc=0x72d4b455e8 09-09 17:05:12.405 27306 0 E Go : gioui.org/app.(*Window).processFrame(0x4000f90608, 0x40000fb380, 0x40012076e0) 09-09 17:05:12.405 27306 0 E Go : /Volumes/Test/inkeliz/gioapp/gio/app/window.go:227 +0x484 fp=0x40008ffb00 sp=0x40008ff9e0 pc=0x72d4b45114 09-09 17:05:12.405 27306 0 E Go : gioui.org/app.(*callbacks).ProcessFrame(...) 09-09 17:05:12.405 27306 0 E Go : /Volumes/Test/inkeliz/gioapp/gio/app/window.go:388 09-09 17:05:12.405 27306 0 E Go : gioui.org/app.(*eventLoop).deliverEvent(0x4000ed2820, {0x72d5263f78?, 0x40011b63c0?}) 09-09 17:05:12.405 27306 0 E Go : /Volumes/Test/inkeliz/gioapp/gio/app/os.go:330 +0x1c4 fp=0x40008ffbe0 sp=0x40008ffb00 pc=0x72d4b427a4 09-09 17:05:12.405 27306 0 E Go : gioui.org/app.(*eventLoop).FlushEvents(0x4000ed2820) 09-09 17:05:12.405 27306 0 E Go : /Volumes/Test/inkeliz/gioapp/gio/app/os.go:317 +0x78 fp=0x40008ffc30 sp=0x40008ffbe0 pc=0x72d4b42578 09-09 17:05:12.405 27306 0 E Go : gioui.org/app.(*window).processEvent(0x40002fe780, {0x72d5265240?, 0x4000fbd920?}) 09-09 17:05:12.405 27306 0 E Go : /Volumes/Test/inkeliz/gioapp/gio/app/os_android.go:689 +0x44 fp=0x40008ffc60 sp=0x40008ffc30 pc=0x72d4b4e454 09-09 17:05:12.405 27306 0 E Go : gioui.org/app.(*window).draw(0x40002fe780, 0x73c4eb2900, 0x0) 09-09 17:05:12.405 27306 0 E Go : /Volumes/Test/inkeliz/gioapp/gio/app/os_android.go:884 +0x204 fp=0x40008ffdb0 sp=0x40008ffc60 pc=0x72d4b4f7c4 09-09 17:05:12.405 27306 0 E Go : gioui.org/app.Java_org_gioui_GioView_onFrameCallback(0x73c4eb2900, 0x0?, 0x1?) 09-09 17:05:12.405 27306 0 E Go : /Volumes/Test/inkeliz/gioapp/gio/app/os_android.go:580 +0x70 fp=0x40008ffe00 sp=0x40008ffdb0 pc=0x72d4b4d840 09-09 17:05:12.405 27306 0 E Go : _cgoexp_e3ba14f2641e_Java_org_gioui_GioView_onFrameCallback(0x40008ffe88?) 09-09 17:05:12.405 27306 0 E Go : _cgo_gotypes.go:1061 +0x2c fp=0x40008ffe30 sp=0x40008ffe00 pc=0x72d4b5402c 09-09 17:05:12.405 27306 0 E Go : runtime.cgocallbackg1(0x72d4b54000, 0x7fd311d818, 0x0) 09-09 17:05:12.405 27306 0 E Go : /usr/lib/go/src/runtime/cgocall.go:420 +0x228 fp=0x40008fff00 sp=0x40008ffe30 pc=0x72d486d548 09-09 17:05:12.405 27306 0 E Go : runtime.cgocallbackg(0x72d4b54000, 0x7fd311d818, 0x0) 09-09 17:05:12.405 27306 0 E Go : /usr/lib/go/src/runtime/cgocall.go:339 +0x10c fp=0x40008fff80 sp=0x40008fff00 pc=0x72d486d26c 09-09 17:05:12.405 27306 0 E Go : runtime.cgocallbackg(0x72d4b54000, 0x7fd311d818, 0x0) 09-09 17:05:12.405 27306 0 E Go : :1 +0x1c fp=0x40008fffb0 sp=0x40008fff80 pc=0x72d48e026c 09-09 17:05:12.405 27306 0 E Go : runtime.cgocallback(0x0, 0x0, 0x0) 09-09 17:05:12.405 27306 0 E Go : /usr/lib/go/src/runtime/asm_arm64.s:1130 +0xb0 fp=0x40008fffe0 sp=0x40008fffb0 pc=0x72d48de590 09-09 17:05:12.405 27306 0 E Go : runtime.goexit({}) 09-09 17:05:12.405 27306 0 E Go : /usr/lib/go/src/runtime/asm_arm64.s:1222 +0x4 fp=0x40008fffe0 sp=0x40008fffe0 pc=0x72d48de684 09-09 17:05:12.405 27306 0 E Go : fatal error: runtime: stack split at bad time
Maybe it's related: https://github.com/golang/go/issues/68285
Comment by ~inkeliz on ~eliasnaur/gio
I don't know if it's the proper fix, but I change:
if animate != w.animating { w.animating = animate w.driver.SetAnimating(animate) }
To:
w.driver.SetAnimating(animate)
In app/window.go. I'm not sure if that introduces any other issue. So far, I was not able to reproduce that issue again.
Comment by ~inkeliz on ~eliasnaur/gio
Far I understand, it seems to be related to
RunOnMain
function (window.Run). I'm trying to create a small reproducer, since it only happens whenRun
is used. I'm also reviewing all functions that useRun
.But, the
Run
function seems to work and leave, so it doesn't seems to be a deadlock or similar issue.
Ticket created by ~inkeliz on ~eliasnaur/gio
I'm trying to discover the root cause of that issue, but without of luck.
The issue:
If your app go to background, Gio no longer send FrameEvent. The last frame still displayed, without change. Any kind of input (including touch) is ignored.
Reproduce:
It's easier on cheap/low-end devices. Open the app, minimize it and open some benchmark website or dedicated app (or both). The idea is to force Android to stop your app, without killing it. Then, open your app again.
In general it is hit-or-miss. But, in many occasions, Gio will issue ONE new FrameEvent, and then you never get any other FrameEvent.
The only event that I get from Gio is "app.wakeupEvent", which is due to another goroutine, which call "Invalidate". No
AppView
or equivalent event are sent.Investigation:
- The e.Frame() is processed, the function isn't stuck, on the first frame received.
- The Java functions OnPause/OnResume are called, but Gio don't handle those functions.
- The Detach function is never called.
- The OnLowMemory is also never called.
- The log seems to include some stuff around "Disconnected":
09-07 17:28:41.548 482 570 I BufferQueueProducer: [SurfaceView - app_name/org.gioui.GioActivity#0](this:0xa3c5d000,id:1230,api:1,p:-1,c:-1) disconnect(P): api 1 09-07 17:28:41.549 482 568 I BufferQueueProducer: [SurfaceView - app_name/org.gioui.GioActivity#0](this:0xa3622000,id:1243,api:1,p:6154,c:482) connect(P): api=1 producer=(6154:app_name) producerControlledByApp=false
Comment by ~inkeliz on ~eliasnaur/gio
I think something similar happens on macOS. However, instead of crashing it seems to cause a deadlock. :S
-- Lucas Rodrigues inkeliz@inkeliz.com
On Tue, Jun 18, 2024, at 9:31 PM, ~whereswaldon wrote:
The panic is because the window does not yet have a driver, since the
Event
method has not yet been called. I think we've seen some other reports of similar problems.To my naive eyes, this seems like more of an ergonomics issue than anything. Can we queue up system actions until the first call to
Event()
? I've sent a proof-of-concept patch trying to implement this.-- View on the web: https://todo.sr.ht/~eliasnaur/gio/593#event-373967
Ticket created by ~inkeliz on ~eliasnaur/gio
I'm hitting one bug, that is not reproducible on Gio 0.1. Basically that is what is happening:
- Clicking in one widget.Editor (gio one) and type something.
- Launch external view (such as Webview or any native dialog, out of Gio scope).
Now we have a problem: A) The input don't loses focus. B) Clicking on the input and typing don't edit the text, and the focus still on the external view.
On macOS that bug exists on Gio 0.1. On Windows that issue don't exists, and works fine.
Looking the Gio code, the "keyState.focus" don't seems to reset when the text input focus changes externally from Gio.
Also, we have issues with SoftKeyboard, on Android (untested on iOS):
- Click in one widget.Editor, type somthing.
- Close the keyboard (on your native Android button).
- Click again in the same Editor.
Now, it will NOT open the keyboard anymore. So, it keeps focused, but even clicking multiple times it will not open the SoftKeyboard.
That bug seems to be a regression, because couple of years ago I fixed something similar.
Ticket created by ~inkeliz on ~eliasnaur/gio
On newer Android it's possible to trigger the 'Back Button' by touch in the border of the device, like swapping left.
That introduces two issues:
It's required to know the touch-safe areas [1], that can be propagated to
layout.Context
andapp.FrameEvent
. In the end: it's user (who uses Gio) to follow such paddings.
- The padding is not visual, but only touch, so don't make sense to apply that on app.NewContext.
- I suggest some new field: TouchSafeInset (or similar names: TouchInset).
It's required to handle the new "Back Button". [2]
- Currently it's opt-in, but it can be mandatory in the future. We can either left it to the last minute, or opt-in to support this new API.
[1]. https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#edge-to-edge [2].https://developer.android.com/guide/navigation/custom-back/predictive-back-gesture#opt-predictive
Ticket created by ~inkeliz on ~eliasnaur/gio
Currently, it's documented:
"You will also need OpenJDK 1.8, as part of the Android build toolchain requires it. More recent versions of Java will break the build."
That was true for many years, however the newer versions of "D8" was compiled using Java 11, which causes:
"Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/tools/r8/D8 has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0"
Usually, I don't have issues with Java 11. But, now, it seems that we need at least 2 versions of Java (one to run D8 and another to build with Java 8), or use Java 11.
Comment by ~inkeliz on ~eliasnaur/gio
You need to enable CGO, IIRC it's: CGO_ENABLED=1
The CGO is disabled when cross-compile (in that case cross-arch).
-- Lucas Rodrigues inkeliz@inkeliz.com
On Wed, Mar 27, 2024, at 2:57 PM, ~gedw99 wrote:
here is an example from gio-example/component.
I am using a macOS M1.
GOOS=darwin GOARCH=arm64 go build . go: downloading gioui.org v0.5.1-0.20240306204944-993ec907be4b go: downloading gioui.org/x v0.5.0 go: downloading golang.org/x/exp/shiny v0.0.0-20220906200021-fcb1a314c389 go: downloading golang.org/x/image v0.7.0 go: downloading golang.org/x/exp v0.0.0-20230905200255-921286631fa9 go: downloading github.com/go-text/typesetting v0.0.0-20230803102845-24e03d8b5372 go: downloading golang.org/x/text v0.13.0 go: downloading gioui.org/cpu v0.0.0-20210817075930-8d6a761490d2 go: downloading gioui.org/shader v1.0.8 apple@apples-MacBook-Pro component % GOOS=darwin GOARCH=amd64 go build .
#gioui.org/internal/gl
../../../../pkg/mod/gioui.org@v0.5.1-0.20240306204944-993ec907be4b/internal/gl/util.go:11:25: undefined: Functions ../../../../pkg/mod/gioui.org@v0.5.1-0.20240306204944-993ec907be4b/internal/gl/util.go:40:32: undefined: Functions ../../../../pkg/mod/gioui.org@v0.5.1-0.20240306204944-993ec907be4b/internal/gl/util.go:60:24: undefined: Functions GOOS=windows GOARCH=arm64 go build . go: downloading golang.org/x/sys v0.12.0 GOOS=windows GOARCH=amd64 go build .
So its building for windows for arm64 and amd64, but not for darwin amd64.
-- View on the web: https://todo.sr.ht/~eliasnaur/gio/568#event-338289