go: SIGSEGV: segmentation violation code=0x1 - help

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

$ go version
go version go1.17.4 darwin/amd64

Does this issue reproduce with the latest release?

I get it both on 1.17.3 and 1.17.4

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/dimitardimitrov/Library/Caches/go-build"
GOENV="/Users/dimitardimitrov/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/dimitardimitrov/Desktop/repos/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/dimitardimitrov/Desktop/repos"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17.4"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/dimitardimitrov/Desktop/repos/testkit/go.mod"
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/nc/qtdpw1z10mn5glqqw556z53c0000gn/T/go-build2059822728=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Basically building locally a go binary. The binary that I produce is working on other people’s MacOS machines but not on mine. The way the binary is build is standard GOOS=$(1) GOARCH=$(2) go build where GOOS is darwin and GOARCH is amd64.

What did you expect to see?

Running go binary

What did you see instead?

fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0xb01dfacedebac1e pc=0x7fff2050bc9e]

runtime stack:
runtime: unexpected return pc for runtime.sigpanic called from 0x7fff2050bc9e
stack: frame={sp:0x700003715e58, fp:0x700003715ea8} stack=[0x700003696338,0x700003715f38)
0x0000700003715d58:  0x0100700003715d78  0x0000000000000004 
0x0000700003715d68:  0x000000000000001f  0x00007fff2050bc9e 
0x0000700003715d78:  0x0b01dfacedebac1e  0x0000000000000001 
0x0000700003715d88:  0x0000000004034b31 <runtime.throw+0x0000000000000071>  0x0000700003715e28 
0x0000700003715d98:  0x0000000005950d37  0x0000700003715de0 
0x0000700003715da8:  0x0000000004034de8 <runtime.fatalthrow.func1+0x0000000000000048>  0x000000c0005921a0 
0x0000700003715db8:  0x0000000000000001  0x0000000000000001 
0x0000700003715dc8:  0x0000700003715e28  0x0000000004034b31 <runtime.throw+0x0000000000000071> 
0x0000700003715dd8:  0x000000c0005921a0  0x0000700003715e18 
0x0000700003715de8:  0x0000000004034d70 <runtime.fatalthrow+0x0000000000000050>  0x0000700003715df8 
0x0000700003715df8:  0x0000000004034da0 <runtime.fatalthrow.func1+0x0000000000000000>  0x000000c0005921a0 
0x0000700003715e08:  0x0000000004034b31 <runtime.throw+0x0000000000000071>  0x0000700003715e28 
0x0000700003715e18:  0x0000700003715e48  0x0000000004034b31 <runtime.throw+0x0000000000000071> 
0x0000700003715e28:  0x0000700003715e30  0x0000000004034b60 <runtime.throw.func1+0x0000000000000000> 
0x0000700003715e38:  0x0000000005972c8d  0x000000000000002a 
0x0000700003715e48:  0x0000700003715e98  0x000000000404a8b6 <runtime.sigpanic+0x0000000000000396> 
0x0000700003715e58: <0x0000000005972c8d  0x000000c000716000 
0x0000700003715e68:  0x0000700003715ed8  0x00000000040278c6 <runtime.(*mheap).allocSpan+0x0000000000000546> 
0x0000700003715e78:  0x000000c0008a82c8  0x0000000004593649 <encoding/xml.(*Decoder).Token+0x0000000000000549> 
0x0000700003715e88:  0x000000c0000001a0  0x0000000000000000 
0x0000700003715e98:  0x0000700003715ee0 !0x00007fff2050bc9e 
0x0000700003715ea8: >0x0000700003715ee0  0x0000000006ad0000 
0x0000700003715eb8:  0x0000000000000564  0x00000000042e0365 <golang.org/x/sys/unix.libc_ioctl_trampoline+0x0000000000000005> 
0x0000700003715ec8:  0x0000000004067bdf <runtime.syscall+0x000000000000001f>  0x000000c0008a8ec0 
0x0000700003715ed8:  0x000000000406754c <runtime.nanotime_trampoline+0x000000000000000c>  0x000000c0008a8e90 
0x0000700003715ee8:  0x0000000004065a50 <runtime.asmcgocall+0x0000000000000070>  0x0000700003715f20 
0x0000700003715ef8:  0x000000000400ec0e <runtime.persistentalloc.func1+0x000000000000002e>  0x0000000000001018 
0x0000700003715f08:  0x000000c0005921a0  0x0000000006c3dd58 
0x0000700003715f18:  0x0000000000001198  0x000000c0000001a0 
0x0000700003715f28:  0x0000000004063b69 <runtime.systemstack+0x0000000000000049>  0x0000700003715f50 
runtime.throw({0x5972c8d, 0xc000716000})
	/usr/local/go/src/runtime/panic.go:1198 +0x71
runtime: unexpected return pc for runtime.sigpanic called from 0x7fff2050bc9e
stack: frame={sp:0x700003715e58, fp:0x700003715ea8} stack=[0x700003696338,0x700003715f38)
0x0000700003715d58:  0x0100700003715d78  0x0000000000000004 
0x0000700003715d68:  0x000000000000001f  0x00007fff2050bc9e 
0x0000700003715d78:  0x0b01dfacedebac1e  0x0000000000000001 
0x0000700003715d88:  0x0000000004034b31 <runtime.throw+0x0000000000000071>  0x0000700003715e28 
0x0000700003715d98:  0x0000000005950d37  0x0000700003715de0 
0x0000700003715da8:  0x0000000004034de8 <runtime.fatalthrow.func1+0x0000000000000048>  0x000000c0005921a0 
0x0000700003715db8:  0x0000000000000001  0x0000000000000001 
0x0000700003715dc8:  0x0000700003715e28  0x0000000004034b31 <runtime.throw+0x0000000000000071> 
0x0000700003715dd8:  0x000000c0005921a0  0x0000700003715e18 
0x0000700003715de8:  0x0000000004034d70 <runtime.fatalthrow+0x0000000000000050>  0x0000700003715df8 
0x0000700003715df8:  0x0000000004034da0 <runtime.fatalthrow.func1+0x0000000000000000>  0x000000c0005921a0 
0x0000700003715e08:  0x0000000004034b31 <runtime.throw+0x0000000000000071>  0x0000700003715e28 
0x0000700003715e18:  0x0000700003715e48  0x0000000004034b31 <runtime.throw+0x0000000000000071> 
0x0000700003715e28:  0x0000700003715e30  0x0000000004034b60 <runtime.throw.func1+0x0000000000000000> 
0x0000700003715e38:  0x0000000005972c8d  0x000000000000002a 
0x0000700003715e48:  0x0000700003715e98  0x000000000404a8b6 <runtime.sigpanic+0x0000000000000396> 
0x0000700003715e58: <0x0000000005972c8d  0x000000c000716000 
0x0000700003715e68:  0x0000700003715ed8  0x00000000040278c6 <runtime.(*mheap).allocSpan+0x0000000000000546> 
0x0000700003715e78:  0x000000c0008a82c8  0x0000000004593649 <encoding/xml.(*Decoder).Token+0x0000000000000549> 
0x0000700003715e88:  0x000000c0000001a0  0x0000000000000000 
0x0000700003715e98:  0x0000700003715ee0 !0x00007fff2050bc9e 
0x0000700003715ea8: >0x0000700003715ee0  0x0000000006ad0000 
0x0000700003715eb8:  0x0000000000000564  0x00000000042e0365 <golang.org/x/sys/unix.libc_ioctl_trampoline+0x0000000000000005> 
0x0000700003715ec8:  0x0000000004067bdf <runtime.syscall+0x000000000000001f>  0x000000c0008a8ec0 
0x0000700003715ed8:  0x000000000406754c <runtime.nanotime_trampoline+0x000000000000000c>  0x000000c0008a8e90 
0x0000700003715ee8:  0x0000000004065a50 <runtime.asmcgocall+0x0000000000000070>  0x0000700003715f20 
0x0000700003715ef8:  0x000000000400ec0e <runtime.persistentalloc.func1+0x000000000000002e>  0x0000000000001018 
0x0000700003715f08:  0x000000c0005921a0  0x0000000006c3dd58 
0x0000700003715f18:  0x0000000000001198  0x000000c0000001a0 
0x0000700003715f28:  0x0000000004063b69 <runtime.systemstack+0x0000000000000049>  0x0000700003715f50 
runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:719 +0x396

goroutine 1 [syscall]:
syscall.syscall(0x42e0360, 0x2, 0x40487413, 0xc0008a8f50)
	/usr/local/go/src/runtime/sys_darwin.go:22 +0x3b fp=0xc0008a8ec0 sp=0xc0008a8ea0 pc=0x406245b
syscall.syscall(0x38, 0x8, 0x38, 0xc0007c0000)
	<autogenerated>:1 +0x26 fp=0xc0008a8f08 sp=0xc0008a8ec0 pc=0x40683a6
golang.org/x/sys/unix.ioctl(0xc0005f4240, 0xc0008a9048, 0x10)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/golang.org/x/sys@v0.0.0-20210124154548-22da62e12c0c/unix/zsyscall_darwin_amd64.go:689 +0x39 fp=0xc0008a8f38 sp=0xc0008a8f08 pc=0x42dfeb9
golang.org/x/sys/unix.IoctlGetTermios(...)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/golang.org/x/sys@v0.0.0-20210124154548-22da62e12c0c/unix/ioctl.go:72
golang.org/x/crypto/ssh/terminal.IsTerminal(0x400e494)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/golang.org/x/crypto@v0.0.0-20200622213623-75b288015ac9/ssh/terminal/util.go:30 +0x50 fp=0xc0008a8fa8 sp=0xc0008a8f38 pc=0x42e0650
github.com/Sirupsen/logrus.checkIfTerminal({0x5c33640, 0xc000130010})
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/sirupsen/logrus@v1.4.0/terminal_check_notappengine.go:15 +0x75 fp=0xc0008a8fc0 sp=0xc0008a8fa8 pc=0x42e6735
github.com/Sirupsen/logrus.(*TextFormatter).init(...)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/sirupsen/logrus@v1.4.0/text_formatter.go:86
github.com/Sirupsen/logrus.(*TextFormatter).Format.func1()
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/sirupsen/logrus@v1.4.0/text_formatter.go:169 +0x3b fp=0xc0008a8ff0 sp=0xc0008a8fc0 pc=0x42e7cfb
sync.(*Once).doSlow(0x5c50aa8, 0xc00070b230)
	/usr/local/go/src/sync/once.go:68 +0xd2 fp=0xc0008a9058 sp=0xc0008a8ff0 pc=0x406f0b2
sync.(*Once).Do(...)
	/usr/local/go/src/sync/once.go:59
github.com/Sirupsen/logrus.(*TextFormatter).Format(0xc0001482d0, 0xc0004fc460)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/sirupsen/logrus@v1.4.0/text_formatter.go:169 +0xde5 fp=0xc0008a95b0 sp=0xc0008a9058 pc=0x42e76a5
github.com/Sirupsen/logrus.(*Entry).write(0xc0004fc460)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/sirupsen/logrus@v1.4.0/entry.go:256 +0xa5 fp=0xc0008a9628 sp=0xc0008a95b0 pc=0x42e1fe5
github.com/Sirupsen/logrus.Entry.log({0xc000161e30, 0xc000261bf0, {0x0, 0x0, 0x0}, 0x0, 0x0, {0x0, 0x0}, 0x0, ...}, ...)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/sirupsen/logrus@v1.4.0/entry.go:232 +0x22e fp=0xc0008a96a8 sp=0xc0008a9628 pc=0x42e1c8e
github.com/Sirupsen/logrus.(*Entry).Log(0xc000370540, 0x4, {0xc0008a97d8, 0x1, 0x1})
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/sirupsen/logrus@v1.4.0/entry.go:269 +0xa8 fp=0xc0008a97b0 sp=0xc0008a96a8 pc=0x42e21e8
github.com/Sirupsen/logrus.(*Entry).Logf(0xc000370540, 0x4, {0x5925327, 0x400bde7}, {0xc00013c1c0, 0x5396020, 0x203001})
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/sirupsen/logrus@v1.4.0/entry.go:315 +0x85 fp=0xc0008a97f8 sp=0xc0008a97b0 pc=0x42e2765
github.com/Sirupsen/logrus.(*Entry).Infof(0xc00004a0a0, {0x5925327, 0x0}, {0xc00013c1c0, 0x203000, 0x203000})
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/sirupsen/logrus@v1.4.0/entry.go:328 +0x37 fp=0xc0008a9840 sp=0xc0008a97f8 pc=0x42e2937
github.com/Mirantis/testkit/cmd/testkit.newCreateCommand.func1.1(0xc0001b9080, 0xc000382b80, {0x5c65c78, 0x6c39510}, 0xc000388780, 0x1)
	/Users/dimitardimitrov/Desktop/repos/testkit/cmd/testkit/create.go:238 +0x104 fp=0xc0008a9b90 sp=0xc0008a9840 pc=0x519e064
github.com/Mirantis/testkit/cmd/testkit.newCreateCommand.func1(0xc0001cfb80, {0xc000475bc0, 0x2, 0x2})
	/Users/dimitardimitrov/Desktop/repos/testkit/cmd/testkit/create.go:337 +0xbe5 fp=0xc0008a9d78 sp=0xc0008a9b90 pc=0x519dba5
github.com/spf13/cobra.(*Command).execute(0xc0001cfb80, {0xc000475b80, 0x2, 0x2})
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:826 +0x60e fp=0xc0008a9e38 sp=0xc0008a9d78 pc=0x502400e
github.com/spf13/cobra.(*Command).ExecuteC(0xc0001cec80)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914 +0x2fc fp=0xc0008a9ef0 sp=0xc0008a9e38 pc=0x502453c
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
main.main()
	/Users/dimitardimitrov/Desktop/repos/testkit/main.go:39 +0x20b fp=0xc0008a9f80 sp=0xc0008a9ef0 pc=0x51a918b
runtime.main()
	/usr/local/go/src/runtime/proc.go:255 +0x227 fp=0xc0008a9fe0 sp=0xc0008a9f80 pc=0x40371c7
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc0008a9fe8 sp=0xc0008a9fe0 pc=0x4065d41

goroutine 6 [select]:
go.opencensus.io/stats/view.(*worker).start(0xc00035a050)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/go.opencensus.io@v0.22.0/stats/view/worker.go:154 +0xb9
created by go.opencensus.io/stats/view.init.0
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/go.opencensus.io@v0.22.0/stats/view/worker.go:32 +0x87

goroutine 7 [chan receive]:
github.com/golang/glog.(*loggingT).flushDaemon(0x0)
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/golang/glog@v0.0.0-20160126235308-23def4e6c14b/glog.go:882 +0x6a
created by github.com/golang/glog.init.0
	/Users/dimitardimitrov/Desktop/repos/pkg/mod/github.com/golang/glog@v0.0.0-20160126235308-23def4e6c14b/glog.go:410 +0x1c5

goroutine 23 [syscall]:
os/signal.signal_recv()
	/usr/local/go/src/runtime/sigqueue.go:166 +0x28
os/signal.loop()
	/usr/local/go/src/os/signal/signal_unix.go:24 +0x19
created by os/signal.Notify.func1.1
	/usr/local/go/src/os/signal/signal.go:151 +0x2c

goroutine 24 [select]:
github.com/Mirantis/testkit/cmd/testkit.NewTestkitCommand.func1.1()
	/Users/dimitardimitrov/Desktop/repos/testkit/cmd/testkit/root.go:92 +0x77
created by github.com/Mirantis/testkit/cmd/testkit.NewTestkitCommand.func1
	/Users/dimitardimitrov/Desktop/repos/testkit/cmd/testkit/root.go:91 +0x525

goroutine 66 [IO wait]:
internal/poll.runtime_pollWait(0x10202108, 0x72)
	/usr/local/go/src/runtime/netpoll.go:234 +0x89
internal/poll.(*pollDesc).wait(0xc0007c6800, 0xc0006a0000, 0x0)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x32
internal/poll.(*pollDesc).waitRead(...)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc0007c6800, {0xc0006a0000, 0x17c4, 0x17c4})
	/usr/local/go/src/internal/poll/fd_unix.go:167 +0x25a
net.(*netFD).Read(0xc0007c6800, {0xc0006a0000, 0xc0006a000d, 0x167})
	/usr/local/go/src/net/fd_posix.go:56 +0x29
net.(*conn).Read(0xc0005d6000, {0xc0006a0000, 0x17b7, 0xc0000797f8})
	/usr/local/go/src/net/net.go:183 +0x45
crypto/tls.(*atLeastReader).Read(0xc00022c078, {0xc0006a0000, 0x0, 0x400b08d})
	/usr/local/go/src/crypto/tls/conn.go:777 +0x3d
bytes.(*Buffer).ReadFrom(0xc0005da278, {0x5c2f5a0, 0xc00022c078})
	/usr/local/go/src/bytes/buffer.go:204 +0x98
crypto/tls.(*Conn).readFromUntil(0xc0005da000, {0x102c0008, 0xc0005d6000}, 0x8c4b500)
	/usr/local/go/src/crypto/tls/conn.go:799 +0xe5
crypto/tls.(*Conn).readRecordOrCCS(0xc0005da000, 0x0)
	/usr/local/go/src/crypto/tls/conn.go:606 +0x112
crypto/tls.(*Conn).readRecord(...)
	/usr/local/go/src/crypto/tls/conn.go:574
crypto/tls.(*Conn).Read(0xc0005da000, {0xc0007e9000, 0x1000, 0x1})
	/usr/local/go/src/crypto/tls/conn.go:1277 +0x16f
net/http.(*persistConn).Read(0xc0007fa120, {0xc0007e9000, 0xc000240060, 0xc000079d30})
	/usr/local/go/src/net/http/transport.go:1926 +0x4e
bufio.(*Reader).fill(0xc00030a000)
	/usr/local/go/src/bufio/bufio.go:101 +0x103
bufio.(*Reader).Peek(0xc00030a000, 0x1)
	/usr/local/go/src/bufio/bufio.go:139 +0x5d
net/http.(*persistConn).readLoop(0xc0007fa120)
	/usr/local/go/src/net/http/transport.go:2087 +0x1ac
created by net/http.(*Transport).dialConn
	/usr/local/go/src/net/http/transport.go:1747 +0x1e05

goroutine 67 [select]:
net/http.(*persistConn).writeLoop(0xc0007fa120)
	/usr/local/go/src/net/http/transport.go:2386 +0xfb
created by net/http.(*Transport).dialConn
	/usr/local/go/src/net/http/transport.go:1748 +0x1e65

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 17 (7 by maintainers)

Most upvoted comments

What version of golang.org/x/sys do you use? Could you try updating your golang.org/x/sys dependency? Thanks.

Maybe a dup of #45702

Thanks! go get -u golang.org/x/sys resolved the issue for me on macOS Cataline 10.15.7, go1.17.6 darwin/amd64

@cranzy thanks. Could you make sure the golang.org/x/sys dependency is updated? Could you paste the new output for the failure? Thanks.

If this is reproducible, with Go 1.17, could you try building your binary with environment variable GOEXPERIMENT=noregabi (this needs to be set when you build the binary, not running it).