diamondburned / gotktrix

Matrix client in Go and GTK4
GNU Affero General Public License v3.0
312 stars 6 forks source link

Panic when running the binary: "imports assume-no-moving-gc to declare that it assumes a non-moving garbage collector" #39

Open Cavernosa opened 1 year ago

Cavernosa commented 1 year ago

After installing all dependencies that were throwing errors, build was apparently successful. Distro is Arch. Go version: 1.19.1 GTK4: 4.8.1

Running the binary gives an error about assume-no-moving-gc:

$ ./gotktrix
panic: Something in this program imports go4.org/unsafe/assume-no-moving-gc to declare that it assumes a non-moving garbage collector, but your version of go4.org/unsafe/assume-no-moving-gc hasn't been updated to assert that it's safe against the go1.19 runtime. If you want to risk it, run with environment variable ASSUME_NO_MOVING_GC_UNSAFE_RISK_IT_WITH=go1.19 set. Notably, if go1.19 adds a moving garbage collector, this program is unsafe to use.

goroutine 1 [running]:
go4.org/unsafe/assume-no-moving-gc.init.0()
        /home/user/.local/share/go/pkg/mod/go4.org/unsafe/assume-no-moving-gc@v0.0.0-20211027215541-db492cf91b37/untested.go:25 +0x1f4

So I did as it said and added the scary environment variable, and to my surprise I got an even scarier output:

$ ASSUME_NO_MOVING_GC_UNSAFE_RISK_IT_WITH=go1.19 ./gotktrix 
2022/09/27 23:06:55 Error: GLib: g_log_set_writer_func() called multiple times
SIGTRAP: trace trap
PC=0x7fa069fadfe8 m=0 sigcode=128
signal arrived during cgo execution

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x1a0f7f0, 0xc000125c78)
    /usr/lib/go/src/runtime/cgocall.go:158 +0x5c fp=0xc000125c50 sp=0xc000125c18 pc=0x55103c
github.com/diamondburned/gotk4/pkg/glib/v2._Cfunc_g_log_set_writer_func(0x1a0b6d0, 0x1001, 0x1a35530)
    _cgo_gotypes.go:4453 +0x45 fp=0xc000125c78 sp=0xc000125c50 pc=0x863cc5
github.com/diamondburned/gotk4/pkg/glib/v2.LogSetWriter.func1(0x3c00ce0?)
    /home/user/.local/share/go/pkg/mod/github.com/diamondburned/gotk4/pkg@v0.0.0-20220417091308-856167c02355/glib/v2/gmessages.go:965 +0x67 fp=0xc000125cc0 sp=0xc000125c78 pc=0x88bca7
github.com/diamondburned/gotk4/pkg/glib/v2.LogSetWriter(0xc000110000?)
    /home/user/.local/share/go/pkg/mod/github.com/diamondburned/gotk4/pkg@v0.0.0-20220417091308-856167c02355/glib/v2/gmessages.go:965 +0x37 fp=0xc000125cf0 sp=0xc000125cc0 pc=0x88bc17
github.com/diamondburned/gotk4/pkg/glib/v2.LogUseLogger(0xfaf677?)
    /home/user/.local/share/go/pkg/mod/github.com/diamondburned/gotk4/pkg@v0.0.0-20220417091308-856167c02355/glib/v2/gmessages.go:979 +0x1e fp=0xc000125d08 sp=0xc000125cf0 pc=0x88bcfe
github.com/diamondburned/gotk4/pkg/glib/v2.LogUseDefaultLogger(...)
    /home/user/.local/share/go/pkg/mod/github.com/diamondburned/gotk4/pkg@v0.0.0-20220417091308-856167c02355/glib/v2/gmessages.go:970
github.com/diamondburned/gotkit/app.init.0()
    /home/user/.local/share/go/pkg/mod/github.com/diamondburned/gotkit@v0.0.0-20220701034720-3e15918e1adf/app/app.go:35 +0x25 fp=0xc000125d20 sp=0xc000125d08 pc=0xfab185
runtime.doInit(0x3a49560)
    /usr/lib/go/src/runtime/proc.go:6321 +0x126 fp=0xc000125e50 sp=0xc000125d20 pc=0x593ae6
runtime.doInit(0x3a4d940)
    /usr/lib/go/src/runtime/proc.go:6298 +0x71 fp=0xc000125f80 sp=0xc000125e50 pc=0x593a31
runtime.main()
    /usr/lib/go/src/runtime/proc.go:233 +0x1d3 fp=0xc000125fe0 sp=0xc000125f80 pc=0x586813
runtime.goexit()
    /usr/lib/go/src/runtime/asm_amd64.s:1594 +0x1 fp=0xc000125fe8 sp=0xc000125fe0 pc=0x5b50c1

goroutine 2 [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
    /usr/lib/go/src/runtime/proc.go:363 +0xd6 fp=0xc00005afb0 sp=0xc00005af90 pc=0x586c16
runtime.goparkunlock(...)
    /usr/lib/go/src/runtime/proc.go:369
runtime.forcegchelper()
    /usr/lib/go/src/runtime/proc.go:302 +0xad fp=0xc00005afe0 sp=0xc00005afb0 pc=0x586aad
runtime.goexit()
    /usr/lib/go/src/runtime/asm_amd64.s:1594 +0x1 fp=0xc00005afe8 sp=0xc00005afe0 pc=0x5b50c1
created by runtime.init.6
    /usr/lib/go/src/runtime/proc.go:290 +0x25

goroutine 18 [GC sweep wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
    /usr/lib/go/src/runtime/proc.go:363 +0xd6 fp=0xc000056790 sp=0xc000056770 pc=0x586c16
runtime.goparkunlock(...)
    /usr/lib/go/src/runtime/proc.go:369
runtime.bgsweep(0x0?)
    /usr/lib/go/src/runtime/mgcsweep.go:278 +0x8e fp=0xc0000567c8 sp=0xc000056790 pc=0x57240e
runtime.gcenable.func1()
    /usr/lib/go/src/runtime/mgc.go:178 +0x26 fp=0xc0000567e0 sp=0xc0000567c8 pc=0x5670c6
runtime.goexit()
    /usr/lib/go/src/runtime/asm_amd64.s:1594 +0x1 fp=0xc0000567e8 sp=0xc0000567e0 pc=0x5b50c1
created by runtime.gcenable
    /usr/lib/go/src/runtime/mgc.go:178 +0x6b

goroutine 19 [GC scavenge wait]:
runtime.gopark(0xc000090000?, 0x215ff90?, 0x1?, 0x0?, 0x0?)
    /usr/lib/go/src/runtime/proc.go:363 +0xd6 fp=0xc000056f70 sp=0xc000056f50 pc=0x586c16
runtime.goparkunlock(...)
    /usr/lib/go/src/runtime/proc.go:369
runtime.(*scavengerState).park(0x3c01580)
    /usr/lib/go/src/runtime/mgcscavenge.go:389 +0x53 fp=0xc000056fa0 sp=0xc000056f70 pc=0x5704b3
runtime.bgscavenge(0x0?)
    /usr/lib/go/src/runtime/mgcscavenge.go:617 +0x45 fp=0xc000056fc8 sp=0xc000056fa0 pc=0x570a85
runtime.gcenable.func2()
    /usr/lib/go/src/runtime/mgc.go:179 +0x26 fp=0xc000056fe0 sp=0xc000056fc8 pc=0x567066
runtime.goexit()
    /usr/lib/go/src/runtime/asm_amd64.s:1594 +0x1 fp=0xc000056fe8 sp=0xc000056fe0 pc=0x5b50c1
created by runtime.gcenable
    /usr/lib/go/src/runtime/mgc.go:179 +0xaa

goroutine 3 [finalizer wait]:
runtime.gopark(0x3c02600?, 0xc000007520?, 0x0?, 0x0?, 0xc00005a770?)
    /usr/lib/go/src/runtime/proc.go:363 +0xd6 fp=0xc00005a628 sp=0xc00005a608 pc=0x586c16
runtime.goparkunlock(...)
    /usr/lib/go/src/runtime/proc.go:369
runtime.runfinq()
    /usr/lib/go/src/runtime/mfinal.go:180 +0x10f fp=0xc00005a7e0 sp=0xc00005a628 pc=0x56614f
runtime.goexit()
    /usr/lib/go/src/runtime/asm_amd64.s:1594 +0x1 fp=0xc00005a7e8 sp=0xc00005a7e0 pc=0x5b50c1
created by runtime.createfing
    /usr/lib/go/src/runtime/mfinal.go:157 +0x45

rax    0x0
rbx    0x1
rcx    0x0
rdx    0x1
rdi    0x360
rsi    0x0
rbp    0x4
rsp    0x7ffc7b641440
r8     0x1
r9     0x0
r10    0x1
r11    0x206
r12    0x0
r13    0x7ffc7b641490
r14    0x7fa06a08cd00
r15    0x7fa06a08cd70
rip    0x7fa069fadfe8
rflags 0x202
cs     0x33
fs     0x0
gs     0x0

Don't know if i'm doing something wrong. I tried v0.1.4 instead of latest, same thing. I'm able to build and launch fine from the gotktrix-git package in AUR

diamondburned commented 1 year ago

I'm able to build and launch fine from the gotktrix-git package in AUR

Does this use actual latest git commit? If yes, is the one you built of a stable release?

gotktrix has been due for a new release for quite a while now.

Cavernosa commented 1 year ago

Does this use actual latest git commit?

I think so. In the PKGBUILD file it shows the same commit id as the latest one here ("r373.d903553"), seems to be getting from the last commit in this repository.

If yes, is the one you built of a stable release?

As i said, I tried v0.1.4 but it threw the same error (is that what you mean?), i built by invoking this command:

$ go install -v github.com/diamondburned/gotktrix@v0.1.4
ThatOneCalculator commented 1 year ago

I'm getting the same error

raspbeguy commented 1 year ago

Having the same error (but with go1.20).

diamondburned commented 1 year ago

For Go 1.20, we probably need another update to bump this.