-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
Milestone
Description
I am running into a similar issue to #14476 (comment) where the binary I compile using go 1.6 using musl (https://github.com/mattes/migrate, which depends upon https://github.com/mattn/go-sqlite3, which may just have some problematic CGO, but I don't know what to look for) is segfaulting during runtime. To reproduce:
$ docker run -it golang:1.6.0-alpine sh
/go # apk add --update git alpine-sdk
...
/go # go get github.com/mattes/migrate
/go # migrate
Segmentation fault
Here's the version of Go and the env on that image:
/go # go version
go version go1.6 linux/amd64
/go # go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
Here are the strace and GDB results:
/go # strace /go/bin/migrate
execve("/go/bin/migrate", ["/go/bin/migrate"], [/* 14 vars */]) = 0
arch_prctl(ARCH_SET_FS, 0x7fac21441da8) = 0
set_tid_address(0x7fac21441de0) = 12
mprotect(0x7fac21440000, 4096, PROT_READ) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_ACCERR, si_addr=0x55961ac54f00} ---
+++ killed by SIGSEGV +++
Segmentation fault
Output from running gdb /go/bin/migrate
:
Reading symbols from /go/bin/migrate...done.
Loading Go Runtime support.
(gdb) r
Starting program: /go/bin/migrate
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7d93531 in ?? () from /lib/ld-musl-x86_64.so.1
(gdb) bt
#0 0x00007ffff7d93531 in ?? () from /lib/ld-musl-x86_64.so.1
#1 0x0000000000000000 in ?? ()
(gdb) quit
The 1.6.0-alpine image is based on alpine3.3. In case you wanted to use the ISO to replicate instead, maybe http://wiki.alpinelinux.org/cgi-bin/dl.cgi/v3.3/releases/x86_64/alpine-3.3.1-x86_64.iso will work?