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
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.