guelfey / go.dbus

Native Go bindings for D-Bus
BSD 2-Clause "Simplified" License
124 stars 42 forks source link

conn.Close() panics #59

Open aulanov opened 9 years ago

aulanov commented 9 years ago

conn.Close() closes the transport corresponding to the connection. After that inWorker() will see EOF and will try to close the connection again. This then leads to attempt to close closed channel.

$ cat bug.go
package main

import (
        "time"

        dbus "github.com/guelfey/go.dbus"
)

func main() {
        conn, _ := dbus.SessionBusPrivate()
        conn.Auth(nil)
        conn.Hello()
        conn.RequestName("com.github.guelfey.Demo", dbus.NameFlagDoNotQueue)
        conn.Close()
        time.Sleep(1 * time.Second)
}
$ go run bug.go
panic: close of closed channel

goroutine 6 [running]:
github.com/guelfey/go%2edbus.(*Conn).Close(0x4c2080010e0, 0x0, 0x0)
        github.com/guelfey/go.dbus/conn.go:178 +0x62
github.com/guelfey/go%2edbus.(*Conn).inWorker(0x4c2080010e0)
        github.com/guelfey/go.dbus/conn.go:334 +0x10be
created by github.com/guelfey/go%2edbus.(*Conn).Auth
        github.com/guelfey/go.dbus/auth.go:120 +0xecd
bbergshaven commented 6 years ago

Any updates on including this fix @guelfey , or is the project dead?

guelfey commented 6 years ago

I won't have time to work on this in the forseeable furute, no. You can look at github.com/godbus/dbus for a maintained fork.