Skip to content
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

Apple M1: error happens when using mouse drag to resize window #2188

Closed
Virgil-N opened this issue Apr 23, 2021 · 27 comments
Closed

Apple M1: error happens when using mouse drag to resize window #2188

Virgil-N opened this issue Apr 23, 2021 · 27 comments
Labels
blocker Items that would block a forthcoming release bug Something isn't working OS:macOS Tickets affecting only macOS

Comments

@Virgil-N
Copy link

Describe the bug:

Error happens when using mouse drag to resize window.

Device (please complete the following information):

  • OS: Mac M1
  • Version: Bigsur
  • Go version: 1.15
  • Fyne version: 1.4.3/v2

Error information is a little long.

-[AGXM1FamilyCommandBuffer renderCommandEncoderWithDescriptor:]:286: failed assertion `A command encoder is already encoding to this command buffer'
SIGABRT: abort
PC=0x1a4128cec m=0 sigcode=0
signal arrived during cgo execution

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x100cc160c, 0x14000447d08, 0x14000102420)
/opt/homebrew/Cellar/go/1.15.8/libexec/src/runtime/cgocall.go:154 +0x50 fp=0x14000447cd0 sp=0x14000447c90 pc=0x10085acc0
github.com/go-gl/glfw/v3.3/glfw._Cfunc_glfwPollEvents()
_cgo_gotypes.go:1474 +0x40 fp=0x14000447d00 sp=0x14000447cd0 pc=0x100b22bc0
github.com/go-gl/glfw/v3.3/glfw.PollEvents()
/Users/virgil/go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20210311203641-62640a716d48/window.go:949 +0x20 fp=0x14000447d40 sp=0x14000447d00 pc=0x100b2ad30
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).tryPollEvents(0x14000100c30)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/loop.go:224 +0x3c fp=0x14000447d60 sp=0x14000447d40 pc=0x100b3696c
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).runGL(0x14000100c30)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/loop.go:102 +0x1b4 fp=0x14000447eb0 sp=0x14000447d60 pc=0x100b36364
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).Run(0x14000100c30)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/driver.go:80 +0x38 fp=0x14000447ed0 sp=0x14000447eb0 pc=0x100b35758
fyne.io/fyne/v2/internal/driver/glfw.(*window).ShowAndRun(0x14000181a40)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/window.go:450 +0x38 fp=0x14000447ef0 sp=0x14000447ed0 pc=0x100b3bc58
main.main()
/Users/virgil/workspace/personal/go/fyne/fyne_app/client/main.go:49 +0x208 fp=0x14000447f70 sp=0x14000447ef0 pc=0x100cae5f8
runtime.main()
/opt/homebrew/Cellar/go/1.15.8/libexec/src/runtime/proc.go:225 +0x26c fp=0x14000447fd0 sp=0x14000447f70 pc=0x10088c3dc
runtime.goexit()
/opt/homebrew/Cellar/go/1.15.8/libexec/src/runtime/asm_arm64.s:1130 +0x4 fp=0x14000447fd0 sp=0x14000447fd0 pc=0x1008bd194

goroutine 19 [sleep]:
time.Sleep(0x22ecb25c00)
/opt/homebrew/Cellar/go/1.15.8/libexec/src/runtime/time.go:193 +0xc4
fyne.io/fyne/v2/internal/painter.svgCacheJanitor.func1()
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/painter/svg_cache.go:57 +0xe0
sync.(*Once).doSlow(0x10280dac8, 0x14000132ca0)
/opt/homebrew/Cellar/go/1.15.8/libexec/src/sync/once.go:68 +0x120
sync.(*Once).Do(0x10280dac8, 0x14000132ca0)
/opt/homebrew/Cellar/go/1.15.8/libexec/src/sync/once.go:59 +0x44
created by fyne.io/fyne/v2/internal/painter.svgCacheJanitor
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/painter/svg_cache.go:55 +0x9c

goroutine 20 [select]:
fyne.io/fyne/v2/data/binding.makeInfiniteQueue.func1(0x14000102120, 0x140001340b0)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/data/binding/queue.go:36 +0xf8
created by fyne.io/fyne/v2/data/binding.makeInfiniteQueue
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/data/binding/queue.go:21 +0xa0

goroutine 21 [chan receive]:
fyne.io/fyne/v2/data/binding.processItems()
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/data/binding/queue.go:54 +0x3c
created by fyne.io/fyne/v2/data/binding.init.0
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/data/binding/queue.go:15 +0x30

goroutine 22 [chan receive]:
fyne.io/fyne/v2/app.newAppWithDriver.func1(0x140001024e0, 0x14000404b60)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/app/app.go:120 +0x34
created by fyne.io/fyne/v2/app.newAppWithDriver
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/app/app.go:118 +0x1bc

goroutine 23 [syscall]:
syscall.syscall6(0x100b5a880, 0x6, 0x0, 0x0, 0x14000048e88, 0xa, 0x10280dc70, 0x0, 0x0, 0x0)
/opt/homebrew/Cellar/go/1.15.8/libexec/src/runtime/sys_darwin.go:41 +0x1c
golang.org/x/sys/unix.kevent(0x6, 0x0, 0x0, 0x14000048e88, 0xa, 0x10280dc70, 0x0, 0x0, 0x0)
/Users/virgil/go/pkg/mod/golang.org/x/sys@v0.0.0-20200720211630-cb9d2d5c5666/unix/zsyscall_darwin_arm64.go:292 +0x80
golang.org/x/sys/unix.Kevent(0x6, 0x0, 0x0, 0x0, 0x14000048e88, 0xa, 0xa, 0x10280dc70, 0x14000102600, 0x0, ...)
/Users/virgil/go/pkg/mod/golang.org/x/sys@v0.0.0-20200720211630-cb9d2d5c5666/unix/syscall_bsd.go:413 +0x60
github.com/fsnotify/fsnotify.read(0x6, 0x14000048e88, 0xa, 0xa, 0x10280dc70, 0x14000048e88, 0x0, 0xa, 0x0, 0x0)
/Users/virgil/go/pkg/mod/github.com/fsnotify/fsnotify@v1.4.9/kqueue.go:511 +0x50
github.com/fsnotify/fsnotify.(*Watcher).readEvents(0x14000136c60)
/Users/virgil/go/pkg/mod/github.com/fsnotify/fsnotify@v1.4.9/kqueue.go:274 +0x76c
created by github.com/fsnotify/fsnotify.NewWatcher
/Users/virgil/go/pkg/mod/github.com/fsnotify/fsnotify@v1.4.9/kqueue.go:62 +0x15c

goroutine 24 [chan receive]:
fyne.io/fyne/v2/app.watchFile.func1(0x14000136c60, 0x1400011ba40, 0x34, 0x14000345140, 0x14000345150)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/app/settings_desktop.go:42 +0x48
created by fyne.io/fyne/v2/app.watchFile
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/app/settings_desktop.go:41 +0xd4

goroutine 25 [runnable, locked to thread]:
github.com/go-gl/gl/v3.2-core/gl._Cfunc_glowEnableVertexAttribArray(0x1e6bcf868, 0x0)
_cgo_gotypes.go:6890 +0x40
github.com/go-gl/gl/v3.2-core/gl.EnableVertexAttribArray(...)
/Users/virgil/go/pkg/mod/github.com/go-gl/gl@v0.0.0-20190320180904-bf2b1f2f34d7/v3.2-core/gl/package.go:9428
fyne.io/fyne/v2/internal/painter/gl.(*glPainter).glCreateBuffer(0x140006d4120, 0x140000f9680, 0x14, 0x14, 0x0)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/painter/gl/gl_core.go:213 +0x154
fyne.io/fyne/v2/internal/painter/gl.(*glPainter).drawTextureWithDetails(0x140006d4120, 0x100ecd738, 0x14000405260, 0x140004493c8, 0x4320000042500000, 0x4000000040000000, 0x43d90000441cc000, 0x0, 0x3f800000)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/painter/gl/draw.go:27 +0xe8
fyne.io/fyne/v2/internal/painter/gl.(*glPainter).drawGradient(0x140006d4120, 0x100ecd738, 0x14000405260, 0x140004493c8, 0x4320000042500000, 0x43d90000441cc000)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/painter/gl/draw.go:52 +0x98
fyne.io/fyne/v2/internal/painter/gl.(*glPainter).drawObject(0x140006d4120, 0x100ecd738, 0x14000405260, 0x4320000042500000, 0x43d90000441cc000)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/painter/gl/draw.go:101 +0x140
fyne.io/fyne/v2/internal/painter/gl.(*glPainter).Paint(0x140006d4120, 0x100ecd738, 0x14000405260, 0x4320000042500000, 0x43d90000441cc000)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/painter/gl/painter.go:70 +0x80
fyne.io/fyne/v2/internal/driver/glfw.(*glCanvas).paint.func1(0x14000031a80, 0x4320000042500000)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/canvas.go:439 +0xb8
fyne.io/fyne/v2/internal/driver/glfw.(*glCanvas).walkTree.func1(0x100ecd738, 0x14000405260, 0x4320000042500000, 0x0, 0x4f0000004f000000, 0x42e4000040c00000)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/canvas.go:535 +0x12c
fyne.io/fyne/v2/internal/driver.walkObjectTree(0x100ecd738, 0x14000405260, 0x42e4000040c00000, 0x100ecdbb8, 0x1400011a200, 0x42e4000040c00000, 0x0, 0x4f0000004f000000, 0x14000449ce0, 0x14000449cb8, ...)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/util.go:169 +0x334
fyne.io/fyne/v2/internal/driver.walkObjectTree.func1(...)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/util.go:176
fyne.io/fyne/v2/internal/driver.walkObjectTree(0x100ecdbb8, 0x1400011a200, 0x42e0000040800000, 0x100ecdd38, 0x14000356c80, 0x42e0000040800000, 0x0, 0x4f0000004f000000, 0x14000449ce0, 0x14000449cb8, ...)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/util.go:190 +0x2c4
fyne.io/fyne/v2/internal/driver.walkObjectTree.func1(...)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/util.go:176
fyne.io/fyne/v2/internal/driver.walkObjectTree(0x100ecdd38, 0x14000356c80, 0x42e0000040800000, 0x100ecd558, 0x140000d2340, 0x42e0000040800000, 0x0, 0x4f0000004f000000, 0x14000449ce0, 0x14000449cb8, ...)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/util.go:190 +0x2c4
fyne.io/fyne/v2/internal/driver.walkObjectTree.func1(...)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/util.go:176
fyne.io/fyne/v2/internal/driver.walkObjectTree(0x100ecd558, 0x140000d2340, 0x4080000040800000, 0x100ecd558, 0x140000d2640, 0x4080000040800000, 0x0, 0x4f0000004f000000, 0x14000449ce0, 0x14000449cb8, ...)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/util.go:190 +0x2c4
fyne.io/fyne/v2/internal/driver.walkObjectTree.func1(...)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/util.go:176
fyne.io/fyne/v2/internal/driver.walkObjectTree(0x100ecd558, 0x140000d2640, 0x4080000040800000, 0x100ecd558, 0x140000d26c0, 0x4080000040800000, 0x0, 0x4f0000004f000000, 0x14000449ce0, 0x14000449cb8, ...)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/util.go:190 +0x2c4
fyne.io/fyne/v2/internal/driver.walkObjectTree.func1(...)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/util.go:176
fyne.io/fyne/v2/internal/driver.walkObjectTree(0x100ecd558, 0x140000d26c0, 0x4080000040800000, 0x100ecd558, 0x140000d2700, 0x4080000040800000, 0x0, 0x4f0000004f000000, 0x14000449ce0, 0x14000449cb8, ...)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/util.go:190 +0x2c4
fyne.io/fyne/v2/internal/driver.walkObjectTree.func1(...)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/util.go:176
fyne.io/fyne/v2/internal/driver.walkObjectTree(0x100ecd558, 0x140000d2700, 0x4080000040800000, 0x100ecd558, 0x140000d2900, 0x4080000040800000, 0x0, 0x4f0000004f000000, 0x14000449ce0, 0x14000449cb8, ...)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/util.go:190 +0x2c4
fyne.io/fyne/v2/internal/driver.walkObjectTree.func1(...)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/util.go:176
fyne.io/fyne/v2/internal/driver.walkObjectTree(0x100ecd558, 0x140000d2900, 0x14000449c00, 0x0, 0x0, 0x0, 0x0, 0x4f0000004f000000, 0x14000449ce0, 0x14000449cb8, ...)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/util.go:190 +0x2c4
fyne.io/fyne/v2/internal/driver.WalkVisibleObjectTree(0x100ecd558, 0x140000d2900, 0x14000449ce0, 0x14000449cb8, 0x14000107b00)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/util.go:134 +0x78
fyne.io/fyne/v2/internal/driver/glfw.(*glCanvas).walkTree(0x14000398000, 0x14000068440, 0x14000449dc8, 0x14000449db0)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/canvas.go:556 +0xf4
fyne.io/fyne/v2/internal/driver/glfw.(*glCanvas).walkTrees(0x14000398000, 0x14000449dc8, 0x14000449db0)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/canvas.go:563 +0x40
fyne.io/fyne/v2/internal/driver/glfw.(*glCanvas).paint(0x14000398000, 0x43d90000441cc000)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/canvas.go:453 +0xdc
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).repaintWindow.func1()
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/loop.go:163 +0x70
fyne.io/fyne/v2/internal/driver/glfw.(*window).RunWithContext(0x14000181a40, 0x14000449e90)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/window.go:1202 +0x50
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).repaintWindow(0x14000100c30, 0x14000181a40)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/loop.go:154 +0x50
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).startDrawThread.func1(0x14000100c30, 0x14000102660, 0x14000100cd0)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/loop.go:210 +0x278
created by fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).startDrawThread
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/loop.go:181 +0xac

goroutine 26 [chan receive]:
fyne.io/fyne/v2/internal/driver/glfw.(*window).runEventQueue(0x14000181a40)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/window.go:1262 +0x90
created by fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).createWindow.func1
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/window.go:1287 +0xfc

goroutine 34 [chan receive]:
fyne.io/fyne/v2/internal/driver/glfw.(*glCanvas).setupThemeListener.func1(0x140003b4000, 0x14000398000)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/canvas.go:495 +0x40
created by fyne.io/fyne/v2/internal/driver/glfw.(*glCanvas).setupThemeListener
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/canvas.go:493 +0x94

goroutine 28 [chan receive]:
fyne.io/fyne/v2/internal/animation.(*Runner).runAnimations.func1(0x14000e32690, 0x14000100c80)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/animation/runner.go:69 +0x218
created by fyne.io/fyne/v2/internal/animation.(*Runner).runAnimations
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/animation/runner.go:67 +0x54

goroutine 27 [chan receive]:
fyne.io/fyne/v2/internal/painter.SvgCacheMonitorTheme.func1(0x140006e6060)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/painter/svg_cache.go:109 +0x2c
created by fyne.io/fyne/v2/internal/painter.SvgCacheMonitorTheme
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/painter/svg_cache.go:107 +0x8c

r0 0x0
r1 0x0
r2 0x0
r3 0x0
r4 0x0
r5 0xa
r6 0x0
r7 0x1
r8 0x5b9
r9 0xab7ee6661ff5462
r10 0xcccccccccccccccd
r11 0xa
r12 0x0
r13 0x32
r14 0x2000001100004c0
r15 0x20e4143e0
r16 0x148
r17 0x209d9f330
r18 0x140043940
r19 0x6
r20 0x102b33d40
r21 0x303
r22 0x102b33e20
r23 0x2042b3000
r24 0x10
r25 0x20446e000
r26 0x1ababd128
r27 0x0
r28 0x0
r29 0x16f5a9990
lr 0x1a4159c24
sp 0x16f5a9970
pc 0x1a4128cec
fault 0x1a4128cec


Hope u can fix this.

@Virgil-N Virgil-N added the bug Something isn't working label Apr 23, 2021
@Jacalz
Copy link
Member

Jacalz commented Apr 23, 2021

Can you please confirm what fyne version (v2) you are using? The description says "1.4.3/v2" while 2.0.2 is the latest release.
You say that you are using an M1 Mac, but you are using Go 1.15 which has no support for that architecture. Could you please try with Go 1.16?

@Virgil-N
Copy link
Author

I'll confirm later.

@Virgil-N
Copy link
Author

Can you please confirm what fyne version (v2) you are using? The description says "1.4.3/v2" while 2.0.2 is the latest release.
You say that you are using an M1 Mac, but you are using Go 1.15 which has no support for that architecture. Could you please try with Go 1.16?

It's go1.16rc1 darwin/arm64

@Jacalz
Copy link
Member

Jacalz commented Apr 23, 2021

Thanks. Can you also verify the Fyne version, as mentioned in the comment above?

Can you please share the code that this is happening in? Might also be worth testing the latest Go release (Go 1.16.3).

@andydotxyz
Copy link
Member

I have tested on the colo-M1 box (mac mini) we've been provided and it does not happen on that running a basic app.
I doubt that it is caused by your app code, but any more information you can provide will help.

@andydotxyz andydotxyz added the question A question has been asked label Apr 23, 2021
@Virgil-N
Copy link
Author

Thanks. Can you also verify the Fyne version, as mentioned in the comment above?

Can you please share the code that this is happening in? Might also be worth testing the latest Go release (Go 1.16.3).

You are right. The Go version is 1.16 RC1. I'll install 1.16.3 and have a try.

@Jacalz
Copy link
Member

Jacalz commented Apr 25, 2021

@Virgil-N Did you find the source of the issue?

@Virgil-N
Copy link
Author

@Virgil-N Did you find the source of the issue?

Not found.
I removed 1.16 rc1 and install 1.16.3 and the error disappear.

@Jacalz
Copy link
Member

Jacalz commented Apr 25, 2021

I'd count that as finding the source of the issue. Thanks for confirming.

@Jacalz Jacalz added not an issue This doesn't seem right and removed bug Something isn't working question A question has been asked labels Apr 25, 2021
@Virgil-N
Copy link
Author

@Virgil-N Did you find the source of the issue?

Not found.
I removed 1.16 rc1 and install 1.16.3 and the error disappear.

I'm sorry. The crash is still here on Mac M1 with Go version 1.16.3.

@Virgil-N Virgil-N reopened this Apr 27, 2021
@Virgil-N
Copy link
Author

@Virgil-N Did you find the source of the issue?

Not found.
I removed 1.16 rc1 and install 1.16.3 and the error disappear.

I'm sorry. The crash is still here on Mac M1 with Go version 1.16.3.

And fyne version is 2.0.2.
I'll paste error information later.

@fyne-io fyne-io deleted a comment from Virgil-N Apr 27, 2021
@Virgil-N
Copy link
Author

Here is the error information.

-[AGXM1FamilyCommandBuffer renderCommandEncoderWithDescriptor:]:286: failed assertion `A command encoder is already encoding to this command buffer'
SIGABRT: abort
PC=0x185bd4cec m=0 sigcode=0
signal arrived during cgo execution

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x1048e5eac, 0x140004abd08, 0x14000090420)
/opt/homebrew/Cellar/go/1.16.3/libexec/src/runtime/cgocall.go:154 +0x50 fp=0x140004abcd0 sp=0x140004abc90 pc=0x104485520
github.com/go-gl/glfw/v3.3/glfw._Cfunc_glfwPollEvents()
_cgo_gotypes.go:1474 +0x40 fp=0x140004abd00 sp=0x140004abcd0 pc=0x104746820
github.com/go-gl/glfw/v3.3/glfw.PollEvents()
/Users/virgil/go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20210311203641-62640a716d48/window.go:949 +0x20 fp=0x140004abd40 sp=0x140004abd00 pc=0x10474e990
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).tryPollEvents(0x1400008ec30)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/loop.go:224 +0x3c fp=0x140004abd60 sp=0x140004abd40 pc=0x10475a5cc
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).runGL(0x1400008ec30)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/loop.go:102 +0x1b4 fp=0x140004abeb0 sp=0x140004abd60 pc=0x104759fc4
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).Run(0x1400008ec30)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/driver.go:80 +0x38 fp=0x140004abed0 sp=0x140004abeb0 pc=0x1047593b8
fyne.io/fyne/v2/internal/driver/glfw.(*window).ShowAndRun(0x14000109a40)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/window.go:450 +0x38 fp=0x140004abef0 sp=0x140004abed0 pc=0x10475f8b8
main.main()
/Users/virgil/workspace/personal/go/fyne/fyne_app/client/main.go:51 +0x3f4 fp=0x140004abf70 sp=0x140004abef0 pc=0x1048d2d84
runtime.main()
/opt/homebrew/Cellar/go/1.16.3/libexec/src/runtime/proc.go:225 +0x26c fp=0x140004abfd0 sp=0x140004abf70 pc=0x1044b6c3c
runtime.goexit()
/opt/homebrew/Cellar/go/1.16.3/libexec/src/runtime/asm_arm64.s:1130 +0x4 fp=0x140004abfd0 sp=0x140004abfd0 pc=0x1044e7a44

goroutine 19 [sleep]:
time.Sleep(0x22ecb25c00)
/opt/homebrew/Cellar/go/1.16.3/libexec/src/runtime/time.go:193 +0xc4
fyne.io/fyne/v2/internal/painter.svgCacheJanitor.func1()
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/painter/svg_cache.go:57 +0xe0
sync.(*Once).doSlow(0x106429b68, 0x140000baca0)
/opt/homebrew/Cellar/go/1.16.3/libexec/src/sync/once.go:68 +0x120
sync.(*Once).Do(0x106429b68, 0x140000baca0)
/opt/homebrew/Cellar/go/1.16.3/libexec/src/sync/once.go:59 +0x44
created by fyne.io/fyne/v2/internal/painter.svgCacheJanitor
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/painter/svg_cache.go:55 +0x9c

goroutine 20 [select]:
fyne.io/fyne/v2/data/binding.makeInfiniteQueue.func1(0x14000090120, 0x140000bc0b0)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/data/binding/queue.go:36 +0xf8
created by fyne.io/fyne/v2/data/binding.makeInfiniteQueue
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/data/binding/queue.go:21 +0xa0

goroutine 21 [chan receive]:
fyne.io/fyne/v2/data/binding.processItems()
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/data/binding/queue.go:54 +0x3c
created by fyne.io/fyne/v2/data/binding.init.0
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/data/binding/queue.go:15 +0x30

goroutine 22 [chan receive]:
fyne.io/fyne/v2/app.newAppWithDriver.func1(0x140000904e0, 0x1400040cb60)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/app/app.go:120 +0x34
created by fyne.io/fyne/v2/app.newAppWithDriver
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/app/app.go:118 +0x1bc

goroutine 23 [syscall]:
syscall.syscall6(0x10477e4e0, 0x6, 0x0, 0x0, 0x1400004ae88, 0xa, 0x106429d10, 0x0, 0x0, 0x0)
/opt/homebrew/Cellar/go/1.16.3/libexec/src/runtime/sys_darwin.go:41 +0x1c
golang.org/x/sys/unix.kevent(0x6, 0x0, 0x0, 0x1400004ae88, 0xa, 0x106429d10, 0x0, 0x0, 0x0)
/Users/virgil/go/pkg/mod/golang.org/x/sys@v0.0.0-20200720211630-cb9d2d5c5666/unix/zsyscall_darwin_arm64.go:292 +0x80
golang.org/x/sys/unix.Kevent(0x6, 0x0, 0x0, 0x0, 0x1400004ae88, 0xa, 0xa, 0x106429d10, 0x14000090600, 0x0, ...)
/Users/virgil/go/pkg/mod/golang.org/x/sys@v0.0.0-20200720211630-cb9d2d5c5666/unix/syscall_bsd.go:413 +0x60
github.com/fsnotify/fsnotify.read(0x6, 0x1400004ae88, 0xa, 0xa, 0x106429d10, 0x1400004ae88, 0x0, 0xa, 0x0, 0x0)
/Users/virgil/go/pkg/mod/github.com/fsnotify/fsnotify@v1.4.9/kqueue.go:511 +0x50
github.com/fsnotify/fsnotify.(*Watcher).readEvents(0x140000bec60)
/Users/virgil/go/pkg/mod/github.com/fsnotify/fsnotify@v1.4.9/kqueue.go:274 +0x76c
created by github.com/fsnotify/fsnotify.NewWatcher
/Users/virgil/go/pkg/mod/github.com/fsnotify/fsnotify@v1.4.9/kqueue.go:62 +0x15c

goroutine 24 [chan receive]:
fyne.io/fyne/v2/app.watchFile.func1(0x140000bec60, 0x140000a3a40, 0x34, 0x140002cd140, 0x140002cd150)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/app/settings_desktop.go:42 +0x48
created by fyne.io/fyne/v2/app.watchFile
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/app/settings_desktop.go:41 +0xd4

goroutine 25 [syscall, locked to thread]:
github.com/go-gl/glfw/v3.3/glfw._Cfunc_glfwSwapBuffers(0x13f708ab0)
_cgo_gotypes.go:2364 +0x40
github.com/go-gl/glfw/v3.3/glfw.(*Window).SwapBuffers.func1(0x140000d0000)
/Users/virgil/go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20210311203641-62640a716d48/context.go:41 +0x50
github.com/go-gl/glfw/v3.3/glfw.(*Window).SwapBuffers(0x140000d0000)
/Users/virgil/go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20210311203641-62640a716d48/context.go:41 +0x28
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).repaintWindow.func1()
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/loop.go:171 +0xd8
fyne.io/fyne/v2/internal/driver/glfw.(*window).RunWithContext(0x14000109a40, 0x140004a9e90)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/window.go:1202 +0x50
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).repaintWindow(0x1400008ec30, 0x14000109a40)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/loop.go:154 +0x50
fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).startDrawThread.func1(0x1400008ec30, 0x14000090660, 0x1400008ecd0)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/loop.go:210 +0x278
created by fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).startDrawThread
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/loop.go:181 +0xac

goroutine 26 [chan receive]:
fyne.io/fyne/v2/internal/driver/glfw.(*window).runEventQueue(0x14000109a40)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/window.go:1262 +0x90
created by fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).createWindow.func1
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/window.go:1287 +0xfc

goroutine 27 [chan receive]:
fyne.io/fyne/v2/internal/driver/glfw.(*glCanvas).setupThemeListener.func1(0x140000906c0, 0x14000436000)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/canvas.go:495 +0x40
created by fyne.io/fyne/v2/internal/driver/glfw.(*glCanvas).setupThemeListener
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/driver/glfw/canvas.go:493 +0x94

goroutine 38 [chan receive]:
fyne.io/fyne/v2/internal/painter.SvgCacheMonitorTheme.func1(0x140003ca060)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/painter/svg_cache.go:109 +0x2c
created by fyne.io/fyne/v2/internal/painter.SvgCacheMonitorTheme
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/painter/svg_cache.go:107 +0x8c

goroutine 56 [chan receive]:
fyne.io/fyne/v2/internal/animation.(*Runner).runAnimations.func1(0x1400008fe00, 0x1400008ec80)
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/animation/runner.go:69 +0x218
created by fyne.io/fyne/v2/internal/animation.(*Runner).runAnimations
/Users/virgil/go/pkg/mod/fyne.io/fyne/v2@v2.0.2/internal/animation/runner.go:67 +0x54

r0 0x0
r1 0x0
r2 0x0
r3 0x0
r4 0x0
r5 0x2
r6 0x0
r7 0x1
r8 0x5b9
r9 0xc9d7360a523a8fa1
r10 0xcccccccccccccccd
r11 0xa
r12 0x0
r13 0x32
r14 0x2000001100004e8
r15 0x1efec03e0
r16 0x148
r17 0x1eb84b330
r18 0x150033940
r19 0x6
r20 0x1069a3d40
r21 0x303
r22 0x1069a3e20
r23 0x1e5d5f000
r24 0x10
r25 0x1e5f1a000
r26 0x18d569128
r27 0x0
r28 0x0
r29 0x16b97da70
lr 0x185c05c24
sp 0x16b97da50
pc 0x185bd4cec
fault 0x185bd4cec

@bloeys
Copy link

bloeys commented May 4, 2021

Can confirm this is also happening on windows 10 with Go v1.16.3 and Fyne v2.0.3 (require fyne.io/fyne/v2 v2.0.3).
This is on a very simple test app with only two Entry fields and a button (login form) and no other logic.

Simply resizing the window quickly produces the crash.

@andydotxyz
Copy link
Member

Are you on macOS Big Sur on an M1 processor as well @bloeys?

@bloeys
Copy link

bloeys commented May 5, 2021

@andydotxyz No this happened on Windows 10, Go v1.16.3 and Fyne v2.0.3

@andydotxyz andydotxyz added bug Something isn't working and removed not an issue This doesn't seem right labels Jul 30, 2021
@andydotxyz
Copy link
Member

@bloeys can you please post the crash log you see on Windows?

@bloeys
Copy link

bloeys commented Jul 31, 2021

Sorry I can't reproduce with my newer setup ( go1.16.6 windows/amd64).
Instead, now I get these logs when resizing quickly but no crashing or visible issues: PlatformError: WGL: Failed to make context current: The requested transformation operation is not supported.

Potentially the version fixed something, but I can't test now. Might have some time later to install and test with an older go version.

@changkun
Copy link
Member

changkun commented Sep 5, 2021

I believe this is a general issue with the upstream dependency glfw.

This is a simple reproducer that crashes not only on M1 macs but also on Windows (NVIDIA, 2080, driver version 471):

package main

import (
	"math/rand"
	"time"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/widget"
)

func main() {
	w := app.New().NewWindow("x")

	w.SetContent(widget.NewLabel("Hello Fyne!"))

	go func() {
		tk := time.NewTicker(time.Millisecond)
		for range tk.C {
			width := rand.Float32()*1000 + 1
			height := rand.Float32()*1000 + 1
			w.Resize(fyne.Size{Width: width, Height: height})
		}
	}()
	w.ShowAndRun()
}

The reason is, as explained in PR #2429, all draw calls are executed from a draw thread, but glfw itself works with the underlying frame buffer on a different thread. There are multiple race conditions:

  1. glClear, glClearColor race with frame buffer resizing event
  2. glDrawArray races with frame buffer resizing event
  3. glfwSwapBuffer races with the above GL Calls

To entirely address the issue, if fyne does not remove glfw dependency, one must move all draw calls back to the mainthread instead of doing it in a different thread, and of course, there are drawbacks: draw calls may block event handling on the mainthread, and event handling can also block draw events. A solution might be using a command buffer to cache all draw commands and execute them as a batch on the mainthread, but apparently, it will be a significant change.

@andydotxyz
Copy link
Member

We needed to move from drawing on the main thread to drawing on the draw thread so that applications could repaint during a resize operation (from when mouse makes first move to when mouse is released).
Doing this should not require race conditions as it is a recognised model for using GLFW - perhaps we need to move SwapBuffer or some other code executing on main thread.

Perhaps this should be revisited after the async-resize code lands? (#960)

@andydotxyz
Copy link
Member

It would be good to test on latest develop now the resize code is improved.

@andydotxyz
Copy link
Member

Sadly the async-resize does not seem to have fixed this but it has changed the stack.
No longer does it look like a clear GL race condition, the drawing is running on draw thread and main thread is waiting for it.

So I'm less sure why it happens now!

@changkun
Copy link
Member

changkun commented Sep 6, 2021

I still think the problem is a frame buffer race condition. The async-resize yet does not fix the driver frame buffer race.

As described in #2429, the race condition is:

  • ThreadMain. user drag the window -> mainthread receive resize event -> notify the change of frame buffer size (glfw side) -> GPU receives resize op
  • ThreadDraw. receive the resize event from mainthread -> resizes draw property -> conduct draw calls (fyne side) -> GPU receives draw op

The above GPU resize op and GPU draw op is racing on the frame buffer. If ThreadMain's resize op resizes the frame buffer to a smaller one, but the ThreadDraw's draw op is still drawing on a bigger frame buffer, it will lead to illegal memory access.

@changkun
Copy link
Member

changkun commented Sep 6, 2021

This is another evidence that the problem is from the upstream dependency glfw:

package main

import (
	"math/rand"
	"runtime"
	"time"

	"github.com/go-gl/glfw/v3.3/glfw"
)

func init() {
	runtime.LockOSThread()
}

func main() {
	err := glfw.Init()
	if err != nil {
		panic(err)
	}
	defer glfw.Terminate()

	window, err := glfw.CreateWindow(640, 480, "Testing", nil, nil)
	if err != nil {
		panic(err)
	}

	window.MakeContextCurrent()

	go func() {
		tk := time.NewTicker(time.Millisecond)
		for range tk.C {
			width := rand.Float32()*1000 + 1
			height := rand.Float32()*1000 + 1
			window.SetSize(int(width), int(height))
		}
	}()

	for !window.ShouldClose() {
		window.SwapBuffers()
		glfw.PollEvents()
	}
}

This program does not depend on fyne but still crashes (on Windows/NVIDIA exit status 0xc0000005).

@andydotxyz
Copy link
Member

Thanks for the clarity here, this is making sense.
Is the right approach going to be to fix in go-gl/glfw then?

@changkun
Copy link
Member

changkun commented Sep 7, 2021

Good question. But sadly I don't think it is going to be fixed as the problem is not yet being considered even from glfw/glfw side. See glfw/glfw#1682. An alternative solution to address the issue seems to need more investigation and experiments, such as gather draw calls in a draw command buffer, replace gl calls via modern driver (Metal, DX3D, etc).

@andydotxyz
Copy link
Member

I guess they think it is Win10 specific and not reproducible at this time.
Perhaps we can push them harder, or help them solve?

@andydotxyz andydotxyz changed the title error happens when using mouse drag to resize window Apple M1: error happens when using mouse drag to resize window Nov 20, 2021
@andydotxyz andydotxyz added the OS:macOS Tickets affecting only macOS label Nov 20, 2021
andydotxyz added a commit to andydotxyz/fyne that referenced this issue Nov 22, 2021
Downsize is resize is not as smooth, but upside does not crash.

Fixes fyne-io#2188
@andydotxyz andydotxyz added the blocker Items that would block a forthcoming release label Nov 22, 2021
@andydotxyz
Copy link
Member

There is a workaround in release branch now, so this can be considered resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker Items that would block a forthcoming release bug Something isn't working OS:macOS Tickets affecting only macOS
Projects
None yet
Development

No branches or pull requests

5 participants