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

cmd/compile: fatal error on Mac when caller changes stdout buffering #25170

Closed
kevinburke opened this issue Apr 29, 2018 · 5 comments
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@kevinburke
Copy link
Contributor

kevinburke commented Apr 29, 2018

Please answer these questions before submitting your issue. Thanks!

What did you do?

  1. Install coreutils package on Mac: brew install coreutils

  2. Attempt to run a Go program with line buffering output:

gstdbuf --output=L go test ./...

What did you expect to see?

I expected the tests to run.

What did you see instead?

$ gstdbuf --output=0 go test ./...
go tool compile: exit status 2
fatal error: runtime: bsdthread_register error (unset DYLD_INSERT_LIBRARIES)

runtime stack:
runtime.throw(0x183236f, 0x3f)
	/Users/kevin/go/src/runtime/panic.go:589 +0x72 fp=0x7ffeefbff298 sp=0x7ffeefbff268 pc=0x102a272
runtime.goenvs()
	/Users/kevin/go/src/runtime/os_darwin.go:127 +0x9c fp=0x7ffeefbff2c8 sp=0x7ffeefbff298 pc=0x10280bc
runtime.schedinit()
	/Users/kevin/go/src/runtime/proc.go:505 +0xd3 fp=0x7ffeefbff330 sp=0x7ffeefbff2c8 pc=0x102cbc3
runtime.rt0_go(0x7ffeefbff360, 0x2, 0x7ffeefbff360, 0x0, 0x2, 0x7ffeefbff5f8, 0x7ffeefbff626, 0x0, 0x7ffeefbff62e, 0x7ffeefbff684, ...)
	/Users/kevin/go/src/runtime/asm_amd64.s:223 +0x187 fp=0x7ffeefbff338 sp=0x7ffeefbff330 pc=0x1053887
go tool compile: exit status 2
fatal error: runtime: bsdthread_register error (unset DYLD_INSERT_LIBRARIES)

runtime stack:
runtime.throw(0x183236f, 0x3f)
	/Users/kevin/go/src/runtime/panic.go:589 +0x72 fp=0x7ffeefbff298 sp=0x7ffeefbff268 pc=0x102a272
runtime.goenvs()
	/Users/kevin/go/src/runtime/os_darwin.go:127 +0x9c fp=0x7ffeefbff2c8 sp=0x7ffeefbff298 pc=0x10280bc
runtime.schedinit()
	/Users/kevin/go/src/runtime/proc.go:505 +0xd3 fp=0x7ffeefbff330 sp=0x7ffeefbff2c8 pc=0x102cbc3
runtime.rt0_go(0x7ffeefbff360, 0x2, 0x7ffeefbff360, 0x0, 0x2, 0x7ffeefbff5f8, 0x7ffeefbff626, 0x0, 0x7ffeefbff62e, 0x7ffeefbff684, ...)
	/Users/kevin/go/src/runtime/asm_amd64.s:223 +0x187 fp=0x7ffeefbff338 sp=0x7ffeefbff330 pc=0x1053887

Does this issue reproduce with the latest release (go1.10.1)?

Yes

System details

go version devel +adb52cff58 Fri Apr 27 20:57:51 2018 +0000 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/kevin/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/kevin"
GORACE=""
GOROOT="/Users/kevin/go"
GOTMPDIR=""
GOTOOLDIR="/Users/kevin/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/sf/fsn3_vgd0n98r0jb86bgp83r0000gn/T/go-build352001371=/tmp/go-build -gno-record-gcc-switches -fno-common"
GOROOT/bin/go version: go version devel +adb52cff58 Fri Apr 27 20:57:51 2018 +0000 darwin/amd64
GOROOT/bin/go tool compile -V: compile version devel +adb52cff58 Fri Apr 27 20:57:51 2018 +0000
uname -v: Darwin Kernel Version 17.5.0: Mon Mar  5 22:24:32 PST 2018; root:xnu-4570.51.1~1/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.13.4
BuildVersion:	17E199
lldb --version: lldb-900.0.57
  Swift-4.0
@kevinburke
Copy link
Contributor Author

To be clear line buffering doesn't matter / isn't important for this particular program. It was just the first thing I thought of when I wanted to test out stdbuf/gstdbuf, and it turns out it panics and I figured at the very least we could prevent a panic there or present a better error message.

If the answer is "don't run your program after messing with the line buffer" that's fine too.

@kevinburke kevinburke changed the title cmd/compile: fatal error cmd/compile: fatal error on Mac when caller changes stdout buffering Apr 29, 2018
@randall77
Copy link
Contributor

This may be fixed as part of #17490. If you have a chance, try to rebuild the Go distribution using the pending CL on that issue and report back whether it fixes this issue.

@kevinburke
Copy link
Contributor Author

I rebuilt with the pending CL. The first time I ran gstdbuf --output=0 go test ./... I got go tool: no such tool "vet". I then ran the same prefix with go install ./... and go test ./... and the second time I ran the tests, they passed with no problems.

@andybons andybons added the NeedsFix The path to resolution is known, but the work has not been done. label Apr 30, 2018
@andybons andybons added this to the Go1.11 milestone Apr 30, 2018
@ianlancetaylor
Copy link
Contributor

@kevinburke Is there anything else to do here?

@kevinburke
Copy link
Contributor Author

I don't think so...

@golang golang locked and limited conversation to collaborators May 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants