Fzf: Cylance causes "fatal error: runtime: bsdthread_register error"

Created on 19 Feb 2017  ·  20Comments  ·  Source: junegunn/fzf

  • Category

    • [x] fzf binary

    • [ ] fzf-tmux script

    • [ ] Key bindings

    • [ ] Completion

    • [ ] Vim

    • [ ] Neovim

    • [ ] Etc.

  • OS

    • [ ] Linux

    • [x] Mac OS X

    • [ ] Windows

    • [ ] Windows Subsystem for Linux

    • [ ] Etc.

  • Shell

    • [x] bash

    • [ ] zsh

    • [ ] fish

Hi there,

I am running fzf: stable 0.16.5 installed using Homebrew. Go version is 1.8

$ brew info fzf
fzf: stable 0.16.5 (bottled), HEAD
Command-line fuzzy finder written in Go
https://github.com/junegunn/fzf
/usr/local/Cellar/fzf/0.16.5 (17 files, 3.1M) *
  Poured from bottle on 2017-02-19 at 22:26:46
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/fzf.rb
==> Dependencies
Build: go ✔
==> Requirements
Build: git ✔
==> Caveats
To install useful keybindings and fuzzy completion:
  /usr/local/opt/fzf/install

To use fzf in Vim, add the following line to your .vimrc:
  set rtp+=/usr/local/opt/fzf
$ go version
go version go1.8 darwin/amd64

and got the following error when hitting a search (ctrl-R)

$ `__fzf_history__`fatal error: runtime: bsdthread_register error

runtime stack:
runtime.throw(0x115d039, 0x21)
    /usr/local/Cellar/go/1.8/libexec/src/runtime/panic.go:596 +0x95 fp=0x7fff5fbfe560 sp=0x7fff5fbfe540
runtime.goenvs()
    /usr/local/Cellar/go/1.8/libexec/src/runtime/os_darwin.go:108 +0xa0 fp=0x7fff5fbfe590 sp=0x7fff5fbfe560
runtime.schedinit()
    /usr/local/Cellar/go/1.8/libexec/src/runtime/proc.go:486 +0xa1 fp=0x7fff5fbfe5d0 sp=0x7fff5fbfe590
runtime.rt0_go(0x7fff5fbfe600, 0x1, 0x7fff5fbfe600, 0x0, 0x1, 0x7fff5fbfe9a8, 0x0, 0x7fff5fbfe9ac, 0x7fff5fbfea0c, 0x7fff5fbfea44, ...)
    /usr/local/Cellar/go/1.8/libexec/src/runtime/asm_amd64.s:158 +0x183 fp=0x7fff5fbfe5d8 sp=0x7fff5fbfe5d0

Interestingly running FZF search from Vim works perfectly fine.

tip

Most helpful comment

I see, thanks for the update. Looks like there's not much I can do at the moment. I don't want to rebuild the binaries using Go 1.7 since I noticed that fzf binary built with Go 1.8 is roughly 5~7% faster than the one built with 1.7.

All 20 comments

I can't reproduce. Do you have an anti-virus software running?

I'm having the same issues since I did a PlugUpdate. I've looked into the posted links and it's not clear what the solution would be.

Previous versions of fzf (perhaps it's go version-related) didn't have this issue. I've had this company laptop with AV software for almost a year and I just ran into this issue today.

Hmm, interesting. I'll see if it's possible to avoid the issue. For the time being, use 0.16.4 binary built with Go 1.7.

Yeah thanks, also, just as a note, the last version I had in my ~/.fzf/bin was 0.16.2, so I'm unsure if 0.16.3 or 0.16.4 would have worked for me. I can test those for you if you'd like.

Currently, I just symlinked my 0.16.2 as fzf in the same folder and it's working again.

@hahuang65 I can confirm that reverting to 0.16.4 works for me.

I'm not yet sure if there is something I can do to avoid the problem, or we have no way but to hope that it's fixed in Go or in your anti-virus software. But anyway, since there's no way I can reproduce the problem on my environment, I need your assistance to find the solution.

  1. Install Go. brew install go should suffice.
  2. Clone fzf repo if you haven't already.
  3. make install inside src directory, and see if the resulting binary bin/fzf works correctly.

Here we go... it didn't compile:

$ make install
mkdir -p /Users/hhhuang/Documents/Projects/fzf/gopath/src/github.com/junegunn/fzf
ln -s /Users/hhhuang/Documents/Projects/fzf/src /Users/hhhuang/Documents/Projects/fzf/gopath/src/github.com/junegunn/fzf/src
cd /Users/hhhuang/Documents/Projects/fzf/gopath/src/github.com/junegunn/fzf/src && go get -tags ""
# github.com/junegunn/go-shellwords
fatal error: runtime: bsdthread_register error

runtime stack:
runtime.throw(0x16c1e4f, 0x21)
        /usr/local/Cellar/go/1.8/libexec/src/runtime/panic.go:596 +0x95 fp=0x7fff5fbfeb20 sp=0x7fff5fbfeb00
runtime.goenvs()
        /usr/local/Cellar/go/1.8/libexec/src/runtime/os_darwin.go:108 +0xa0 fp=0x7fff5fbfeb50 sp=0x7fff5fbfeb20
runtime.schedinit()
        /usr/local/Cellar/go/1.8/libexec/src/runtime/proc.go:486 +0xa1 fp=0x7fff5fbfeb90 sp=0x7fff5fbfeb50
runtime.rt0_go(0x7fff5fbfebc8, 0x11, 0x7fff5fbfebc8, 0x0, 0x0, 0x11, 0x7fff5fbfef10, 0x7fff5fbfef4f, 0x7fff5fbfef52, 0x7fff5fbfefb9, ...)
        /usr/local/Cellar/go/1.8/libexec/src/runtime/asm_amd64.s:158 +0x183 fp=0x7fff5fbfeb98 sp=0x7fff5fbfeb90
# github.com/junegunn/go-isatty
fatal error: runtime: bsdthread_register error

runtime stack:
runtime.throw(0x16c1e4f, 0x21)
        /usr/local/Cellar/go/1.8/libexec/src/runtime/panic.go:596 +0x95 fp=0x7fff5fbfeb40 sp=0x7fff5fbfeb20
runtime.goenvs()
        /usr/local/Cellar/go/1.8/libexec/src/runtime/os_darwin.go:108 +0xa0 fp=0x7fff5fbfeb70 sp=0x7fff5fbfeb40
runtime.schedinit()
        /usr/local/Cellar/go/1.8/libexec/src/runtime/proc.go:486 +0xa1 fp=0x7fff5fbfebb0 sp=0x7fff5fbfeb70
runtime.rt0_go(0x7fff5fbfebe8, 0x11, 0x7fff5fbfebe8, 0x0, 0x0, 0x11, 0x7fff5fbfef30, 0x7fff5fbfef6f, 0x7fff5fbfef72, 0x7fff5fbfefd5, ...)
        /usr/local/Cellar/go/1.8/libexec/src/runtime/asm_amd64.s:158 +0x183 fp=0x7fff5fbfebb8 sp=0x7fff5fbfebb0
# github.com/junegunn/go-runewidth
fatal error: runtime: bsdthread_register error

runtime stack:
runtime.throw(0x16c1e4f, 0x21)
        /usr/local/Cellar/go/1.8/libexec/src/runtime/panic.go:596 +0x95 fp=0x7fff5fbfeb20 sp=0x7fff5fbfeb00
runtime.goenvs()
        /usr/local/Cellar/go/1.8/libexec/src/runtime/os_darwin.go:108 +0xa0 fp=0x7fff5fbfeb50 sp=0x7fff5fbfeb20
runtime.schedinit()
        /usr/local/Cellar/go/1.8/libexec/src/runtime/proc.go:486 +0xa1 fp=0x7fff5fbfeb90 sp=0x7fff5fbfeb50
runtime.rt0_go(0x7fff5fbfebc8, 0x11, 0x7fff5fbfebc8, 0x0, 0x0, 0x11, 0x7fff5fbfef10, 0x7fff5fbfef4f, 0x7fff5fbfef52, 0x7fff5fbfefb8, ...)
        /usr/local/Cellar/go/1.8/libexec/src/runtime/asm_amd64.s:158 +0x183 fp=0x7fff5fbfeb98 sp=0x7fff5fbfeb90
# golang.org/x/crypto/ssh/terminal
fatal error: runtime: bsdthread_register error

runtime stack:
runtime.throw(0x16c1e4f, 0x21)
        /usr/local/Cellar/go/1.8/libexec/src/runtime/panic.go:596 +0x95 fp=0x7fff5fbfead0 sp=0x7fff5fbfeab0
runtime.goenvs()
        /usr/local/Cellar/go/1.8/libexec/src/runtime/os_darwin.go:108 +0xa0 fp=0x7fff5fbfeb00 sp=0x7fff5fbfead0
runtime.schedinit()
        /usr/local/Cellar/go/1.8/libexec/src/runtime/proc.go:486 +0xa1 fp=0x7fff5fbfeb40 sp=0x7fff5fbfeb00
runtime.rt0_go(0x7fff5fbfeb70, 0x12, 0x7fff5fbfeb70, 0x0, 0x12, 0x7fff5fbfeec0, 0x7fff5fbfeeff, 0x7fff5fbfef02, 0x7fff5fbfef68, 0x7fff5fbfef72, ...)
        /usr/local/Cellar/go/1.8/libexec/src/runtime/asm_amd64.s:158 +0x183 fp=0x7fff5fbfeb48 sp=0x7fff5fbfeb40
make: *** [deps] Error 2

Hmm, let's see if adding -linkmode=external (as suggested in the linked issue) helps. Can you update Makefile as follows and try again?

diff --git a/src/Makefile b/src/Makefile
index b8c3090..90e4ef6 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -84,7 +84,7 @@ $(SRCDIR):
    ln -s $(ROOTDIR) $(SRCDIR)

 deps: $(SRCDIR) $(SOURCES)
-   cd $(SRCDIR) && go get -tags "$(TAGS)"
+   cd $(SRCDIR) && go get -ldflags "-w -linkmode=external -extldflags=$(LDFLAGS)" -tags "$(TAGS)"
    ./deps

 test: deps
@@ -99,10 +99,10 @@ clean:
    cd fzf && rm -f fzf-*

 fzf/$(BINARY32): deps
-   cd fzf && GOARCH=386 go build -a -ldflags "-w -extldflags=$(LDFLAGS)" -tags "$(TAGS)" -o $(BINARY32)
+   cd fzf && GOARCH=386 go build -a -ldflags "-w -linkmode=external -extldflags=$(LDFLAGS)" -tags "$(TAGS)" -o $(BINARY32)

 fzf/$(BINARY64): deps
-   cd fzf && GOARCH=amd64 go build -a -ldflags "-w -extldflags=$(LDFLAGS)" -tags "$(TAGS)" -o $(BINARY64)
+   cd fzf && GOARCH=amd64 go build -a -ldflags "-w -linkmode=external -extldflags=$(LDFLAGS)" -tags "$(TAGS)" -o $(BINARY64)

 # https://github.com/golang/go/wiki/GoArm
 fzf/$(BINARYARM5): deps

make install output:

$ make install
cd /Users/hhhuang/Documents/Projects/fzf/gopath/src/github.com/junegunn/fzf/src && go get -ldflags "-w -linkmode=external -extldflags=" -tags ""
# github.com/junegunn/go-isatty
fatal error: runtime: bsdthread_register error

runtime stack:
runtime.throw(0x16c1e4f, 0x21)
        /usr/local/Cellar/go/1.8/libexec/src/runtime/panic.go:596 +0x95 fp=0x7fff5fbfeb40 sp=0x7fff5fbfeb20
runtime.goenvs()
        /usr/local/Cellar/go/1.8/libexec/src/runtime/os_darwin.go:108 +0xa0 fp=0x7fff5fbfeb70 sp=0x7fff5fbfeb40
runtime.schedinit()
        /usr/local/Cellar/go/1.8/libexec/src/runtime/proc.go:486 +0xa1 fp=0x7fff5fbfebb0 sp=0x7fff5fbfeb70
runtime.rt0_go(0x7fff5fbfebe8, 0x11, 0x7fff5fbfebe8, 0x0, 0x0, 0x11, 0x7fff5fbfef30, 0x7fff5fbfef6f, 0x7fff5fbfef72, 0x7fff5fbfefd5, ...)
        /usr/local/Cellar/go/1.8/libexec/src/runtime/asm_amd64.s:158 +0x183 fp=0x7fff5fbfebb8 sp=0x7fff5fbfebb0
# github.com/junegunn/go-shellwords
fatal error: runtime: bsdthread_register error

runtime stack:
runtime.throw(0x16c1e4f, 0x21)
        /usr/local/Cellar/go/1.8/libexec/src/runtime/panic.go:596 +0x95 fp=0x7fff5fbfeb20 sp=0x7fff5fbfeb00
runtime.goenvs()
        /usr/local/Cellar/go/1.8/libexec/src/runtime/os_darwin.go:108 +0xa0 fp=0x7fff5fbfeb50 sp=0x7fff5fbfeb20
runtime.schedinit()
        /usr/local/Cellar/go/1.8/libexec/src/runtime/proc.go:486 +0xa1 fp=0x7fff5fbfeb90 sp=0x7fff5fbfeb50
runtime.rt0_go(0x7fff5fbfebc8, 0x11, 0x7fff5fbfebc8, 0x0, 0x0, 0x11, 0x7fff5fbfef10, 0x7fff5fbfef4f, 0x7fff5fbfef52, 0x7fff5fbfefb9, ...)
        /usr/local/Cellar/go/1.8/libexec/src/runtime/asm_amd64.s:158 +0x183 fp=0x7fff5fbfeb98 sp=0x7fff5fbfeb90
# golang.org/x/crypto/ssh/terminal
fatal error: runtime: bsdthread_register error

runtime stack:
runtime.throw(0x16c1e4f, 0x21)
        /usr/local/Cellar/go/1.8/libexec/src/runtime/panic.go:596 +0x95 fp=0x7fff5fbfead0 sp=0x7fff5fbfeab0
runtime.goenvs()
        /usr/local/Cellar/go/1.8/libexec/src/runtime/os_darwin.go:108 +0xa0 fp=0x7fff5fbfeb00 sp=0x7fff5fbfead0
runtime.schedinit()
        /usr/local/Cellar/go/1.8/libexec/src/runtime/proc.go:486 +0xa1 fp=0x7fff5fbfeb40 sp=0x7fff5fbfeb00
runtime.rt0_go(0x7fff5fbfeb70, 0x12, 0x7fff5fbfeb70, 0x0, 0x12, 0x7fff5fbfeec0, 0x7fff5fbfeeff, 0x7fff5fbfef02, 0x7fff5fbfef68, 0x7fff5fbfef72, ...)
        /usr/local/Cellar/go/1.8/libexec/src/runtime/asm_amd64.s:158 +0x183 fp=0x7fff5fbfeb48 sp=0x7fff5fbfeb40
# github.com/junegunn/go-runewidth
fatal error: runtime: bsdthread_register error

runtime stack:
runtime.throw(0x16c1e4f, 0x21)
        /usr/local/Cellar/go/1.8/libexec/src/runtime/panic.go:596 +0x95 fp=0x7fff5fbfeb20 sp=0x7fff5fbfeb00
runtime.goenvs()
        /usr/local/Cellar/go/1.8/libexec/src/runtime/os_darwin.go:108 +0xa0 fp=0x7fff5fbfeb50 sp=0x7fff5fbfeb20
runtime.schedinit()
        /usr/local/Cellar/go/1.8/libexec/src/runtime/proc.go:486 +0xa1 fp=0x7fff5fbfeb90 sp=0x7fff5fbfeb50
runtime.rt0_go(0x7fff5fbfebc8, 0x11, 0x7fff5fbfebc8, 0x0, 0x0, 0x11, 0x7fff5fbfef10, 0x7fff5fbfef4f, 0x7fff5fbfef52, 0x7fff5fbfefb8, ...)
        /usr/local/Cellar/go/1.8/libexec/src/runtime/asm_amd64.s:158 +0x183 fp=0x7fff5fbfeb98 sp=0x7fff5fbfeb90
make: *** [deps] Error 2

Hmm, so it doesn't help :(

There are two things suggested in the above issue

  1. -linkmode=external
  2. Check if there's DYLD variables (env | grep DYLD) and unset them, most notably DYLD_INSERT_LIBRARIES

Yeah, there's no DYLD_* variables set unfortunately...

Okay, let's simplify the whole thing a bit, do you see the same error when you do go get github.com/mattn/go-isatty? Then we can be sure that the problem is not specific to fzf. Another thing you can check is to install Go 1.7.x and see if the command works with that version. If it turned out to be a problem of Go 1.8 then you can report the problem to Go team.

It seems that this is not FZF related problem, but Go 1.8 . Running go get github.com/mattn/go-isatty throws the same error. It turns out that some people are running the same AntiVirus that I am running now -> Cylance

https://github.com/golang/go/issues/18171

I see, thanks for the update. Looks like there's not much I can do at the moment. I don't want to rebuild the binaries using Go 1.7 since I noticed that fzf binary built with Go 1.8 is roughly 5~7% faster than the one built with 1.7.

Thanks for troubleshooting @junegunn. I am reverting back to Go 1.7 until I figure out how to by pass the Cylance AV. Will post the update once I have the solution

Yeah, thank you @junegunn for taking the time to troubleshoot. I really appreciate your help and LOVE a TON of your projects :), Keep up the good work.

@alotofnoodles Cylance blows. I have it for work too :p

So I managed to solve this problem by asking the IT support (Cylance is centrally controlled) to change the Cylance policy to (MAC - BG).

@hahuang65 It's time to buy coffees for the support guys ☕️

Thanks for the info, glad to hear that you sorted it out. I updated the title so that it's easier to find for the users who run into the same issue.

@alotofnoodles can you provide more details what policy had to get changed? I am running into a similar issue

@udangel-r7, our support team changed the policy to (MAC - BG). Hope this helps.

cylance_causes__fatal_error__runtime__bsdthread_register_error__ _issue__849_ _junegunn_fzf

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrisamow picture chrisamow  ·  3Comments

firedev picture firedev  ·  3Comments

lbeier picture lbeier  ·  3Comments

skamsie picture skamsie  ·  3Comments

jberglinds picture jberglinds  ·  3Comments