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 goroutine memory leak #383

Open
xuxiaofan1203 opened this issue Apr 3, 2024 · 1 comment
Open

[Bug]:A goroutine memory leak #383

xuxiaofan1203 opened this issue Apr 3, 2024 · 1 comment

Comments

@xuxiaofan1203
Copy link

xuxiaofan1203 commented Apr 3, 2024

Hello @guelfey, the dbus is very useful, but I found a potential bug when I used it.
blocking position:

dbus/conn.go

Line 302 in 7623695

<-conn.ctx.Done()

In the test function TestSessionBus, after using the newConn, there is no newConn.Close() to awaken the <-conn.ctx.Done(). So the goroutine will block at the <-conn.ctx.Done(). We can call newConn.Close() to fix the bug probably.

dbus/conn_test.go

Lines 26 to 32 in 7623695

newConn, err := SessionBus()
if err != nil {
t.Error(err)
}
if newConn == oldConn {
t.Fatal("Should get a new connection")
}

you could reproduce the bug using goleak in the func TestSessionBus like this
6f82919286a79ef9691b9fbd1efada8
a82c656440b461363e6c0f637d69b18

@xuxiaofan1203 xuxiaofan1203 changed the title A goroutine memory leak [Bug]:A goroutine memory leak Apr 28, 2024
@Lzyyyds6
Copy link

Yes, I found the bug too. The newConn should be closed to awaken the ctx.Done().

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

2 participants