fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
25.09k stars 1.39k forks source link

Fyne application doesn't terminate after all windows are closed. #2314

Open preze5 opened 3 years ago

preze5 commented 3 years ago

Describe the bug:

Fyne application "hangs" or to be precise: doesn't terminate after first window is closed. After running "my first app": https://developer.fyne.io/started/firstapp and clicking at any point in time an X button in upper right corner, the window closes, but application keeps running. I know that my environment is specific (windows 8.1) but unfortunately I'm obliged to use it. I would greatly appreciate any help with debugging. As mentioned below I tried to change go version, gcc compiler version, fyne version, but it doesn't help.

To Reproduce:

  1. Run the code from the example below
  2. Close the main window by clicking X - application stays up and running - the only way to stop it is kill it through task manager.
  3. I tried changing go version, I tried changing gcc version, the behavior stays the same.
  4. The issue seems very similar to https://github.com/fyne-io/fyne/issues/1252 however adding SetMaster doesn't help, also opening a new window doesn't help - it is visible, but clicking the close button on any of the windows closes both of them and "hangs" the application.
  5. The issue happens every time, during each run, making fyne not usable unfortunately.
  6. Adding pprof.Lookup("goroutine").WriteTo(os.Stdout, 1) after w.ShowAndRun() returns the following output:
    
    goroutine profile: total 9
    1 @ 0x7ff70bab4c75 0x7ff70bb1c892 0x7ff70bb35975 0x7ff70bb32d7a 0x7ff70bd79865 0x7ff70bb1fc61
    #       0x7ff70bb1c891  syscall.Syscall6+0xf1                                   c:/go/src/runtime/syscall_windows.go:343
    #       0x7ff70bb35974  syscall.getQueuedCompletionStatus+0xd4                  c:/go/src/syscall/zsyscall_windows.go:826
    #       0x7ff70bb32d79  syscall.GetQueuedCompletionStatus+0x79                  c:/go/src/syscall/syscall_windows.go:1226
    #       0x7ff70bd79864  github.com/fsnotify/fsnotify.(*Watcher).readEvents+0xa4 C:/work/go/pkg/mod/github.com/fsnotify/fsnotify@v1.4.9/windows.go:381

1 @ 0x7ff70baeeb9a 0x7ff70bab7e5a 0x7ff70bab7a8b 0x7ff70bcf281b 0x7ff70bb1fc61

0x7ff70bcf281a fyne.io/fyne/v2/internal/painter.SvgCacheMonitorTheme.func1+0x3a C:/work/go/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/painter/svg_cache.go:109

1 @ 0x7ff70baeeb9a 0x7ff70bab7e5a 0x7ff70bab7a8b 0x7ff70bd1886b 0x7ff70bb1fc61

0x7ff70bd1886a fyne.io/fyne/v2/data/binding.processItems+0x4a C:/work/go/pkg/mod/fyne.io/fyne/v2@v2.0.3/data/binding/queue.go:54

1 @ 0x7ff70baeeb9a 0x7ff70bab7e5a 0x7ff70bab7a8b 0x7ff70bd4d08e 0x7ff70bb1fc61

0x7ff70bd4d08d fyne.io/fyne/v2/internal/driver/glfw.(*glCanvas).setupThemeListener.func1+0x4d C:/work/go/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/driver/glfw/canvas.go:495

1 @ 0x7ff70baeeb9a 0x7ff70bab7e5a 0x7ff70bab7a8b 0x7ff70bd7e065 0x7ff70bb1fc61

0x7ff70bd7e064 fyne.io/fyne/v2/app.newAppWithDriver.func1+0x44 C:/work/go/pkg/mod/fyne.io/fyne/v2@v2.0.3/app/app.go:120

1 @ 0x7ff70baeeb9a 0x7ff70bab7e5a 0x7ff70bab7acb 0x7ff70bd7e49f 0x7ff70bb1fc61

0x7ff70bd7e49e fyne.io/fyne/v2/app.watchFile.func1+0x5e C:/work/go/pkg/mod/fyne.io/fyne/v2@v2.0.3/app/settings_desktop.go:42

1 @ 0x7ff70baeeb9a 0x7ff70bafe368 0x7ff70bd18a45 0x7ff70bb1fc61

0x7ff70bd18a44 fyne.io/fyne/v2/data/binding.makeInfiniteQueue.func1+0x164 C:/work/go/pkg/mod/fyne.io/fyne/v2@v2.0.3/data/binding/queue.go:36

1 @ 0x7ff70baeeb9a 0x7ff70bb1cca5 0x7ff70bcf26dd 0x7ff70bb2bf37 0x7ff70bb2be2c 0x7ff70bb1fc61

0x7ff70bb1cca4 time.Sleep+0xe4 c:/go/src/runtime/time.go:193

0x7ff70bcf26dc fyne.io/fyne/v2/internal/painter.svgCacheJanitor.func1+0x11c C:/work/go/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/painter/svg_cache.go:57

0x7ff70bb2bf36 sync.(*Once).doSlow+0xf6 c:/go/src/sync/once.go:68

0x7ff70bb2be2b sync.(*Once).Do+0x4b c:/go/src/sync/once.go:59

1 @ 0x7ff70bb19685 0x7ff70bbb86b5 0x7ff70bbb8467 0x7ff70bbb4f38 0x7ff70bd7eb9d 0x7ff70baee776 0x7ff70bb1fc61

0x7ff70bb19684 runtime/pprof.runtime_goroutineProfileWithLabels+0x64 c:/go/src/runtime/mprof.go:716

0x7ff70bbb86b4 runtime/pprof.writeRuntimeProfile+0xd4 c:/go/src/runtime/pprof/pprof.go:724

0x7ff70bbb8466 runtime/pprof.writeGoroutine+0xa6 c:/go/src/runtime/pprof/pprof.go:684

0x7ff70bbb4f37 runtime/pprof.(*Profile).WriteTo+0x3f7 c:/go/src/runtime/pprof/pprof.go:331

0x7ff70bd7eb9c main.main+0x2bc C:/work/go/fyne/main.go:35

0x7ff70baee775 runtime.main+0x255 c:/go/src/runtime/proc.go:225


### Example code:
```go
package main

import (
    "fyne.io/fyne/v2/app"
    "fyne.io/fyne/v2/container"
    "fyne.io/fyne/v2/widget"
)

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

    hello := widget.NewLabel("Hello Fyne!")
    w.SetContent(container.NewVBox(
        hello,
        widget.NewButton("Hi!", func() {
            hello.SetText("Welcome :)")
        }),
    ))

    w.ShowAndRun()
}

-->

Device (please complete the following information):

andydotxyz commented 3 years ago

Can you please run a debugger and see what is in block/wait state once ShowAndRun exits? In theory once you reach that WriteTo call all of the Fyne drivers have unloaded and the app should quit.

preze5 commented 3 years ago

I added a loop which prints out running goroutines every 5 seconds after w.ShowAndRun() and the list stays the same:

1 @ 0x7ff6356a51d5 0x7ff635716985 0x7ff63577ca05 0x7ff635779aec 0x7ff635a8cd71 0x7ff635719c81
#   0x7ff635716984  syscall.Syscall6+0xc4                   c:/go/src/runtime/syscall_windows.go:343
#   0x7ff63577ca04  syscall.getQueuedCompletionStatus+0xe4          c:/go/src/syscall/zsyscall_windows.go:826
#   0x7ff635779aeb  syscall.GetQueuedCompletionStatus+0xab          c:/go/src/syscall/syscall_windows.go:1226
#   0x7ff635a8cd70  github.com/fsnotify/fsnotify.(*Watcher).readEvents+0xb0 C:/work/go/pkg/mod/github.com/fsnotify/fsnotify@v1.4.9/windows.go:381

1 @ 0x7ff6356e64d6 0x7ff6356a8309 0x7ff6356a802b 0x7ff6359e329f 0x7ff635719c81
#   0x7ff6359e329e  fyne.io/fyne/v2/internal/painter.SvgCacheMonitorTheme.func1+0x3e    C:/work/go/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/painter/svg_cache.go:109

1 @ 0x7ff6356e64d6 0x7ff6356a8309 0x7ff6356a802b 0x7ff635a0f38f 0x7ff635719c81
#   0x7ff635a0f38e  fyne.io/fyne/v2/data/binding.processItems+0x4e  C:/work/go/pkg/mod/fyne.io/fyne/v2@v2.0.3/data/binding/queue.go:54

1 @ 0x7ff6356e64d6 0x7ff6356a8309 0x7ff6356a802b 0x7ff635a58fc5 0x7ff635719c81
#   0x7ff635a58fc4  fyne.io/fyne/v2/internal/driver/glfw.(*glCanvas).setupThemeListener.func1+0x44  C:/work/go/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/driver/glfw/canvas.go:495

1 @ 0x7ff6356e64d6 0x7ff6356a8309 0x7ff6356a802b 0x7ff635a933e8 0x7ff635719c81
#   0x7ff635a933e7  fyne.io/fyne/v2/app.newAppWithDriver.func1+0x47 C:/work/go/pkg/mod/fyne.io/fyne/v2@v2.0.3/app/app.go:120

1 @ 0x7ff6356e64d6 0x7ff6356a8309 0x7ff6356a806b 0x7ff635a93865 0x7ff635719c81
#   0x7ff635a93864  fyne.io/fyne/v2/app.watchFile.func1+0x64    C:/work/go/pkg/mod/fyne.io/fyne/v2@v2.0.3/app/settings_desktop.go:42

1 @ 0x7ff6356e64d6 0x7ff6356f6717 0x7ff635a0f786 0x7ff635719c81
#   0x7ff635a0f785  fyne.io/fyne/v2/data/binding.makeInfiniteQueue.func1+0x265  C:/work/go/pkg/mod/fyne.io/fyne/v2@v2.0.3/data/binding/queue.go:36

1 @ 0x7ff6356e64d6 0x7ff635716d05 0x7ff6359e3052 0x7ff635743302 0x7ff6357431af 0x7ff635719c81
#   0x7ff635716d04  time.Sleep+0xe4                         c:/go/src/runtime/time.go:193
#   0x7ff6359e3051  fyne.io/fyne/v2/internal/painter.svgCacheJanitor.func1+0x51 C:/work/go/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/painter/svg_cache.go:57
#   0x7ff635743301  sync.(*Once).doSlow+0x121                   c:/go/src/sync/once.go:68
#   0x7ff6357431ae  sync.(*Once).Do+0x4e                        c:/go/src/sync/once.go:59

1 @ 0x7ff635713905 0x7ff6357fcd22 0x7ff6357fc905 0x7ff6357f7614 0x7ff635a94199 0x7ff6356e60d6 0x7ff635719c81
#   0x7ff635713904  runtime/pprof.runtime_goroutineProfileWithLabels+0x64   c:/go/src/runtime/mprof.go:716
#   0x7ff6357fcd21  runtime/pprof.writeRuntimeProfile+0x1a1         c:/go/src/runtime/pprof/pprof.go:724
#   0x7ff6357fc904  runtime/pprof.writeGoroutine+0xc4           c:/go/src/runtime/pprof/pprof.go:684
#   0x7ff6357f7613  runtime/pprof.(*Profile).WriteTo+0xb3           c:/go/src/runtime/pprof/pprof.go:331
#   0x7ff635a94198  main.main+0x318                     c:/work/go/fyne/main.go:39
#   0x7ff6356e60d5  runtime.main+0x215                  c:/go/src/runtime/proc.go:225

It also aligns with what I see in dlv - to sum up the following functions related to fyne are in the constant running state: fyne.io/fyne/v2/data/binding.makeInfiniteQueue.func1 fyne.io/fyne/v2/app.watchFile.func1 fyne.io/fyne/v2/app.newAppWithDriver.func1 fyne.io/fyne/v2/internal/driver/glfw.(*glCanvas).setupThemeListener.func1+ fyne.io/fyne/v2/data/binding.processItems fyne.io/fyne/v2/internal/painter.SvgCacheMonitorTheme.func1 There is also a thread in time.Sleep from fyne.io/fyne/v2/internal/painter.svgCacheJanitor.func1

Does it answer your question?

andydotxyz commented 3 years ago

Does it answer your question?

Hmm, not really - none of them are in a blocking state it seems. It should only be the main() goroutine that can keep the app open when running, all of the others should close automatically... That is what happens on all other platforms so I'm not sure how Windows 8 would be different.

hkparker commented 3 years ago

I've noticed in my environment (Fyne 2.0.3 / Go 1.16 / Arch Linux / X11) the close button in the top right corner of the window often does not close the application (both my own applications and the Fyne demo), it just causes it to hang (still displaying the window). This seems to occur randomly. I have found a reliable workaround however, which hopefully will shed some light on the source of the bug.

mainWindow.SetCloseIntercept(func() {
    myApp.Quit()
})
andydotxyz commented 3 years ago

If you are able to see if any goroutines are blocking after you ask the window to close that could be helpful. Or see where processor is still being used as we could be in a non-blocking loop somewhere.

hkparker commented 3 years ago

One thought I had is that it could be a deadlock due to an attempt to get a Lock on a mutex that's already locked. I tried to trace though the code path that interacts with the close intercept callback and saw a number of locks but didn't find anything that supported that theory. It just feels like it's locked indefinitely.

I'll see if I can get more useful output on Go's internal state at that point when I can.

andydotxyz commented 3 years ago

I'll see if I can get more useful output on Go's internal state at that point when I can.

Thanks :)

hkparker commented 3 years ago

I spoke too soon, my snippet is not a 100% fix, but it reduces the hang from 50% of the time to 0.1% of the time. And now I'm occasionally getting segfault panics at close (very rare). I'm not sure if they are related to this underlying issue, or to my "fix".

Here's one of the traces. I don't have any insights to offer on it yet but posting now in case it's helpful.

panic trace ``` [signal SIGSEGV: segmentation violation code=0x1 addr=0xf8 pc=0x7f7a4f320424] runtime stack: runtime.throw(0xf4ebfa, 0x2a) /usr/lib/go/src/runtime/panic.go:1117 +0x72 runtime.sigpanic() /usr/lib/go/src/runtime/signal_unix.go:718 +0x2e5 goroutine 14 [syscall, locked to thread]: runtime.cgocall(0xdd1140, 0xc00009fd78, 0x3124030) /usr/lib/go/src/runtime/cgocall.go:154 +0x5b fp=0xc00009fd48 sp=0xc00009fd10 pc=0x4c433b github.com/go-gl/gl/v3.2-core/gl._Cfunc_glowClear(0x7f7a4ed7c700, 0x3e4243c500004100) _cgo_gotypes.go:3660 +0x3c fp=0xc00009fd78 sp=0xc00009fd48 pc=0xa01c3c github.com/go-gl/gl/v3.2-core/gl.Clear(...) /my_gopath/pkg/mod/github.com/go-gl/gl@v0.0.0-20190320180904-bf2b1f2f34d7/v3.2-core/gl/package.go:8667 fyne.io/fyne/v2/internal/painter/gl.(*glPainter).glClearBuffer(0xc0003b2000) /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/painter/gl/gl_core.go:188 +0xe6 fp=0xc00009fda0 sp=0xc00009fd78 pc=0xa24d86 fyne.io/fyne/v2/internal/painter/gl.(*glPainter).Clear(0xc0003b2000) /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/painter/gl/painter.go:53 +0x2b fp=0xc00009fdb8 sp=0xc00009fda0 pc=0xa254cb fyne.io/fyne/v2/internal/driver/glfw.(*glCanvas).paint(0xc000378000, 0x44160000447d44ed) /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/driver/glfw/canvas.go:431 +0x8a fp=0xc00009fe30 sp=0xc00009fdb8 pc=0xa3b76a fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).repaintWindow.func1() /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/driver/glfw/loop.go:163 +0x88 fp=0xc00009fe80 sp=0xc00009fe30 pc=0xa48928 fyne.io/fyne/v2/internal/driver/glfw.(*window).RunWithContext(0xc0000db6c0, 0xc00009fea8) /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/driver/glfw/window.go:1204 +0x4f fp=0xc00009fe98 sp=0xc00009fe80 pc=0xa46faf fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).repaintWindow(0xc0000889b0, 0xc0000db6c0) /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/driver/glfw/loop.go:154 +0x65 fp=0xc00009fed0 sp=0xc00009fe98 pc=0xa3de65 fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).startDrawThread.func1(0xc0000889b0, 0xc000042900, 0xc000088af0) /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/driver/glfw/loop.go:210 +0x309 fp=0xc00009ffc8 sp=0xc00009fed0 pc=0xa48d29 runtime.goexit() /usr/lib/go/src/runtime/asm_amd64.s:1371 +0x1 fp=0xc00009ffd0 sp=0xc00009ffc8 pc=0x52cde1 created by fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).startDrawThread /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/driver/glfw/loop.go:181 +0xbd goroutine 1 [semacquire, locked to thread]: sync.runtime_Semacquire(0xc0000db858) /usr/lib/go/src/runtime/sema.go:56 +0x45 sync.(*WaitGroup).Wait(0xc0000db850) /usr/lib/go/src/sync/waitgroup.go:130 +0x65 fyne.io/fyne/v2/internal/driver/glfw.(*window).waitForEvents(...) /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/driver/glfw/window.go:1271 fyne.io/fyne/v2/internal/driver/glfw.(*window).destroy(0xc0000db6c0, 0xc0000889b0) /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/driver/glfw/window.go:505 +0xa5 fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).runGL(0xc0000889b0) /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/driver/glfw/loop.go:120 +0x5c9 fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).Run(0xc0000889b0) /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/driver/glfw/driver.go:80 +0x3a fyne.io/fyne/v2/app.(*fyneApp).Run(0xc000344380) /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/app/app.go:66 +0x95 github.com/hkparker/myproject/ui.(*Fyne).Run(0xc0000ca180) /my_gopath/src/github.com/hkparker/myproject/ui/fyne.go:99 +0x33 github.com/hkparker/myproject/thing.Start(0x1031c90, 0xc000088960, 0x1034608, 0xc0000ca180) /my_gopath/src/github.com/hkparker/myproject/thing/thing.go:49 +0x18c main.main() /my_gopath/src/github.com/hkparker/myproject/main.go:10 +0x77 goroutine 6 [select]: fyne.io/fyne/v2/data/binding.makeInfiniteQueue.func1(0xc000042300, 0xc0000103d0) /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/data/binding/queue.go:36 +0x145 created by fyne.io/fyne/v2/data/binding.makeInfiniteQueue /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/data/binding/queue.go:21 +0xb1 goroutine 7 [chan receive]: fyne.io/fyne/v2/data/binding.processItems() /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/data/binding/queue.go:54 +0x45 created by fyne.io/fyne/v2/data/binding.init.0 /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/data/binding/queue.go:15 +0x35 goroutine 8 [sleep]: time.Sleep(0x22ecb25c00) /usr/lib/go/src/runtime/time.go:193 +0xd2 fyne.io/fyne/v2/internal/painter.svgCacheJanitor.func1() /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/painter/svg_cache.go:57 +0x109 sync.(*Once).doSlow(0x1918558, 0xc0000378b0) /usr/lib/go/src/sync/once.go:68 +0xec sync.(*Once).Do(0x1918558, 0xc0000378b0) /usr/lib/go/src/sync/once.go:59 +0x45 created by fyne.io/fyne/v2/internal/painter.svgCacheJanitor /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/painter/svg_cache.go:55 +0x9b goroutine 9 [syscall]: syscall.Syscall6(0xe8, 0x7, 0xc00040fc2c, 0x7, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, 0x0) /usr/lib/go/src/syscall/asm_linux_amd64.s:43 +0x5 golang.org/x/sys/unix.EpollWait(0x7, 0xc00040fc2c, 0x7, 0x7, 0xffffffffffffffff, 0x0, 0x0, 0x0) /my_gopath/pkg/mod/golang.org/x/sys@v0.0.0-20210423082822-04245dca01da/unix/zsyscall_linux_amd64.go:77 +0x72 github.com/fsnotify/fsnotify.(*fdPoller).wait(0xc00003cd80, 0x0, 0x0, 0x0) /my_gopath/pkg/mod/github.com/fsnotify/fsnotify@v1.4.9/inotify_poller.go:86 +0x91 github.com/fsnotify/fsnotify.(*Watcher).readEvents(0xc000088a50) /my_gopath/pkg/mod/github.com/fsnotify/fsnotify@v1.4.9/inotify.go:192 +0x206 created by github.com/fsnotify/fsnotify.NewWatcher /my_gopath/pkg/mod/github.com/fsnotify/fsnotify@v1.4.9/inotify.go:59 +0x1ab goroutine 10 [chan receive]: fyne.io/fyne/v2/app.watchFile.func1(0xc000088a50, 0xc000041940, 0x36, 0xc000226dd0, 0xc000226de0) /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/app/settings_desktop.go:42 +0x5a created by fyne.io/fyne/v2/app.watchFile /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/app/settings_desktop.go:41 +0xef goroutine 11 [chan receive]: fyne.io/fyne/v2/app.newAppWithDriver.func1(0xc000042720, 0xc000344380) /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/app/app.go:120 +0x3d created by fyne.io/fyne/v2/app.newAppWithDriver /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/app/app.go:118 +0x1df goroutine 12 [syscall]: syscall.Syscall(0x3, 0xa, 0x0, 0x0, 0xc000228f28, 0xc00043de88, 0xc00043dc98) /usr/lib/go/src/syscall/asm_linux_amd64.s:20 +0x5 golang.org/x/sys/unix.Close(0xa, 0x0, 0x0) /my_gopath/pkg/mod/golang.org/x/sys@v0.0.0-20210423082822-04245dca01da/unix/zsyscall_linux.go:526 +0x45 github.com/fsnotify/fsnotify.(*Watcher).readEvents(0xc000088aa0) /my_gopath/pkg/mod/github.com/fsnotify/fsnotify@v1.4.9/inotify.go:189 +0xa36 created by github.com/fsnotify/fsnotify.NewWatcher /my_gopath/pkg/mod/github.com/fsnotify/fsnotify@v1.4.9/inotify.go:59 +0x1ab goroutine 13 [chan receive]: fyne.io/fyne/v2/app.watchFile.func1(0xc000088aa0, 0xc00003e4b0, 0x27, 0xc000226df0, 0xc000226e00) /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/app/settings_desktop.go:42 +0x5a created by fyne.io/fyne/v2/app.watchFile /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/app/settings_desktop.go:41 +0xef goroutine 15 [chan receive]: github.com/fsnotify/fsnotify.(*Watcher).Close(0xc000088aa0, 0xc000128010, 0x1) /my_gopath/pkg/mod/github.com/fsnotify/fsnotify@v1.4.9/inotify.go:85 +0x87 fyne.io/fyne/v2/app.(*settings).stopWatching(...) /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/app/settings_desktop.go:73 fyne.io/fyne/v2/app.(*fyneApp).Quit(0xc000344380) /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/app/app.go:75 +0xce github.com/hkparker/myproject/ui.(*Fyne).Quit(...) /my_gopath/src/github.com/hkparker/myproject/ui/fyne.go:103 github.com/hkparker/myproject/ui.(*Fyne).Build.func1() /my_gopath/src/github.com/hkparker/myproject/ui/fyne.go:67 +0x32 fyne.io/fyne/v2/internal/driver/glfw.(*window).runEventQueue(0xc0000db6c0) /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/driver/glfw/window.go:1265 +0x7a created by fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).createWindow.func1 /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/driver/glfw/window.go:1289 +0x113 goroutine 18 [chan receive]: fyne.io/fyne/v2/internal/driver/glfw.(*glCanvas).setupThemeListener.func1(0xc000122000, 0xc000378000) /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/driver/glfw/canvas.go:495 +0x47 created by fyne.io/fyne/v2/internal/driver/glfw.(*glCanvas).setupThemeListener /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/driver/glfw/canvas.go:493 +0xa6 goroutine 20 [chan receive]: fyne.io/fyne/v2/internal/animation.(*Runner).runAnimations.func1(0xc000150000, 0xc000088a00) /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/animation/runner.go:69 +0x27b created by fyne.io/fyne/v2/internal/animation.(*Runner).runAnimations /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/animation/runner.go:67 +0x56 goroutine 37 [chan receive]: fyne.io/fyne/v2/internal/painter.SvgCacheMonitorTheme.func1(0xc000240000) /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/painter/svg_cache.go:109 +0x34 created by fyne.io/fyne/v2/internal/painter.SvgCacheMonitorTheme /my_gopath/pkg/mod/fyne.io/fyne/v2@v2.0.3/internal/painter/svg_cache.go:107 +0x9c goroutine 39 [sleep]: time.Sleep(0x12a05f200) /usr/lib/go/src/runtime/time.go:193 +0xd2 github.com/hkparker/myproject/thing.simulate.func2(0x1034608, 0xc0000ca180, 0xf2c55f, 0x3, 0xf42718, 0x1a, 0xc0001242a0, 0x2, 0x2, 0xf2c189, ...) /my_gopath/src/github.com/hkparker/myproject/thing/simulate.go:67 +0x108 created by github.com/hkparker/myproject/thing.simulate /my_gopath/src/github.com/hkparker/myproject/thing/simulate.go:64 +0x8f7 exit status 2 ```
andydotxyz commented 3 years ago

Make sure you are working on develop branch as it's possible that SEGV was fixed already.

Jacalz commented 2 years ago

Is this still an issue on the latest releases?

hkparker commented 2 years ago

I haven't noticed anything in a while for what it's worth, but I can't say for sure that means it's resolved.

preze5 commented 2 years ago

The issue is still there at least in my case but I think I found the workaround/root cause. The issue in my case happens on VMWare guest system (Windows 8.1). The graphic driver used is VMWare Virtual SVGA 3D Graphics Adapter. The driver used is coming from VMWare, version 8.17.2.1. I moved my compiled binary to another VMWare guest system, but this time it was Windows 10. The driver was the same, just different version: 8.16.7.8. There it failed throwing an exception: APIUnavailable, the driver does not appear to support OpenGL. So what I did is used Mesa drivers with OpenGL software renderer. It then worked on Windows 10. So I also copied over the Mesa drivers back to Windows 8.1. Same binary, just with Mesa opengl driver in the same directory - all works flawlessly. So to sum-up - in my case it seems there is some bug in VMWare SVGA 3D Graphics driver which caused this issue. If anyone hits it in the future I would first recommend checking if all works well with software renderer.

pierrec commented 1 month ago

As a data point I am getting this segfault when closing a window (Sonoma 14.7) with Fyne 2.5.1 pretty often.

andydotxyz commented 1 month ago

As a data point I am getting this segfault when closing a window (Sonoma 14.7) with Fyne 2.5.1 pretty often.

This issue is not about a segfault. Please open a new issue.