[#323] node: Fix tree svc panic
If a connection has not been established earlier, it stores `nil` in LRU cache. Cache eviction tries to close every connection (even a `nil` one) and panics but not crash the app because we are using pools. That ugly bug also leads to a deadlock where `Unlock` is not called via `defer` func (and that is the way I found it). Signed-off-by: Pavel Karpy <p.karpy@yadro.com>
This commit is contained in:
parent
0beb7ccf5c
commit
c60029d3b0
2 changed files with 4 additions and 1 deletions
|
@ -7,6 +7,7 @@ Changelog for FrostFS Node
|
|||
### Changed
|
||||
### Fixed
|
||||
- Copy number was not used for `PUT` requests (#284)
|
||||
- Tree service panic in its internal client cache (#323)
|
||||
|
||||
### Removed
|
||||
### Updated
|
||||
|
|
|
@ -36,7 +36,9 @@ var errRecentlyFailed = errors.New("client has recently failed")
|
|||
|
||||
func (c *clientCache) init() {
|
||||
l, _ := simplelru.NewLRU[string, cacheItem](defaultClientCacheSize, func(_ string, value cacheItem) {
|
||||
_ = value.cc.Close()
|
||||
if conn := value.cc; conn != nil {
|
||||
_ = conn.Close()
|
||||
}
|
||||
})
|
||||
c.LRU = *l
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue