Skip to content

[Bug]:A goroutine memory leak #383

Open
@xuxiaofan1203

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions