gopy icon indicating copy to clipboard operation
gopy copied to clipboard

"broken" since go 1.21

Open asottile opened this issue 8 months ago • 4 comments

I say "broken" because according to the golang issue this was never intended to work and was merely working by accident: https://github.com/golang/go/issues/65050#issue-2074509727

here's a small reproduction demoing this breakage. I'm running on macos x86_64 which seems to be the most reliable to reproduce for some reason I don't completely understand:

setup:

$ # not shown: running the install steps in the README
$ gopy build -output=hi -vm=python3 github.com/go-python/gopy/_examples/hi
go build -v github.com/go-python/gopy/_examples/hi

--- Processing package: github.com/go-python/gopy/_examples/hi ---

--- building package ---
gopy build -output=hi -vm=python3 github.com/go-python/gopy/_examples/hi
goimports -w hi.go
go build -mod=mod -buildmode=c-shared -o hi_go.so .
/Users/asottile/workspace/z/venv/bin/python3 build.py
CGO_CFLAGS="-I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9" -fPIC -Ofast
CGO_LDFLAGS="-L/Library/Frameworks/Python.framework/Versions/3.9/lib" "-lpython3.9" -ldl -framework CoreFoundation
go build -mod=mod -buildmode=c-shared -o _hi.cpython-39-darwin.so .
$ gopy build -output=simple -vm=python3 github.com/go-python/gopy/_examples/simple
go build -v github.com/go-python/gopy/_examples/simple

--- Processing package: github.com/go-python/gopy/_examples/simple ---

--- building package ---
gopy build -output=simple -vm=python3 github.com/go-python/gopy/_examples/simple
goimports -w simple.go
go build -mod=mod -buildmode=c-shared -o simple_go.so .
/Users/asottile/workspace/z/venv/bin/python3 build.py
CGO_CFLAGS="-I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9" -fPIC -Ofast
CGO_LDFLAGS="-L/Library/Frameworks/Python.framework/Versions/3.9/lib" "-lpython3.9" -ldl -framework CoreFoundation
go build -mod=mod -buildmode=c-shared -o _simple.cpython-39-darwin.so .

reproduction

here's a small python script using the compiled output:

(all that really needs to be involved is >1 extension in the same process)

from hi.hi import Hello
from simple.simple import Add

for _ in range(5000):
    Add(2, 2)
    Hello('hi')

boom

(and sometimes the crash is in various other places -- this just seems to be the most common one)

$ python3 t.py 
fatal error: bad sweepgen in refill

goroutine 17 gp=0x1c000006700 m=1 mp=0x1c000048008 [running, locked to thread]:
runtime.throw({0x106e672a0?, 0x0?})
	/Users/asottile/opt/go/src/runtime/panic.go:1067 +0x48 fp=0x1c000056af8 sp=0x1c000056ac8 pc=0x106e12848
runtime.(*mcache).refill(0x10dc925b8, 0x0?)
	/Users/asottile/opt/go/src/runtime/mcache.go:157 +0x20d fp=0x1c000056b38 sp=0x1c000056af8 pc=0x106dbf04d
runtime.(*mcache).nextFree(0x10dc925b8, 0x34)
	/Users/asottile/opt/go/src/runtime/malloc.go:945 +0x85 fp=0x1c000056b70 sp=0x1c000056b38 pc=0x106db9d05
runtime.mallocgc(0x200, 0x106ea7020, 0x1)
	/Users/asottile/opt/go/src/runtime/malloc.go:1161 +0x4cd fp=0x1c000056c10 sp=0x1c000056b70 pc=0x106e0eb8d
runtime.makeslice(0x0?, 0x1c000056c78?, 0x106dbdc85?)
	/Users/asottile/opt/go/src/runtime/slice.go:116 +0x49 fp=0x1c000056c38 sp=0x1c000056c10 pc=0x106e14149
sync.(*Pool).pinSlow(0x106f4bb60)
	/Users/asottile/opt/go/src/sync/pool.go:241 +0x17c fp=0x1c000056cd0 sp=0x1c000056c38 pc=0x106e1ed7c
sync.(*Pool).pin(0x106f4bb60)
	/Users/asottile/opt/go/src/sync/pool.go:220 +0x46 fp=0x1c000056cf0 sp=0x1c000056cd0 pc=0x106e1ebc6
sync.(*Pool).Get(0x106f4bb60)
	/Users/asottile/opt/go/src/sync/pool.go:135 +0x1c fp=0x1c000056d28 sp=0x1c000056cf0 pc=0x106e1e91c
fmt.newPrinter()
	/Users/asottile/opt/go/src/fmt/print.go:152 +0x1e fp=0x1c000056d50 sp=0x1c000056d28 pc=0x106e4475e
fmt.Sprintf({0x106e66215, 0x11}, {0x1c000056dd8, 0x1, 0x1})
	/Users/asottile/opt/go/src/fmt/print.go:238 +0x30 fp=0x1c000056da8 sp=0x1c000056d50 pc=0x106e44b50
github.com/go-python/gopy/_examples/cpkg.Hello({0x1c00009a00a?, 0x10db58ca9?})
	/Users/asottile/workspace/z/go/pkg/mod/github.com/go-python/[email protected]/_examples/cpkg/cpkg.go:33 +0x74 fp=0x1c000056e10 sp=0x1c000056da8 pc=0x106e4d874
github.com/go-python/gopy/_examples/hi.Hello(...)
	/Users/asottile/workspace/z/go/pkg/mod/github.com/go-python/[email protected]/_examples/hi/hi.go:34
main.hi_Hello(0x7ffbcb6e07e0, 0x0)
	/Users/asottile/workspace/z/hi/hi.go:1708 +0xd8 fp=0x1c000056e60 sp=0x1c000056e10 pc=0x106e553d8
_cgoexp_ffdfbdb0b480_hi_Hello(0x106deb486?)
	_cgo_gotypes.go:2033 +0x1d fp=0x1c000056e80 sp=0x1c000056e60 pc=0x106e59a3d
runtime.cgocallbackg1(0x106e59a20, 0x7ffee9235c08, 0x0)
	/Users/asottile/opt/go/src/runtime/cgocall.go:442 +0x27b fp=0x1c000056f40 sp=0x1c000056e80 pc=0x106db1b7b
runtime.cgocallbackg(0x106e59a20, 0x7ffee9235c08, 0x0)
	/Users/asottile/opt/go/src/runtime/cgocall.go:361 +0x11a fp=0x1c000056f90 sp=0x1c000056f40 pc=0x106db187a
runtime.cgocallbackg(0x106e59a20, 0x7ffee9235c08, 0x0)
	<autogenerated>:1 +0x29 fp=0x1c000056fb8 sp=0x1c000056f90 pc=0x106e1c189
runtime.cgocallback(0x0, 0x0, 0x0)
	/Users/asottile/opt/go/src/runtime/asm_amd64.s:1084 +0xcc fp=0x1c000056fe0 sp=0x1c000056fb8 pc=0x106e19b6c
runtime: g 17: unexpected return pc for runtime.cgocallback called from 0x10db22381
stack: frame={sp:0x1c000056fb8, fp:0x1c000056fe0} stack=[0x1c000056000,0x1c000057000)
0x000001c000056eb8:  0x000001c000056e9f  0x020201c000056f30 
0x000001c000056ec8:  0x0000000106e12e6e <runtime.exitsyscall+0x000000000000014e>  0x000001c000006700 
0x000001c000056ed8:  0x0000000106e59a20 <_cgoexp_ffdfbdb0b480_hi_Hello+0x0000000000000000>  0x0000000000000000 
0x000001c000056ee8:  0x000001c000006700  0x000001c000056ed8 
0x000001c000056ef8:  0x0000000106db1c20 <runtime.cgocallbackg1.deferwrap2+0x0000000000000000>  0x000001c000056ec5 
0x000001c000056f08:  0x00007ffee9237000  0x0000000000000000 
0x000001c000056f18:  0x0000000000000000  0x0000000000000000 
0x000001c000056f28:  0x000001c000056ef8  0x000001c000056f80 
0x000001c000056f38:  0x0000000106db187a <runtime.cgocallbackg+0x000000000000011a>  0x0000000106e59a20 <_cgoexp_ffdfbdb0b480_hi_Hello+0x0000000000000000> 
0x000001c000056f48:  0x00007ffee9235c08  0x0000000000000000 
0x000001c000056f58:  0x000000010db22381  0x000001c000056fe0 
0x000001c000056f68:  0x0000000000000000  0x000001c000006700 
0x000001c000056f78:  0x000001c000048008  0x000001c000056fa8 
0x000001c000056f88:  0x0000000106e1c189 <runtime.cgocallbackg+0x0000000000000029>  0x0000000106e59a20 <_cgoexp_ffdfbdb0b480_hi_Hello+0x0000000000000000> 
0x000001c000056f98:  0x00007ffee9235c08  0x0000000000000000 
0x000001c000056fa8:  0x00007ffee9235b98  0x0000000106e19b6c <runtime.cgocallback+0x00000000000000cc> 
0x000001c000056fb8: <0x0000000106e59a20 <_cgoexp_ffdfbdb0b480_hi_Hello+0x0000000000000000>  0x00007ffee9235c08 
0x000001c000056fc8:  0x0000000000000000  0x0000000000000000 
0x000001c000056fd8:  0x000000010db22381 >0x0000000000000000 
0x000001c000056fe8:  0x0000000000000000  0x0000000000000000 
0x000001c000056ff8:  0x0000000000000000 

goroutine 2 gp=0xc000006c40 m=nil [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
	/Users/asottile/opt/go/src/runtime/proc.go:424 +0xce fp=0xc000042fa8 sp=0xc000042f88 pc=0x106e1292e
runtime.goparkunlock(...)
	/Users/asottile/opt/go/src/runtime/proc.go:430
runtime.forcegchelper()
	/Users/asottile/opt/go/src/runtime/proc.go:337 +0xb3 fp=0xc000042fe0 sp=0xc000042fa8 pc=0x106de2473
runtime.goexit({})
	/Users/asottile/opt/go/src/runtime/asm_amd64.s:1700 +0x1 fp=0xc000042fe8 sp=0xc000042fe0 pc=0x106e19da1
created by runtime.init.7 in goroutine 1
	/Users/asottile/opt/go/src/runtime/proc.go:325 +0x1a

goroutine 3 gp=0xc000007180 m=nil [GC sweep wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
	/Users/asottile/opt/go/src/runtime/proc.go:424 +0xce fp=0xc000043780 sp=0xc000043760 pc=0x106e1292e
runtime.goparkunlock(...)
	/Users/asottile/opt/go/src/runtime/proc.go:430
runtime.bgsweep(0xc00006c000)
	/Users/asottile/opt/go/src/runtime/mgcsweep.go:277 +0x94 fp=0xc0000437c8 sp=0xc000043780 pc=0x106dce4d4
runtime.gcenable.gowrap1()
	/Users/asottile/opt/go/src/runtime/mgc.go:204 +0x25 fp=0xc0000437e0 sp=0xc0000437c8 pc=0x106dc2e25
runtime.goexit({})
	/Users/asottile/opt/go/src/runtime/asm_amd64.s:1700 +0x1 fp=0xc0000437e8 sp=0xc0000437e0 pc=0x106e19da1
created by runtime.gcenable in goroutine 1
	/Users/asottile/opt/go/src/runtime/mgc.go:204 +0x66

goroutine 4 gp=0xc000007340 m=nil [GC scavenge wait]:
runtime.gopark(0xc00006c000?, 0x106e8b7c8?, 0x1?, 0x0?, 0xc000007340?)
	/Users/asottile/opt/go/src/runtime/proc.go:424 +0xce fp=0xc000043f78 sp=0xc000043f58 pc=0x106e1292e
runtime.goparkunlock(...)
	/Users/asottile/opt/go/src/runtime/proc.go:430
runtime.(*scavengerState).park(0x106f51400)
	/Users/asottile/opt/go/src/runtime/mgcscavenge.go:425 +0x49 fp=0xc000043fa8 sp=0xc000043f78 pc=0x106dcbee9
runtime.bgscavenge(0xc00006c000)
	/Users/asottile/opt/go/src/runtime/mgcscavenge.go:653 +0x3c fp=0xc000043fc8 sp=0xc000043fa8 pc=0x106dcc45c
runtime.gcenable.gowrap2()
	/Users/asottile/opt/go/src/runtime/mgc.go:205 +0x25 fp=0xc000043fe0 sp=0xc000043fc8 pc=0x106dc2dc5
runtime.goexit({})
	/Users/asottile/opt/go/src/runtime/asm_amd64.s:1700 +0x1 fp=0xc000043fe8 sp=0xc000043fe0 pc=0x106e19da1
created by runtime.gcenable in goroutine 1
	/Users/asottile/opt/go/src/runtime/mgc.go:205 +0xa5

goroutine 5 gp=0xc000007c00 m=nil [finalizer wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
	/Users/asottile/opt/go/src/runtime/proc.go:424 +0xce fp=0xc000044620 sp=0xc000044600 pc=0x106e1292e
runtime.runfinq()
	/Users/asottile/opt/go/src/runtime/mfinal.go:193 +0x107 fp=0xc0000447e0 sp=0xc000044620 pc=0x106dc1ea7
runtime.goexit({})
	/Users/asottile/opt/go/src/runtime/asm_amd64.s:1700 +0x1 fp=0xc0000447e8 sp=0xc0000447e0 pc=0x106e19da1
created by runtime.createfing in goroutine 1
	/Users/asottile/opt/go/src/runtime/mfinal.go:163 +0x3d
Abort trap: 6

aside: I decided to abandon setuptools-golang for this reason 🤷 -- and yeah a clickbaitish video with more details

asottile avatar Apr 07 '25 00:04 asottile

Interesting, I could have sworn I had gopy working on go 1.24.1, I recall needing to install go with brew as being on the right arch was important (for apple silicon, that is).

I can't get the example to even build, there is a depreciated build flag.

Setup under a venv:

(Temp) ppoage@Mac Temp % python --version
Python 3.11.11
(Temp) ppoage@Mac Temp % uv pip install pybindgen
Resolved 1 package in 777ms
Prepared 1 package in 131ms
Installed 1 package in 3ms
 + pybindgen==0.22.1
(Temp) ppoage@Mac Temp % uv pip install --upgrade setuptools wheel
Resolved 2 packages in 79ms
Prepared 2 packages in 0.97ms
Installed 2 packages in 19ms
 + setuptools==79.0.1
 + wheel==0.45.1
(Temp) ppoage@Mac Temp % uv pip list
Package    Version
---------- -------
pybindgen  0.22.1
setuptools 79.0.1
wheel      0.45.1
(Temp) ppoage@Mac Temp % go version
go version go1.24.1 darwin/arm64
(Temp) ppoage@Mac Temp % go mod init dummy.com/dum
go: creating new go.mod: module dummy.com/dum
(Temp) ppoage@Mac Temp % go get github.com/go-python/gopy/_examples/hi
go: added github.com/go-python/gopy v0.4.10
(Temp) ppoage@Mac Temp % go install golang.org/x/tools/cmd/goimports@latest
go: downloading golang.org/x/tools v0.32.0
go: downloading golang.org/x/sync v0.13.0
(Temp) ppoage@Mac Temp % go install github.com/go-python/gopy@latest

Build fails with

clang: error: argument '-Ofast' is deprecated; use '-O3 -ffast-math' for the same behavior, or '-O3' to enable only conforming optimizations [-Werror,-Wdeprecated-ofast]

Full log below. Note: I passed the full python venv path as not doing that can break things.

(Temp) ppoage@Mac Temp % gopy build -output=hi -vm=/Applications/Code/Temp/.venv/bin/python3.11 github.com/go-python/gopy/_examples/hi
go build -v github.com/go-python/gopy/_examples/hi

--- Processing package: github.com/go-python/gopy/_examples/hi ---

--- building package ---
gopy build -output=hi -vm=/Applications/Code/Temp/.venv/bin/python3.11 github.com/go-python/gopy/_examples/hi
goimports -w hi.go
go build -mod=mod -buildmode=c-shared -o hi_go.so .
/Applications/Code/Temp/.venv/bin/python3.11 build.py
CGO_CFLAGS="-I/Users/ppoage/.local/share/uv/python/cpython-3.11.11-macos-aarch64-none/include/python3.11" -fPIC -Ofast
CGO_LDFLAGS="-L/Users/ppoage/.local/share/uv/python/cpython-3.11.11-macos-aarch64-none/lib" "-lpython3.11" -ldl -framework CoreFoundation
go build -mod=mod -buildmode=c-shared -o _hi.cpython-311-darwin.so .
cmd had error: exit status 1  output:
# runtime/cgo
clang: error: argument '-Ofast' is deprecated; use '-O3 -ffast-math' for the same behavior, or '-O3' to enable only conforming optimizations [-Werror,-Wdeprecated-ofast]

2025/04/26 12:21:50 error dispatching command: exit status 1

ppoage avatar Apr 26 '25 19:04 ppoage

@asottile @ppoage If you're interested, I can say that gopy certainly does work with Go 1.24. As a matter of fact, I've built wheels with it today for macOS (on ARM and x86) and Linux (on ARM and x86).

Here are my recent builds:

  • https://github.com/b-long/ohpygossh/pull/14
    • Note that this project is "vanilla go" (that is, there really aren't any dependencies -- we're just using go to create a new SSH wheel)
  • https://github.com/b-long/opentdf-python-sdk/pull/53
    • Note that build failures here are entirely about my integration tests. Wheel building is fine, I just need to hunt down the cause of failing tests (post gopy-build).

And, here's a cookiecutter that's very close to the projects I'm pushing to PyPI which can help you bootstrap a quick project (if you wanted to hack around to investigate the bug):

  • https://github.com/b-long/cookiecutter-gopy

b-long avatar May 31 '25 21:05 b-long

@b-long try importing more than one of your extensions into the same process and call functions from both of them in a loop on macos x86_64 and you'll see exactly the same failure mode as above

asottile avatar May 31 '25 21:05 asottile

Sorry I should've taken more time before I commented previously. I've come up with another reproducer 👍

I've attached some small .py files here (I'm happy to resend as plain text if that's easier). For now, I've uploaded them with a suffix (.py.txt ).

reproduce.py.txt reproduce_no_error.py.txt

#!/usr/bin/env bash

mkdir gopy370
cd gopy370/
uv venv .venv --python 3.12
source .venv/bin/activate
uv pip install otdf_python==0.2.11 ohpygossh==0.0.15
uv run python ../reproduce.py
# uv run python ../reproduce_no_error.py

My error output is below. It's sort of interesting (to me) that an empty data structure, like OpentdfConfig() in my reproduce_no_error.py isn't enough to cause the error.

Error output (click to expand)


runtime: g 17: unexpected return pc for runtime.cgocallback called from 0x10b2993a1
stack: frame={sp:0x1c000181fb8, fp:0x1c000181fe0} stack=[0x1c000180000,0x1c000182000)
0x000001c000181eb8:  0x000000c0000028c0  0x0000000200000003 
0x000001c000181ec8:  0x0000000154f27ba0 <_cgoexp_42825c09a87c_gotdf_python_EncryptString+0x0000000000000000>  0x0000000000000000 
0x000001c000181ed8:  0x000000c0000028c0  0x00000001548fb2e0 <runtime.cgocallbackg1.deferwrap2+0x0000000000000000> 
0x000001c000181ee8:  0x000001c000181eb5  0x0000000000000000 
0x000001c000181ef8:  0x0000000000000000  0x0000000000000000 
0x000001c000181f08:  0x0000000000000000  0x000001c000181ee0 
0x000001c000181f18:  0x000001c000181f80  0x00000001548faed3 <runtime.cgocallbackg+0x0000000000000133> 
0x000001c000181f28:  0x0000000154f27ba0 <_cgoexp_42825c09a87c_gotdf_python_EncryptString+0x0000000000000000>  0x00007ff7b54ad910 
0x000001c000181f38:  0x0000000000000000  0x0100000000000000 
0x000001c000181f48:  0x000000010b2993a1  0x00007ff7b4caf000 
0x000001c000181f58:  0x00007ff7b54af000  0x000001c000181fe0 
0x000001c000181f68:  0x0000000000000000  0x000000c0000028c0 
0x000001c000181f78:  0x000000c000058008  0x000001c000181fa8 
0x000001c000181f88:  0x0000000154968689 <runtime.cgocallbackg+0x0000000000000029>  0x0000000154f27ba0 <_cgoexp_42825c09a87c_gotdf_python_EncryptString+0x0000000000000000> 
0x000001c000181f98:  0x00007ff7b54ad910  0x0000000000000000 
0x000001c000181fa8:  0x00007ff7b54ad8a8  0x0000000154965cac <runtime.cgocallback+0x00000000000000cc> 
0x000001c000181fb8: <0x0000000154f27ba0 <_cgoexp_42825c09a87c_gotdf_python_EncryptString+0x0000000000000000>  0x00007ff7b54ad910 
0x000001c000181fc8:  0x0000000000000000  0x0000000000000000 
0x000001c000181fd8:  0x000000010b2993a1 >0x0000000000000000 
0x000001c000181fe8:  0x0000000000000000  0x0000000000000000 
0x000001c000181ff8:  0x0000000000000000 
fatal error: unknown caller pc

runtime stack:
runtime.throw({0x154fa9841?, 0x7ff7b54ad640?})
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/panic.go:1101 +0x48 fp=0x7ff7b54ad5e8 sp=0x7ff7b54ad5b8 pc=0x15495e208
runtime.(*unwinder).next(0x7ff7b54ad698)
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/traceback.go:470 +0x249 fp=0x7ff7b54ad660 sp=0x7ff7b54ad5e8 pc=0x15494d929
runtime.copystack(0xc0000028c0, 0x800000002?)
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/stack.go:934 +0x2ef fp=0x7ff7b54ad758 sp=0x7ff7b54ad660 pc=0x15494404f
runtime.newstack()
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/stack.go:1116 +0x485 fp=0x7ff7b54ad890 sp=0x7ff7b54ad758 pc=0x154944625
runtime.morestack()
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/asm_amd64.s:621 +0x7a fp=0x7ff7b54ad898 sp=0x7ff7b54ad890 pc=0x15496401a

goroutine 17 gp=0xc0000028c0 m=1 mp=0xc000058008 [copystack, locked to thread]:
github.com/opentdf/platform/sdk.New({0x1c000300000, 0x16}, {0x1c000181710, 0x3, 0x3?})
	/Users/runner/go/pkg/mod/github.com/opentdf/platform/[email protected]/sdk.go:77 +0x1625 fp=0x1c000181638 sp=0x1c000181630 pc=0x154f08345
gotdf_python.newSdkClient({{0x1c00023a000, 0xb}, {0x1c00023a010, 0x6}, {0x1c000300000, 0x16}, {0x1c000302000, 0x4f}, {0x1c000304000, 0x21}}, ...)
	/Users/runner/work/opentdf-python-sdk/opentdf-python-sdk/main.go:68 +0x2df fp=0x1c000181738 sp=0x1c000181638 pc=0x154f1599f
gotdf_python.EncryptString({0x1c00023a020, 0xd}, {{0x1c00023a000, 0xb}, {0x1c00023a010, 0x6}, {0x1c000300000, 0x16}, {0x1c000302000, 0x4f}, ...}, ...)
	/Users/runner/work/opentdf-python-sdk/opentdf-python-sdk/main.go:107 +0x113 fp=0x1c000181ce8 sp=0x1c000181738 pc=0x154f16893
main.gotdf_python_EncryptString(0x10abc8d18, 0x1, 0x2, 0x3)
	/Users/runner/work/opentdf-python-sdk/opentdf-python-sdk/build/lib.macosx-10.9-x86_64-cpython-312/otdf_python/gotdf_python.go:1394 +0x173 fp=0x1c000181e40 sp=0x1c000181ce8 pc=0x154f23dd3
_cgoexp_42825c09a87c_gotdf_python_EncryptString(0x7ff7b54ad910)
	_cgo_gotypes.go:1872 +0x2a fp=0x1c000181e70 sp=0x1c000181e40 pc=0x154f27bca
runtime.cgocallbackg1(0x154f27ba0, 0x7ff7b54ad910, 0x0)
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/cgocall.go:446 +0x276 fp=0x1c000181f28 sp=0x1c000181e70 pc=0x1548fb236
runtime.cgocallbackg(0x154f27ba0, 0x7ff7b54ad910, 0x0)
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/cgocall.go:350 +0x133 fp=0x1c000181f90 sp=0x1c000181f28 pc=0x1548faed3
runtime.cgocallbackg(0x154f27ba0, 0x7ff7b54ad910, 0x0)
	<autogenerated>:1 +0x29 fp=0x1c000181fb8 sp=0x1c000181f90 pc=0x154968689
runtime.cgocallback(0x0, 0x0, 0x0)
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/asm_amd64.s:1084 +0xcc fp=0x1c000181fe0 sp=0x1c000181fb8 pc=0x154965cac
runtime: g 17: unexpected return pc for runtime.cgocallback called from 0x10b2993a1
stack: frame={sp:0x1c000181fb8, fp:0x1c000181fe0} stack=[0x1c000180000,0x1c000182000)
0x000001c000181eb8:  0x000000c0000028c0  0x0000000200000003 
0x000001c000181ec8:  0x0000000154f27ba0 <_cgoexp_42825c09a87c_gotdf_python_EncryptString+0x0000000000000000>  0x0000000000000000 
0x000001c000181ed8:  0x000000c0000028c0  0x00000001548fb2e0 <runtime.cgocallbackg1.deferwrap2+0x0000000000000000> 
0x000001c000181ee8:  0x000001c000181eb5  0x0000000000000000 
0x000001c000181ef8:  0x0000000000000000  0x0000000000000000 
0x000001c000181f08:  0x0000000000000000  0x000001c000181ee0 
0x000001c000181f18:  0x000001c000181f80  0x00000001548faed3 <runtime.cgocallbackg+0x0000000000000133> 
0x000001c000181f28:  0x0000000154f27ba0 <_cgoexp_42825c09a87c_gotdf_python_EncryptString+0x0000000000000000>  0x00007ff7b54ad910 
0x000001c000181f38:  0x0000000000000000  0x0100000000000000 
0x000001c000181f48:  0x000000010b2993a1  0x00007ff7b4caf000 
0x000001c000181f58:  0x00007ff7b54af000  0x000001c000181fe0 
0x000001c000181f68:  0x0000000000000000  0x000000c0000028c0 
0x000001c000181f78:  0x000000c000058008  0x000001c000181fa8 
0x000001c000181f88:  0x0000000154968689 <runtime.cgocallbackg+0x0000000000000029>  0x0000000154f27ba0 <_cgoexp_42825c09a87c_gotdf_python_EncryptString+0x0000000000000000> 
0x000001c000181f98:  0x00007ff7b54ad910  0x0000000000000000 
0x000001c000181fa8:  0x00007ff7b54ad8a8  0x0000000154965cac <runtime.cgocallback+0x00000000000000cc> 
0x000001c000181fb8: <0x0000000154f27ba0 <_cgoexp_42825c09a87c_gotdf_python_EncryptString+0x0000000000000000>  0x00007ff7b54ad910 
0x000001c000181fc8:  0x0000000000000000  0x0000000000000000 
0x000001c000181fd8:  0x000000010b2993a1 >0x0000000000000000 
0x000001c000181fe8:  0x0000000000000000  0x0000000000000000 
0x000001c000181ff8:  0x0000000000000000 

goroutine 2 gp=0x1c000002e00 m=nil [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/proc.go:435 +0xce fp=0x1c000072fa8 sp=0x1c000072f88 pc=0x15495e32e
runtime.goparkunlock(...)
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/proc.go:441
runtime.forcegchelper()
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/proc.go:348 +0xb3 fp=0x1c000072fe0 sp=0x1c000072fa8 pc=0x15492c073
runtime.goexit({})
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/asm_amd64.s:1700 +0x1 fp=0x1c000072fe8 sp=0x1c000072fe0 pc=0x154965ee1
created by runtime.init.7 in goroutine 1
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/proc.go:336 +0x1a

goroutine 3 gp=0x1c000003340 m=nil [GC sweep wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/proc.go:435 +0xce fp=0x1c000073780 sp=0x1c000073760 pc=0x15495e32e
runtime.goparkunlock(...)
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/proc.go:441
runtime.bgsweep(0x1c00007c000)
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/mgcsweep.go:276 +0x94 fp=0x1c0000737c8 sp=0x1c000073780 pc=0x154917154
runtime.gcenable.gowrap1()
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/mgc.go:204 +0x25 fp=0x1c0000737e0 sp=0x1c0000737c8 pc=0x15490b605
runtime.goexit({})
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/asm_amd64.s:1700 +0x1 fp=0x1c0000737e8 sp=0x1c0000737e0 pc=0x154965ee1
created by runtime.gcenable in goroutine 1
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/mgc.go:204 +0x66

goroutine 4 gp=0x1c000003500 m=nil [GC scavenge wait]:
runtime.gopark(0x1c00007c000?, 0x1550a5a08?, 0x1?, 0x0?, 0x1c000003500?)
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/proc.go:435 +0xce fp=0x1c000073f78 sp=0x1c000073f58 pc=0x15495e32e
runtime.goparkunlock(...)
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/proc.go:441
runtime.(*scavengerState).park(0x155855360)
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/mgcscavenge.go:425 +0x49 fp=0x1c000073fa8 sp=0x1c000073f78 pc=0x154914be9
runtime.bgscavenge(0x1c00007c000)
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/mgcscavenge.go:653 +0x3c fp=0x1c000073fc8 sp=0x1c000073fa8 pc=0x15491515c
runtime.gcenable.gowrap2()
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/mgc.go:205 +0x25 fp=0x1c000073fe0 sp=0x1c000073fc8 pc=0x15490b5a5
runtime.goexit({})
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/asm_amd64.s:1700 +0x1 fp=0x1c000073fe8 sp=0x1c000073fe0 pc=0x154965ee1
created by runtime.gcenable in goroutine 1
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/mgc.go:205 +0xa5

goroutine 5 gp=0x1c000003dc0 m=nil [finalizer wait]:
runtime.gopark(0x1b8?, 0x1c000002380?, 0x1?, 0x23?, 0x1c000072688?)
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/proc.go:435 +0xce fp=0x1c000072630 sp=0x1c000072610 pc=0x15495e32e
runtime.runfinq()
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/mfinal.go:196 +0x107 fp=0x1c0000727e0 sp=0x1c000072630 pc=0x15490a5c7
runtime.goexit({})
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/asm_amd64.s:1700 +0x1 fp=0x1c0000727e8 sp=0x1c0000727e0 pc=0x154965ee1
created by runtime.createfing in goroutine 1
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/mfinal.go:166 +0x3d

goroutine 6 gp=0x1c0001ae540 m=nil [chan receive]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/proc.go:435 +0xce fp=0x1c000074718 sp=0x1c0000746f8 pc=0x15495e32e
runtime.chanrecv(0x1c0000a8150, 0x0, 0x1)
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/chan.go:664 +0x445 fp=0x1c000074790 sp=0x1c000074718 pc=0x1548fd105
runtime.chanrecv1(0x0?, 0x0?)
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/chan.go:506 +0x12 fp=0x1c0000747b8 sp=0x1c000074790 pc=0x1548fcc92
runtime.unique_runtime_registerUniqueMapCleanup.func2(...)
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/mgc.go:1796
runtime.unique_runtime_registerUniqueMapCleanup.gowrap1()
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/mgc.go:1799 +0x2f fp=0x1c0000747e0 sp=0x1c0000747b8 pc=0x15490e74f
runtime.goexit({})
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/asm_amd64.s:1700 +0x1 fp=0x1c0000747e8 sp=0x1c0000747e0 pc=0x154965ee1
created by unique.runtime_registerUniqueMapCleanup in goroutine 1
	/Users/runner/go/pkg/mod/golang.org/[email protected]/src/runtime/mgc.go:1794 +0x79

Also @asottile , I am a massive pre-commit fan. Thank you (and all the contributors) for all the hard work on that project!

b-long avatar Jun 01 '25 19:06 b-long