Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/build: Segfault on Go 1.6.2 darwin/amd64 #17912

Closed
mbertschler opened this issue Nov 14, 2016 · 2 comments
Closed

go/build: Segfault on Go 1.6.2 darwin/amd64 #17912

mbertschler opened this issue Nov 14, 2016 · 2 comments

Comments

@mbertschler
Copy link

Environment

go version go1.6.2 darwin/amd64
(compiled from source using go1.4.3)
macOS 10.12.1

What did you do?

Compile an empty test package in a loop, and check if the compiler panics.

Content of $GOPATH/test/main.go:

package main

func main() {}

Content of bugreproducer.go:

package main

import (
	"fmt"
	"os"
	"os/exec"
)

func main() {
	for i := 0; true; i++ {
		c := exec.Command("go", "build", "test")
		c.Stdout = os.Stdout
		c.Stderr = os.Stderr
		c.Stdin = os.Stdin
		err := c.Run()
		if err != nil {
			fmt.Println("Error on run", i, ":", err)
		}
	}
}

Run this to continuously build the empty test package:
go run bugreproducer.go

What did you expect to see?

No error output.

What did you see instead?

About 2% of the time, the go build panics.
I tried to shorten the output a bit, there is a link to the full output on the bottom:

$ go run bugreproducer.go
# test
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x6fdfe32cd122 pc=0xf47b]

runtime stack:
runtime.throw(0x2c4900, 0x2a)
	/Users/mbertschler/dev/go/go/src/runtime/panic.go:547 +0x90
runtime.sigpanic()
	/Users/mbertschler/dev/go/go/src/runtime/sigpanic_unix.go:12 +0x5a
...

goroutine 1 [running]:
runtime.systemstack_switch()
	/Users/mbertschler/dev/go/go/src/runtime/asm_amd64.s:245 fp=0xc82003c9d0 sp=0xc82003c9c8
runtime.mallocgc(0x10, 0x1f0c00, 0x1, 0xc8201f3ff0)
	/Users/mbertschler/dev/go/go/src/runtime/malloc.go:643 +0x869 fp=0xc82003caa8 sp=0xc82003c9d0
runtime.newarray(0x1f0c00, 0x2, 0xc8201f3ff0)
	/Users/mbertschler/dev/go/go/src/runtime/malloc.go:798 +0xc9 fp=0xc82003cae8 sp=0xc82003caa8
runtime.makeslice(0x1e7280, 0x2, 0x2, 0x0, 0x0, 0x0)
	/Users/mbertschler/dev/go/go/src/runtime/slice.go:32 +0x165 fp=0xc82003cb38 sp=0xc82003cae8
cmd/link/internal/ld.readsym(0xc820072240, 0xc82000e380, 0x27e550, 0x7, 0xc820013040, 0x3f)
	/Users/mbertschler/dev/go/go/src/cmd/link/internal/ld/objfile.go:294 +0x1756 fp=0xc82003cf80 sp=0xc82003cb38
...

Error on run 11 : exit status 2
# test
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x6fe057da9ed6 pc=0xf47b]

runtime stack:
runtime.throw(0x2c4900, 0x2a)
	/Users/mbertschler/dev/go/go/src/runtime/panic.go:547 +0x90
runtime.sigpanic()
	/Users/mbertschler/dev/go/go/src/runtime/sigpanic_unix.go:12 +0x5a
...

goroutine 1 [running]:
runtime.systemstack_switch()
	/Users/mbertschler/dev/go/go/src/runtime/asm_amd64.s:245 fp=0xc820036878 sp=0xc820036870
runtime.mallocgc(0x120, 0x276fa0, 0x0, 0x1d7520)
	/Users/mbertschler/dev/go/go/src/runtime/malloc.go:643 +0x869 fp=0xc820036950 sp=0xc820036878
runtime.newobject(0x276fa0, 0xc820016360)
	/Users/mbertschler/dev/go/go/src/runtime/malloc.go:781 +0x42 fp=0xc820036978 sp=0xc820036950
cmd/link/internal/ld._lookup(0xc820072240, 0xc8207d3380, 0x14, 0x0, 0x1, 0x14)
	/Users/mbertschler/dev/go/go/src/cmd/link/internal/ld/sym.go:201 +0xf3 fp=0xc8200369f0 sp=0xc820036978
cmd/link/internal/ld.Linklookup(0xc820072240, 0xc8207d3380, 0x14, 0x0, 0xc8207d3380)
	/Users/mbertschler/dev/go/go/src/cmd/link/internal/ld/sym.go:208 +0x48 fp=0xc820036a28 sp=0xc8200369f0
...
Error on run 21 : exit status 2
Error on run 32 : signal: segmentation fault
# test
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x6fe1429fb9fc pc=0xf47b]

runtime stack:
runtime.throw(0x2c4900, 0x2a)
	/Users/mbertschler/dev/go/go/src/runtime/panic.go:547 +0x90
runtime.sigpanic()
	/Users/mbertschler/dev/go/go/src/runtime/sigpanic_unix.go:12 +0x5a
...

goroutine 1 [running]:
runtime.systemstack_switch()
	/Users/mbertschler/dev/go/go/src/runtime/asm_amd64.s:245 fp=0xc820e431a0 sp=0xc820e43198
runtime.mallocgc(0x380, 0x1e92c0, 0xc800000000, 0xffffffff00000000)
	/Users/mbertschler/dev/go/go/src/runtime/malloc.go:643 +0x869 fp=0xc820e43278 sp=0xc820e431a0
runtime.newobject(0x1e92c0, 0xfffffffffffffffe)
	/Users/mbertschler/dev/go/go/src/runtime/malloc.go:781 +0x42 fp=0xc820e432a0 sp=0xc820e43278
cmd/link/internal/ld.writelines()
	/Users/mbertschler/dev/go/go/src/cmd/link/internal/ld/dwarf.go:1651 +0xefc fp=0xc820e43658 sp=0xc820e432a0
...

Error on run 41 : exit status 2
# test
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x6fe3963c681c pc=0xf47b]

runtime stack:
runtime.throw(0x2c4900, 0x2a)
	/Users/mbertschler/dev/go/go/src/runtime/panic.go:547 +0x90
runtime.sigpanic()
	/Users/mbertschler/dev/go/go/src/runtime/sigpanic_unix.go:12 +0x5a
...

goroutine 1 [running]:
runtime.systemstack_switch()
	/Users/mbertschler/dev/go/go/src/runtime/asm_amd64.s:245 fp=0xc820cc1508 sp=0xc820cc1500
runtime.mallocgc(0x1e000, 0x0, 0xc800000003, 0x8)
	/Users/mbertschler/dev/go/go/src/runtime/malloc.go:665 +0x9eb fp=0xc820cc15e0 sp=0xc820cc1508
runtime.rawmem(0x1e000, 0x31)
	/Users/mbertschler/dev/go/go/src/runtime/malloc.go:809 +0x32 fp=0xc820cc1608 sp=0xc820cc15e0
runtime.growslice(0x1e8780, 0xc820572000, 0x18000, 0x18000, 0x18001, 0x0, 0x0, 0x0)
	/Users/mbertschler/dev/go/go/src/runtime/slice.go:95 +0x233 fp=0xc820cc1678 sp=0xc820cc1608
cmd/link/internal/ld.Symgrow(0xc820072240, 0xc820cb9b00, 0x18015)
	/Users/mbertschler/dev/go/go/src/cmd/link/internal/ld/data.go:52 +0x26e fp=0xc820cc1730 sp=0xc820cc1678
...

Error on run 89 : exit status 2
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x6feb06c441e4 pc=0x9c73b]

runtime stack:
runtime.throw(0x689880, 0x2a)
	/Users/mbertschler/dev/go/go/src/runtime/panic.go:547 +0x90
runtime.sigpanic()
	/Users/mbertschler/dev/go/go/src/runtime/sigpanic_unix.go:12 +0x5a
...

goroutine 1 [running]:
runtime.systemstack_switch()
	/Users/mbertschler/dev/go/go/src/runtime/asm_amd64.s:245 fp=0xc8200fd610 sp=0xc8200fd608
runtime.mallocgc(0x900, 0x0, 0x3, 0xc820197380)
	/Users/mbertschler/dev/go/go/src/runtime/malloc.go:643 +0x869 fp=0xc8200fd6e8 sp=0xc8200fd610
runtime.rawmem(0x900, 0x180)
	/Users/mbertschler/dev/go/go/src/runtime/malloc.go:809 +0x32 fp=0xc8200fd710 sp=0xc8200fd6e8
runtime.growslice(0x453260, 0xc820197380, 0x680, 0x680, 0x681, 0x0, 0x0, 0x0)
	/Users/mbertschler/dev/go/go/src/runtime/slice.go:95 +0x233 fp=0xc8200fd780 sp=0xc8200fd710
go/build.(*importReader).readByte(0xc8200fd908, 0x49a973)
	/Users/mbertschler/dev/go/go/src/go/build/read.go:43 +0x15e fp=0xc8200fd7f0 sp=0xc8200fd780
...
Error on run 255 : exit status 2

Full output of the script: https://gist.github.com/mbertschler/fe1699bd1db32953bcad92f1f25216c9

go version go1.6.2 darwin/amd64
$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/mbertschler/go"
GORACE=""
GOROOT="/Users/mbertschler/dev/go/go"
GOTOOLDIR="/Users/mbertschler/dev/go/go/pkg/tool/darwin_amd64"
GO15VENDOREXPERIMENT="1"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"
@quentinmit
Copy link
Contributor

Go 1.6.2 does not support Sierra. You must rebuild your binaries with Go 1.7 or later. (Note that Go 1.4.3 also does not support Sierra; see the documentation for the special bootstrap procedure if you want to start from C.)

@mbertschler
Copy link
Author

Uh my bad. Thanks for the quick answer.

If somebody else finds this issue, the relevant information can be found here:
https://golang.org/doc/install/source#go14

To build a bootstrap tool chain from source, use either the git branch release-branch.go1.4 or go1.4-bootstrap-20161024.tar.gz, which contains the Go 1.4 source code plus accumulated fixes to keep the tools running on newer operating systems. (Go 1.4 was the last distribution in which the tool chain was written in C.)

@golang golang locked and limited conversation to collaborators Nov 14, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants