Avoid connection leak in tree pool with netmap support #331
No reviewers
Labels
No labels
P0
P1
P2
P3
good first issue
pool
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-sdk-go#331
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "alexvanin/frostfs-sdk-go:fix/tree-pool-connection-leak"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
To avoid connection leak, call
close()
immediately after failed connection is established. In regular tree pool, unhealthy connections are handled by background goroutine which callsredialIfNecessary()
to reestablish connection. Here it is not viable so connection must be close.Kudos to @dstepanov-yadro for pointing out this code.
70fbc5ae27
to4ecbfb0edf
@ -0,0 +227,4 @@
routinesBefore := runtime.NumGoroutine()
for i := 0; i < 1000; i++ {
_, err = treePool.AddNode(context.Background(), AddNodeParams{CID: cnr})
require.NoError(t, err)
I will appreciate any other way to check the leak. I had no better idea than checking number of routines directly. gRPC server does not provide any useful data about connections as far as I understand.
https://github.com/uber-go/goleak
But I don't think we are going to introduce a new import. I'd use the same idea like you with
runtime
:)WIP: Avoid connection leak in tree pool with netmap supportto Avoid connection leak in tree pool with netmap support@ -0,0 +42,4 @@
ni := apinetmap.NodeInfo{}
ni.SetAddresses(server.lis.Addr().String())
ni.SetPublicKey(server.key.PublicKey().Bytes())
err := nodes[i].ReadFromV2(ni) // no other way to set address field in netmap.NodeInfo
Let me know if there any
👍
New commits pushed, approval review dismissed automatically according to repository settings
New commits pushed, approval review dismissed automatically according to repository settings
New commits pushed, approval review dismissed automatically according to repository settings
New commits pushed, approval review dismissed automatically according to repository settings
Fixed
for
loop insortServers
in the test.Merging based on previously approved review.