afex / hystrix-go

Netflix's Hystrix latency and fault tolerance library, for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Race condition closing errCh

brildum opened this issue · comments

There is currently a race condition caused by closing the chan error returned by hystrix.Go. Despite hystrix.Go having no errors, receives on the error channel can succeed, hiding receives on output channels.

Below is a simple example to illustrate:

out := make(chan bool, 1)
errs := hystrix.Go("command", func() error {
  out <- true
  return nil
}, nil)
select {
case x := <-out:
  // this sometimes won't execute
case err := <-errs:
  // this can execute, despite there being no errors
}