lightninglabs / neutrino

Privacy-Preserving Bitcoin Light Client
MIT License
894 stars 182 forks source link

panic: close of closed channel #258

Closed nayuta-ueno closed 1 year ago

nayuta-ueno commented 1 year ago

When I started LND, it terminated with the following error This error occurred a couple of times, but not now. It was LND v0.15.1-beta, so I assume it is Neutrino v0.14.2.

E/Go: panic: close of closed channel
E/Go: 
E/Go: goroutine 1121 [running]:
E/Go: github.com/lightningnetwork/lnd/vendor/github.com/lightninglabs/neutrino.(*delayedCloser).closeNow.func1()
E/Go:   /home/xxx/src/github.com/lightningnetwork/lnd/vendor/github.com/lightninglabs/neutrino/query.go:1307 +0x28
E/Go: sync.(*Once).doSlow(0x4000501b48?, 0x1?)
E/Go:   /snap/go/9952/src/sync/once.go:68 +0x10c
E/Go: sync.(*Once).Do(...)
E/Go:   /snap/go/9952/src/sync/once.go:59
E/Go: github.com/lightningnetwork/lnd/vendor/github.com/lightninglabs/neutrino.(*delayedCloser).closeNow(0x40021f29b0?)
E/Go:   /home/xxx/src/github.com/lightningnetwork/lnd/vendor/github.com/lightninglabs/neutrino/query.go:1306 +0x4c
E/Go: github.com/lightningnetwork/lnd/vendor/github.com/lightninglabs/neutrino.(*delayedCloser).closeEventually.func1()
E/Go:   /home/xxx/src/github.com/lightningnetwork/lnd/vendor/github.com/lightninglabs/neutrino/query.go:1300 +0xac
E/Go: created by github.com/lightningnetwork/lnd/vendor/github.com/lightninglabs/neutrino.(*delayedCloser).closeEventually
E/Go:   /home/xxx/src/github.com/lightningnetwork/lnd/vendor/github.com/lightninglabs/neutrino/query.go:1293 +0x7c
guggero commented 1 year ago

Thanks for the report. I took a quick look and it seems to me that this can only happen if for some reason you have multiple Neutrino peers that resolve to the same IP address. I think we should de-duplicate the peers if that is indeed the case. But for now, can you please check what peers you start with? And is there anything in the logs prior to the crash?

nayuta-ueno commented 1 year ago

No log files are kept. If it occurs again, it will be reopened.