Freezing in windows

in gotk3 this is a binding for gtk main loop its
gtk.Main()
i am not sure what u mean by gtkapplication but i used glade to design and i use gtkwindow as the main window

whitelisting the app in windows defender greatly reduced the number of times it freezes(now its about 1/10 times), but still the problem exist

the stack trace when freezing:
0x0000000000000000
ntdll.dll!ZwWaitForSingleObject+0x14
KERNELBASE.dll!WaitForSingleObjectEx+0x8e
app.exe+0x7229a

Unfortunately addr2line is not working, but you can use gdb in Windows to get a stacktrace with source info!

  1. Download and install inkscape
  2. Open the Inkscape installation folder and then the bin folder
  3. Start PowerShell / Command Prompt / Terminal (whatever) from that folder
  4. Open your app until you can repro the freeze
  5. Type gdb -p nnnn where nnnn is the PID of your app
  6. Type thread apply all bt
  7. Copy everything
  8. Type quit to close gdb

Thread 19 (Thread 10476.0x2838): #0 0x00007ff9b5bf0be1 in ?? () #1 0x00007ff9b5c1cace in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 18 (Thread 10476.0x2dd0): #0 0x00007ff9b5bedc04 in ?? () #1 0x00007ff9b384bea0 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 17 (Thread 10476.0x2c60): #0 0x00007ff9b5bed1d4 in ?? () #1 0x00007ff9b29810ab in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 16 (Thread 10476.0x6b8): #0 0x00007ff9b5bf0ae4 in ?? () #1 0x00007ff9b5bb4101 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 15 (Thread 10476.0x6bc): #0 0x00007ff9b5bedc04 in ?? () #1 0x00007ff9b384bea0 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 14 (Thread 10476.0x758): #0 0x00007ff9b5bf0ae4 in ?? () #1 0x00007ff9b5bb4101 in ?? () --Type for more, q to quit, c to continue without paging-- Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 13 (Thread 10476.0x76c): #0 0x00007ff9b5bedc04 in ?? () #1 0x00007ff9b384bea0 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 12 (Thread 10476.0x3428): #0 0x00007ff9b5bf0b44 in ?? () #1 0x00007ff9b5ba2e27 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 11 (Thread 10476.0x3424): #0 0x00007ff9b5bf0b44 in ?? () #1 0x00007ff9b5ba2e27 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 10 (Thread 10476.0x20c8): #0 0x00007ff9b5bed134 in ?? () #1 0x00007ff9b3811c4e in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 9 (Thread 10476.0x2970): #0 0x00007ff9b330a104 in ?? () #1 0x00007ff9b481129e in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 8 (Thread 10476.0x2ac): #0 0x00007ff9b5bed134 in ?? () --Type for more, q to quit, c to continue without paging-- #1 0x00007ff9b3811c4e in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 7 (Thread 10476.0x32ac): #0 0x00007ff9b5befee4 in ?? () #1 0x00007ff9b3919394 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 6 (Thread 10476.0x3164): #0 0x00007ff9b5bedc04 in ?? () #1 0x00007ff9b384bea0 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 5 (Thread 10476.0x303c): #0 0x00007ff9b5bf0ae4 in ?? () #1 0x00007ff9b5bb4101 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 4 (Thread 10476.0x3a98): #0 0x00007ff9b5bf0b44 in ?? () #1 0x00007ff9b5ba2e27 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 3 (Thread 10476.0x2f48): #0 0x00007ff9b5bf0b44 in ?? () #1 0x00007ff9b5ba2e27 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 2 (Thread 10476.0x2758): --Type for more, q to quit, c to continue without paging-- #0 0x00007ff9b5bf0b44 in ?? () #1 0x00007ff9b5ba2e27 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thread 1 (Thread 10476.0x27d4): #0 0x00007ff9b5bed134 in ?? () #1 0x00007ff9b3811c4e in ?? ()

Ah sorry, GDB is not able to capture stacktraces of GO programs reliably. From https://go.dev/doc/gdb:

GDB does not understand Go programs well. The stack management, threading, and runtime contain aspects that differ enough from the execution model GDB expects that they can confuse the debugger and cause incorrect results even when the program is compiled with gccgo. As a consequence, although GDB can be useful in some situations (e.g., debugging Cgo code, or debugging the runtime itself), it is not a reliable debugger for Go programs

What I’d suggest then is to use Delve as outlined in Golang Debugging With Delve [Step by Step] | Golang Cafe. Start your app in Delve and when it freezes press Ctrl+C to pause the application. Then type commands like threads and goroutines -urgs -t 30. Refer to delve/Documentation/cli/README.md at master · go-delve/delve · GitHub for more infos

(dlv) threads Thread 748 at :0 Thread 1644 at :0 Thread 2032 at :0 Thread 2152 at :0 Thread 2156 at :0 Thread 2352 at :0 Thread 2360 at :0 Thread 2472 at :0 * Thread 3308 at :0 Thread 3820 at :0 Thread 4236 at :0 Thread 4732 at :0 Thread 4756 at :0 Thread 6608 at :0 Thread 6704 at :0 Thread 10460 at :0 Thread 11456 at :0 Thread 13484 at :0 Thread 14476 at :0 Thread 14880 at :0 (dlv) goroutines -urgs -t 30 Command failed: wrong argument: ‘-urgs’ (dlv) goroutines -t 30 Goroutine 1 - User: _cgo_gotypes.go:17486 github.com/gotk3/gotk3/gtk._Cfunc_gtk_main (0x7ff7f8438ba9) (thread 2472) [chan receive] 0 0x00007ffd0b0fa104 in ??? at ?:-1 1 0x00007ff7f828ea28 in runtime.systemstack_switch at /usr/lib/golang/src/runtime/asm_amd64.s:474 2 0x00007ff7f8229132 in runtime.cgocall at /usr/lib/golang/src/runtime/cgocall.go:175 3 0x00007ff7f8438ba9 in github.com/gotk3/gotk3/gtk._Cfunc_gtk_main at _cgo_gotypes.go:17486 4 0x00007ff7f896c70a in github.com/gotk3/gotk3/gtk.Main at /root/go/pkg/mod/github.com/gotk3/gotk3@v0.6.3/gtk/gtk.go:1242 5 0x00007ff7f896c70a in starclub/internal/gui.Launch at /root/go/src/starclub/internal/gui/maingui.go:181 6 0x00007ff7f89772d7 in main.main at /root/go/src/starclub/cmd/main/main.go:31 7 0x00007ff7f826070b in runtime.main at /usr/lib/golang/src/runtime/proc.go:271 8 0x00007ff7f8290a61 in runtime.goexit at /usr/lib/golang/src/runtime/asm_amd64.s:1695 Goroutine 2 - User: /usr/lib/golang/src/runtime/proc.go:403 runtime.gopark (0x7ff7f8260b0e) [force gc (idle)] 0 0x00007ff7f8260b0e in runtime.gopark at /usr/lib/golang/src/runtime/proc.go:403 1 0x00007ff7f8260998 in runtime.goparkunlock at /usr/lib/golang/src/runtime/proc.go:408 2 0x00007ff7f8260998 in runtime.forcegchelper at /usr/lib/golang/src/runtime/proc.go:326 3 0x00007ff7f8290a61 in runtime.goexit at /usr/lib/golang/src/runtime/asm_amd64.s:1695 Goroutine 3 - User: /usr/lib/golang/src/runtime/proc.go:403 runtime.gopark (0x7ff7f8260b0e) [GC sweep wait] 0 0x00007ff7f8260b0e in runtime.gopark Sending output to pager… Goroutine 1 - User: _cgo_gotypes.go:17486 github.com/gotk3/gotk3/gtk._Cfunc_gtk_main (0x7ff7f8438ba9) (thread 2472) [chan receive] 0 0x00007ffd0b0fa104 in ←[1m???←[0m at ←[1m?:-1←[0m 1 0x00007ff7f828ea28 in ←[1mruntime.systemstack_switch←[0m at /usr/lib/golang/src/runtime/←[1masm_amd64.s:474←[0m 2 0x00007ff7f8229132 in ←[1mruntime.cgocall←[0m at /usr/lib/golang/src/runtime/←[1mcgocall.go:175←[0m 3 0x00007ff7f8438ba9 in ←[1mgithub.com/gotk3/gotk3/gtk._Cfunc_gtk_main←[0m at ←[1m_cgo_gotypes.go:17486←[0m 4 0x00007ff7f896c70a in ←[1mgithub.com/gotk3/gotk3/gtk.Main←[0m at /root/go/pkg/mod/github.com/gotk3/gotk3@v0.6.3/gtk/←[1mgtk.go:1242←[0m 5 0x00007ff7f896c70a in ←[1mstarclub/internal/gui.Launch←[0m at /root/go/src/starclub/internal/gui/←[1mmaingui.go:181←[0m 6 0x00007ff7f89772d7 in ←[1mmain.main←[0m at /root/go/src/starclub/cmd/main/←[1mmain.go:31←[0m 7 0x00007ff7f826070b in ←[1mruntime.main←[0m at /usr/lib/golang/src/runtime/←[1mproc.go:271←[0m 8 0x00007ff7f8290a61 in ←[1mruntime.goexit←[0m at /usr/lib/golang/src/runtime/←[1masm_amd64.s:1695←[0m Goroutine 2 - User: /usr/lib/golang/src/runtime/proc.go:403 runtime.gopark (0x7ff7f8260b0e) [force gc (idle)] 0 0x00007ff7f8260b0e in ←[1mruntime.gopark←[0m at /usr/lib/golang/src/runtime/←[1mproc.go:403←[0m 1 0x00007ff7f8260998 in ←[1mruntime.goparkunlock←[0m at /usr/lib/golang/src/runtime/←[1mproc.go:408←[0m 2 0x00007ff7f8260998 in ←[1mruntime.forcegchelper←[0m at /usr/lib/golang/src/runtime/←[1mproc.go:326←[0m 3 0x00007ff7f8290a61 in ←[1mruntime.goexit←[0m at /usr/lib/golang/src/runtime/←[1masm_amd64.s:1695←[0m Goroutine 3 - User: /usr/lib/golang/src/runtime/proc.go:403 runtime.gopark (0x7ff7f8260b0e) [GC sweep wait] 0 0x00007ff7f8260b0e in ←[1mruntime.gopark←[0m at /usr/lib/golang/src/runtime/←[1mproc.go:403←[0m 1 0x00007ff7f824abd4 in ←[1mruntime.goparkunlock←[0m at /usr/lib/golang/src/runtime/←[1mproc.go:408←[0m 2 0x00007ff7f824abd4 in ←[1mruntime.bgsweep←[0m at /usr/lib/golang/src/runtime/←[1mmgcsweep.go:278←[0m 3 0x00007ff7f823f4e5 in ←[1mruntime.gcenable.gowrap1←[0m at /usr/lib/golang/src/runtime/←[1mmgc.go:203←[0m 4 0x00007ff7f8290a61 in ←[1mruntime.goexit←[0m at /usr/lib/golang/src/runtime/←[1masm_amd64.s:1695←[0m Goroutine 4 - User: /usr/lib/golang/src/runtime/proc.go:403 runtime.gopark (0x7ff7f8260b0e) [GC scavenge wait] 0 0x00007ff7f8260b0e in ←[1mruntime.gopark←[0m at /usr/lib/golang/src/runtime/←[1mproc.go:403←[0m 1 0x00007ff7f82485c9 in ←[1mruntime.goparkunlock←[0m at /usr/lib/golang/src/runtime/←[1mproc.go:408←[0m 2 0x00007ff7f82485c9 in ←[1mruntime.(*scavengerState).park←[0m at /usr/lib/golang/src/runtime/←[1mmgcscavenge.go:425←[0m 3 0x00007ff7f8248b5c in ←[1mruntime.bgscavenge←[0m at /usr/lib/golang/src/runtime/←[1mmgcscavenge.go:653←[0m 4 0x00007ff7f823f485 in ←[1mruntime.gcenable.gowrap2←[0m at /usr/lib/golang/src/runtime/←[1mmgc.go:204←[0m 5 0x00007ff7f8290a61 in ←[1mruntime.goexit←[0m at /usr/lib/golang/src/runtime/←[1masm_amd64.s:1695←[0m Goroutine 5 - User: /usr/lib/golang/src/database/sql/sql.go:1246 database/sql.(*DB).connectionOpener (0x7ff7f832df67) [select] 0 0x00007ff7f8260b0e in ←[1mruntime.gopark←[0m at /usr/lib/golang/src/runtime/←[1mproc.go:403←[0m 1 0x00007ff7f8270f45 in ←[1mruntime.selectgo←[0m at /usr/lib/golang/src/runtime/←[1mselect.go:327←[0m 2 0x00007ff7f832df67 in ←[1mdatabase/sql.(*DB).connectionOpener←[0m at /usr/lib/golang/src/database/sql/←[1msql.go:1246←[0m 3 0x00007ff7f832c288 in ←[1mdatabase/sql.OpenDB.gowrap1←[0m at /usr/lib/golang/src/database/sql/←[1msql.go:824←[0m 4 0x00007ff7f8290a61 in ←[1mruntime.goexit←[0m at /usr/lib/golang/src/runtime/←[1masm_amd64.s:1695←[0m Goroutine 6 - User: /usr/lib/golang/src/runtime/time.go:195 time.Sleep (0x7ff7f828d97a) [sleep] 0 0x00007ff7f8260b0e in ←[1mruntime.gopark←[0m at /usr/lib/golang/src/runtime/←[1mproc.go:403←[0m 1 0x00007ff7f828d97a in ←[1mtime.Sleep←[0m at /usr/lib/golang/src/runtime/←[1mtime.go:195←[0m 2 0x00007ff7f8964214 in ←[1mstarclub/internal/noty.ExpireThread←[0m at /root/go/src/starclub/internal/noty/←[1mexpcalc.go:62←[0m 3 0x00007ff7f897738f in ←[1mmain.main.func1←[0m at /root/go/src/starclub/cmd/main/←[1mmain.go:27←[0m 4 0x00007ff7f8290a61 in ←[1mruntime.goexit←[0m at /usr/lib/golang/src/runtime/←[1masm_amd64.s:1695←[0m Goroutine 18 - User: /usr/lib/golang/src/runtime/proc.go:403 runtime.gopark (0x7ff7f8260b0e) [finalizer wait] 0 0x00007ff7f8260b0e in ←[1mruntime.gopark←[0m at /usr/lib/golang/src/runtime/←[1mproc.go:403←[0m 1 0x00007ff7f823e567 in ←[1mruntime.runfinq←[0m at /usr/lib/golang/src/runtime/←[1mmfinal.go:194←[0m 2 0x00007ff7f8290a61 in ←[1mruntime.goexit←[0m at /usr/lib/golang/src/runtime/←[1masm_amd64.s:1695←[0m [7 goroutines]

i did a stack trace for what i think is the freezed thread i got a null pointer error but not sure from which part of the code it is
the stack trace :
stack -full -offsets 0 0x00007ffd0d96d134 in ??? at ?:-1 frame: +0xe714bff8b0 frame pointer +0xe714bff8a0 1 0x00007ff7f829062d in runtime.asmcgocall_landingpad at /usr/lib/golang/src/runtime/asm_amd64.s:867 frame: +0xe714bff8e0 frame pointer +0xe714bff8d0 2 0x00007ff7f82906e1 in runtime.asmcgocall at /usr/lib/golang/src/runtime/asm_amd64.s:946 frame: +0xe714bff8f0 frame pointer +0xe714bff8f0 3 0x0000000000000000 in ??? at ?:-1 frame: +0xe714bff900 frame pointer +0xe714bff8f0 4 0x00007ff7f825b07b in runtime.stdcall at /usr/lib/golang/src/runtime/os_windows.go:973 frame: +0xe714bff938 frame pointer +0xe714bff928 fn = (unreadable could not find loclist entry at 0x7c5e9 for address 0x7ff7f825b07b) ~r0 = (unreadable empty OP stack) gp = (unreadable read out of bounds) mp = (unreadable read out of bounds) resetLibcall = false 5 0x00007ff7f825b1b6 in runtime.stdcall2 at /usr/lib/golang/src/runtime/os_windows.go:1003 frame: +0xe714bff950 frame pointer +0xe714bff940 fn = unsafe.Pointer(0x7ff7f8ac37c8) a0 = (unreadable empty OP stack) Sending output to pager… 0 0x00007ffd0d96d134 in ←[1m???←[0m at ←[1m?:-1←[0m frame: +0xe714bff8b0 frame pointer +0xe714bff8a0 1 0x00007ff7f829062d in ←[1mruntime.asmcgocall_landingpad←[0m at /usr/lib/golang/src/runtime/←[1masm_amd64.s:867←[0m frame: +0xe714bff8e0 frame pointer +0xe714bff8d0 2 0x00007ff7f82906e1 in ←[1mruntime.asmcgocall←[0m at /usr/lib/golang/src/runtime/←[1masm_amd64.s:946←[0m frame: +0xe714bff8f0 frame pointer +0xe714bff8f0 3 0x0000000000000000 in ←[1m???←[0m at ←[1m?:-1←[0m frame: +0xe714bff900 frame pointer +0xe714bff8f0 4 0x00007ff7f825b07b in ←[1mruntime.stdcall←[0m at /usr/lib/golang/src/runtime/←[1mos_windows.go:973←[0m frame: +0xe714bff938 frame pointer +0xe714bff928 fn = (unreadable could not find loclist entry at 0x7c5e9 for address 0x7ff7f825b07b) ~r0 = (unreadable empty OP stack) gp = (unreadable read out of bounds) mp = (unreadable read out of bounds) resetLibcall = false 5 0x00007ff7f825b1b6 in ←[1mruntime.stdcall2←[0m at /usr/lib/golang/src/runtime/←[1mos_windows.go:1003←[0m frame: +0xe714bff950 frame pointer +0xe714bff940 fn = unsafe.Pointer(0x7ff7f8ac37c8) a0 = (unreadable empty OP stack) a1 = (unreadable empty OP stack) ~r0 = (unreadable empty OP stack) mp = (unreadable could not find loclist entry at 0x7c7dc for address 0x7ff7f825b1b6) 6 0x00007ff7f825a4c5 in ←[1mruntime.semasleep←[0m at /usr/lib/golang/src/runtime/←[1mos_windows.go:699←[0m frame: +0xe714bff9b8 frame pointer +0xe714bff9a8 ns = (unreadable could not find loclist entry at 0x7bed0 for address 0x7ff7f825a4c5) ~r0 = (unreadable empty OP stack) result = (unreadable could not find loclist entry at 0x7bf3c for address 0x7ff7f825a4c5) 7 0x00007ff7f8231072 in ←[1mruntime.notesleep←[0m at /usr/lib/golang/src/runtime/←[1mlock_sema.go:183←[0m frame: +0xe714bff9f0 frame pointer +0xe714bff9e0 n = (*runtime.note)(0x7ff7f95a3ab0) gp = (unreadable could not find loclist entry at 0x38c03 for address 0x7ff7f8231072) 8 0x00007ff7f8264fec in ←[1mruntime.mPark←[0m at /usr/lib/golang/src/runtime/←[1mproc.go:1761←[0m frame: +0xe714bffa20 frame pointer +0xe714bffa10 gp = (*runtime.g)(0x7ff7f95a33e0) 9 0x00007ff7f8264fec in ←[1mruntime.stopm←[0m at /usr/lib/golang/src/runtime/←[1mproc.go:2782←[0m frame: +0xe714bffa20 frame pointer +0xe714bffa10 gp = (*runtime.g)(0x7ff7f95a33e0) gp = (*runtime.g)(0x7ff7f95a33e0) 10 0x00007ff7f8266b5f in ←[1mruntime.findRunnable←[0m at /usr/lib/golang/src/runtime/←[1mproc.go:3512←[0m frame: +0xe714bffb98 frame pointer +0xe714bffb88 gp = (unreadable empty OP stack) inheritTime = (unreadable empty OP stack) tryWakeP = (unreadable empty OP stack) ~r0mp = (unreadable empty OP stack) ~r0mp = (unreadable empty OP stack) ~r0mp = (unreadable empty OP stack) ~r0mp = (unreadable empty OP stack) ~r0gen = (unreadable empty OP stack) ~r0gen = (unreadable empty OP stack) ~r0gen = (unreadable empty OP stack) ~r0gen = (unreadable empty OP stack) mp = (*runtime.m)(0x7ff7f95a39a0) pp = (*runtime.p)(0xc00002e008) now = 1701387223800 pollUntil = 1760652887300 otherReady = (unreadable empty OP stack) allpSnapshot = (unreadable could not find loclist entry at 0x8874e for address 0x7ff7f8266b5f) idlepMaskSnapshot = (unreadable could not find loclist entry at 0x887e0 for address 0x7ff7f8266b5f) timerpMaskSnapshot = (unreadable could not find loclist entry at 0x88875 for address 0x7ff7f8266b5f) wasSpinning = true 11 0x00007ff7f8267c31 in ←[1mruntime.schedule←[0m at /usr/lib/golang/src/runtime/←[1mproc.go:3868←[0m frame: +0xe714bffbd0 frame pointer +0xe714bffbc0 mp = (*runtime.m)(0x7ff7f95a39a0) pp = (unreadable could not find loclist entry at 0x8ba9a for address 0x7ff7f8267c31) 12 0x00007ff7f82683b8 in ←[1mruntime.goschedImpl←[0m at /usr/lib/golang/src/runtime/←[1mproc.go:4065←[0m frame: +0xe714bffc20 frame pointer +0xe714bffc10 gp = (*runtime.g)(0xc00004a000) preempted = true ~r0mp = (unreadable empty OP stack) ~r0gen = (unreadable empty OP stack) trace = runtime.traceLocker {mp: *runtime.m nil, gen: 0} status = (unreadable empty OP stack) 13 0x00007ff7f8276271 in ←[1mruntime.gopreempt_m←[0m at /usr/lib/golang/src/runtime/←[1mproc.go:4082←[0m frame: +0xe714bffdd0 frame pointer +0xe714bffdc0 14 0x00007ff7f8276271 in ←[1mruntime.newstack←[0m at /usr/lib/golang/src/runtime/←[1mstack.go:1070←[0m frame: +0xe714bffdd0 frame pointer +0xe714bffdc0 thisg = (*runtime.g)(0x7ff7f95a33e0) morebuf = runtime.gobuf {sp: 824634801144, pc: 140703004290309, g: 824634023936,…+4 more} stackguard0 = 18446744073709550302 sp = (unreadable could not find loclist entry at 0x9e489 for address 0x7ff7f8276271) 15 0x00007ff7f828eb59 in ←[1mruntime.morestack←[0m at /usr/lib/golang/src/runtime/←[1masm_amd64.s:616←[0m frame: +0xe714bffdd8 frame pointer +0x0 16 0x0000000000000000 in ←[1m???←[0m at ←[1m:0←[0m frame: +0x0 frame pointer +0x0 error: NULL address (truncated)

Don’t know if it’s related, but we can see that goroutine 6 is sleeping. Code is starclub/internal/noty.ExpireThread (/root/go/src/starclub/internal/noty/expcalc.go:62). Could it be that goroutine 1 is waiting on goroutine 6?

Beyond that, is the source code publicly available for download? If so I can give it a try locally

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.