Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]:A potential goleak #2681

Open
xuxiaofan1203 opened this issue Apr 6, 2024 · 0 comments
Open

[Bug]:A potential goleak #2681

xuxiaofan1203 opened this issue Apr 6, 2024 · 0 comments

Comments

@xuxiaofan1203
Copy link

xuxiaofan1203 commented Apr 6, 2024

blocking position:

case <-nDB.ctx.Done():

The nDB.cancelCtx() is in the func clusterLeave(), when return err ,the cancelFunc can't get executed and the goroutine leak.
func (nDB *NetworkDB) clusterLeave() error {
mlist := nDB.memberlist
if err := nDB.sendNodeEvent(NodeEventTypeLeave); err != nil {
logrus.Errorf("failed to send node leave: %v", err)
}
if err := mlist.Leave(time.Second); err != nil {
return err
}
// cancel the context
nDB.cancelCtx()
for _, t := range nDB.tickers {
t.Stop()
}
return mlist.Shutdown()
}

You can reproduce the bug by making program execute the path and test it by goleak
1712388819260
1712388847783

@xuxiaofan1203 xuxiaofan1203 changed the title A potential goleak when return err [Bug]:A potential goleak when return err Apr 28, 2024
@xuxiaofan1203 xuxiaofan1203 changed the title [Bug]:A potential goleak when return err [Bug]:A potential goleak when return err in libnetwork/networkdb/cluster.go May 14, 2024
@xuxiaofan1203 xuxiaofan1203 changed the title [Bug]:A potential goleak when return err in libnetwork/networkdb/cluster.go [Bug]:A potential goleak when return err May 25, 2024
@xuxiaofan1203 xuxiaofan1203 changed the title [Bug]:A potential goleak when return err [Bug]:A potential goleak May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant