peer: ensure the peer has been started before Disconnect can be called

In this commit, we make sure that all the `wg.Add(1)` calls succeed
before we attempt to wait on the shutdown of all the goroutines. Under
rare scheduling scenarios, if both `Start` and `Disconnect` are called
concurrently, then this internal race error can be hit, causing the
panic to occur.

Fixes https://github.com/lightningnetwork/lnd/issues/7853
This commit is contained in:
Olaoluwa Osuntokun
2023-07-25 11:14:41 -07:00
parent 798821db17
commit 325e844a96
2 changed files with 30 additions and 2 deletions

View File

@@ -194,6 +194,10 @@ unlock or create.
Tor](https://github.com/lightningnetwork/lnd/pull/7783), even when
`tor.skip-proxy-for-clearnet-targets=true` was set.
* Fix a [concurrency issue related to rapid peer teardown and
creation](https://github.com/lightningnetwork/lnd/pull/7856) that can arise
under rare scenarios.
### Tooling and documentation
* Add support for [custom `RPCHOST` and
@@ -226,6 +230,7 @@ unlock or create.
* Maxwell Sayles
* Michael Street
* MG-ng
* Olaoluwa Osuntokun
* Oliver Gugger
* Pierre Beugnet
* Satarupa Deb