Skip to content

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

Closed

Description

@kevinburke

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

Activity

  1. kevinburke commented on Apr 29, 2018

    @kevinburke
    ContributorAuthor

    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.

  2. changed the title [-]cmd/compile: fatal error[/-] [+]cmd/compile: fatal error on Mac when caller changes stdout buffering[/+] on Apr 29, 2018
  3. randall77 commented on Apr 29, 2018

    @randall77
    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.

  4. kevinburke commented on Apr 29, 2018

    @kevinburke
    ContributorAuthor

    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.

  5. added
    NeedsFixThe path to resolution is known, but the work has not been done.
    on Apr 30, 2018
  6. added this to the Go1.11 milestone on Apr 30, 2018
  7. ianlancetaylor commented on May 1, 2018

    @ianlancetaylor
    Contributor

    @kevinburke Is there anything else to do here?

  8. kevinburke commented on May 1, 2018

    @kevinburke
    ContributorAuthor

    I don't think so...

  9. locked and limited conversation to collaborators on May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions