nsqio / go-nsq

The official Go package for NSQ
MIT License
2.59k stars 444 forks source link

panic: send closed channel - incomingMessages #325

Closed Allenxuxu closed 3 years ago

Allenxuxu commented 3 years ago

https://github.com/nsqio/go-nsq/blob/2a2babe56732d309086255f45e60617fd8683ede/consumer.go#L767

In extreme case, before it is successful, consumer has been stop. It may lead to panic. Because of

func (r *Consumer) stopHandlers() {
    r.stopHandler.Do(func() {
        r.log(LogLevelInfo, "stopping handlers")
        close(r.incomingMessages)
    })
}
mreiferson commented 3 years ago

see #326