A potential goleak in cluster.go #47859
Labels
area/networking
kind/bug
Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed.
status/0-triage
version/master
Description
Hello, I found in the function clusterLeave()
moby/libnetwork/networkdb/cluster.go
Line 222 in ceefb7d
If the mlist.Leave() return err, the nDB.cancelCtx() below will not get executed.
moby/libnetwork/networkdb/cluster.go
Lines 229 to 234 in ceefb7d
And it will lead the <-nDB.ctx.Done in triggerFunc() blocked persistently, so the goroutine leak.
moby/libnetwork/networkdb/cluster.go
Line 176 in ceefb7d
blocking position:
moby/libnetwork/networkdb/cluster.go
Lines 251 to 258 in ceefb7d
Reproduce
I reproduce the bug by goleak.
Firstly, I modified the judge condition from err != nil to err == nil. Because I don't know how to let err != nil, the change only to make the return err can be executed easier. I'm not sure whether the change can lead other influences.
Normally:
After modified:
Then I used goleak to test in these test function related the funciton.
moby/libnetwork/networkdb/networkdb_test.go
Line 180 in ceefb7d
Like this:
The result shows that there is a bug at the <-nDB.ctx.Done
Expected behavior
No response
docker version
docker info
Additional Info
In short, I think the bug is caused by return but have not called the cancelFunc. I have tried to describe it in detail.
The text was updated successfully, but these errors were encountered: