go: runtime: bsdthread_register error on macOS 12

Everything has been working perfectly for a while until I decided to upgrade Mac OS to Monterey.

What version of Go are you using (go version)?

go version go1.17.2 darwin/amd64

Does this issue reproduce with the latest release?

Yes. I have tried updating go to the latest version, as well as updating to the latest of xcode and command tools. Also ran brew upgrade to make sure everything is updated. Also tried diffrent shells to see if that makes any difference. I am also running the latest version of docker.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/deanwronowski/Library/Caches/go-build"
GOENV="/Users/deanwronowski/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/deanwronowski/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/deanwronowski/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.17.2/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.17.2/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17.2"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/1p/q77885x9157c_yvzss7zx1480000gn/T/go-build2753144081=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

When running the following command to connect to a server running docker it produces the error. It does not matter if the server is hosted on AWS EC2 or Digital Ocean droplets.

It seems this issue is not related just to Docker, as I am also getting this error when running a command in the terminal inside of VS.

eval "$(docker-machine env machinegoeshere)"

What did you expect to see?

Usually nothing displays which indicates its connected to the server.

What did you see instead?

fatal error: runtime: bsdthread_register error

runtime stack:
runtime.throw(0x20594e0, 0x21)
	/usr/local/go/src/runtime/panic.go:619 +0x81 fp=0x7ff7bfeff878 sp=0x7ff7bfeff858 pc=0x1029751
runtime.goenvs()
	/usr/local/go/src/runtime/os_darwin.go:129 +0x83 fp=0x7ff7bfeff8a8 sp=0x7ff7bfeff878 pc=0x10272d3
runtime.schedinit()
	/usr/local/go/src/runtime/proc.go:496 +0xa4 fp=0x7ff7bfeff900 sp=0x7ff7bfeff8a8 pc=0x102c014
runtime.rt0_go(0x7ff7bfeff930, 0x3, 0x7ff7bfeff930, 0x1000000, 0x3, 0x7ff7bfeffab0, 0x7ff7bfeffabf, 0x7ff7bfeffac3, 0x0, 0x7ff7bfeffacc, ...)
	/usr/local/go/src/runtime/asm_amd64.s:252 +0x1f4 fp=0x7ff7bfeff908 sp=0x7ff7bfeff900 pc=0x1052c64

I have seen reports starting to appear with similar issues as well

I noticed this error popped up a few years ago, I wonder if its just a case of waiting for everyone to recompile their code again, although surprised this has not been done yet?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 68
  • Comments: 48 (16 by maintainers)

Most upvoted comments

If anyone still have this issue, I installed the last official version of the deprecated project, they had a last release in Sep 02, 2019, with the Gitlab fork some machines with older hosts were not working. Install one liner:

curl -L https://github.com/docker/machine/releases/download/v0.16.2/docker-machine-`uname -s`-`uname -m` >/usr/local/bin/docker-machine && \
  chmod +x /usr/local/bin/docker-machine

a reminder of our no +1 policy please use the voting at the top if you have nothing to add

I’ve started getting the same error with git 2.30.1 after upgrading to MacOS Monterey 12.3.1. The following error only happened to git commit and no other git commands:

fatal error: runtime: bsdthread_register error

runtime stack:
runtime.throw(0x1364ecc, 0x21)
	/usr/local/go/src/runtime/panic.go:616 +0x81 fp=0x7ff7bfeff2c8 sp=0x7ff7bfeff2a8 pc=0x1028e51
runtime.goenvs()
	/usr/local/go/src/runtime/os_darwin.go:129 +0x83 fp=0x7ff7bfeff2f8 sp=0x7ff7bfeff2c8 pc=0x10269d3
runtime.schedinit()
	/usr/local/go/src/runtime/proc.go:501 +0xd6 fp=0x7ff7bfeff360 sp=0x7ff7bfeff2f8 pc=0x102b746
runtime.rt0_go(0x7ff7bfeff398, 0x4, 0x7ff7bfeff398, 0x0, 0x1000000, 0x4, 0x7ff7bfeff5e0, 0x7ff7bfeff5ef, 0x7ff7bfeff5f4, 0x7ff7bfeff5fb, ...)
	/usr/local/go/src/runtime/asm_amd64.s:252 +0x1f4 fp=0x7ff7bfeff368 sp=0x7ff7bfeff360 pc=0x1051804

Following the tips above about 1) this being caused by an old version of some go program and 2) git isn’t a go program itself therefore there must be some hook in place, I found an old hook in my core.hookspath global git configuration and managed to fix this error removing it via git config --global --unset core.hookspath

Am still getting this error while trying to use git commit, can some one please help to see how I can resolve it git version: 2.35.0 go version: go1.17.6 darwin/amd64 Screen Shot 2022-01-20 at 11 27 52

Hi all, I am also facing the same issue

I have upgraded to macos monteray and I am just running simple git command so getting this below error

fatal error: runtime: bsdthread_register error

runtime stack:
runtime.throw(0x115021a, 0x21)
        /home/travis/.gimme/versions/go1.10.2.linux.amd64/src/runtime/panic.go:616 +0x81 fp=0x7ff7bfeff0d8 sp=0x7ff7bfeff0b8 pc=0x1027a21
runtime.goenvs()
        /home/travis/.gimme/versions/go1.10.2.linux.amd64/src/runtime/os_darwin.go:129 +0x83 fp=0x7ff7bfeff108 sp=0x7ff7bfeff0d8 pc=0x10255a3
runtime.schedinit()
        /home/travis/.gimme/versions/go1.10.2.linux.amd64/src/runtime/proc.go:501 +0xd6 fp=0x7ff7bfeff170 sp=0x7ff7bfeff108 pc=0x102a316
runtime.rt0_go(0x7ff7bfeff1a0, 0x3, 0x7ff7bfeff1a0, 0x1000000, 0x3, 0x7ff7bfeff408, 0x7ff7bfeff433, 0x7ff7bfeff447, 0x0, 0x7ff7bfeff44f, ...)
        /home/travis/.gimme/versions/go1.10.2.linux.amd64/src/runtime/asm_amd64.s:252 +0x1f4 fp=0x7ff7bfeff178 sp=0x7ff7bfeff170 pc=0x104f2c4


Can someone please help?

Update: turns out that the problem is solved if aws-iam-authenticator gets installed via homebrew. Not exactly sure why, but my guess is they have an updated version in homebrew. So as for me, everything is working now. They must be using an older version of go or something. 🤷

With regards to docker-machine not working. I found a fork repo from Gitlab that has kept the docker-machine project active, with builds using more up to date Go versions. This has fixed my issue.

The link to the builds are here https://gitlab-docker-machine-downloads.s3.amazonaws.com/main/docker-machine-Darwin-x86_64

@justme-sports it’s totally not a fix, reformatting or deleting some stuff

Just updated with Software Updates to macOS Monterey 12.2.1 and each binary became broken. Tested with either go@1.17 or go@1.13 using brew.

I can confirm having this issue after upgrade to macOS Monterey Version 12.2 (21D49) with https://github.com/shyiko/kubesec . It’s latest version of binary compiled for macOS back in 2019 was built with go 1.9.1

$ kubesec --version

atal error: runtime: bsdthread_register error

runtime stack:
runtime.throw(0x156bf2a, 0x21)
	/home/shyiko/Development/golang/go1.9.1.linux-amd64/src/runtime/panic.go:605 +0x95 fp=0x7ff7bfeff060 sp=0x7ff7bfeff040 pc=0x1029ad5
runtime.goenvs()
	/home/shyiko/Development/golang/go1.9.1.linux-amd64/src/runtime/os_darwin.go:108 +0x83 fp=0x7ff7bfeff090 sp=0x7ff7bfeff060 pc=0x1027373
runtime.schedinit()
	/home/shyiko/Development/golang/go1.9.1.linux-amd64/src/runtime/proc.go:482 +0xa1 fp=0x7ff7bfeff0d0 sp=0x7ff7bfeff090 pc=0x102c481
runtime.rt0_go(0x7ff7bfeff108, 0x2, 0x7ff7bfeff108, 0x0, 0x1000000, 0x2, 0x7ff7bfeff378, 0x7ff7bfeff380, 0x0, 0x7ff7bfeff38a, ...)
	/home/shyiko/Development/golang/go1.9.1.linux-amd64/src/runtime/asm_amd64.s:175 +0x1eb fp=0x7ff7bfeff0d8 sp=0x7ff7bfeff0d0 pc=0x1053d4b

@justme-sports you can copy GOROOT/bin/gofmt to /usr/local/bin/, where GOROOT is the top-level directory of your Go 1.17.6 installation.

@justme-sports git by itself is not a Go program. You probably have git commit hook installed, for example, gofmt, or some checker. You’ll need to find out what that is (such as by looking at .git/hooks) and rebuild that program with a newer version of Go.