hashicorp / hashicorp/serf

closing eventCh after shutdown panics

Open
#462 1 comment 0 reactions 0 assignees View on GitHub
bug crash
Dominant language
Go
Stars
6.1k
Forks
609
Avg merge
15h 1m
Merged PRs (30d)
3

Description

I'm doing something like:
```
config := serf.DefaultConfig()
config.Init()
eventCh := make(chan serf.Event, 16)
config.EventCh = eventCh
```
...
then when I shutdown I do:

```
s.Leave()
s.Shutdown()
<-s.ShutdownCh()
close(eventCh)
```

But I get a panic:
```
panic: send on closed channel

goroutine 52 [running]:
swarm/vendor/github.com/hashicorp/serf/serf.(*serfQueries).stream(0xc4204b8150)
/home/predmond/src/swarm/go/src/swarm/vendor/github.com/hashicorp/serf/serf/internal_query.go:87 +0x15a
created by swarm/vendor/github.com/hashicorp/serf/serf.newSerfQueries
/home/predmond/src/swarm/go/src/swarm/vendor/github.com/hashicorp/serf/serf/internal_query.go:73 +0xfb
```

I've tested with my vendor directory up-to-date. As far as I know it's my responsibility to close the event channel and doing it after shutdown should be safe..

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.