brutella / hc

hc is a lightweight framework to develop HomeKit accessories in Go.
Apache License 2.0
1.74k stars 189 forks source link

Panic on Go 1.9 with net/ipv4 reflect #89

Closed tomtaylor closed 7 years ago

tomtaylor commented 7 years ago

On Go 1.9, I'm getting a panic when starting the Homekit server like so:

config := hc.Config{Pin: "12345678"}
transport, err := hc.NewIPTransport(config, acc.Accessory)
panic: reflect: call of reflect.Value.Int on zero Value

goroutine 10 [running]:
reflect.Value.Int(0x0, 0x0, 0x0, 0x31515f, 0x5)
    /usr/local/Cellar/go/1.9/libexec/src/reflect/value.go:908 +0x12c
golang.org/x/net/ipv4.sysfd(0x484fe8, 0x1270d2c8, 0x1270d2c8, 0x484fe8, 0x1270d2c8)
    /Users/tom/workspace/go/src/golang.org/x/net/ipv4/helper_unix.go:46 +0x144
golang.org/x/net/ipv4.(*dgramOpt).sysfd(0x12751708, 0x0, 0x0, 0x3)
    /Users/tom/workspace/go/src/golang.org/x/net/ipv4/helper_unix.go:25 +0x68
golang.org/x/net/ipv4.(*dgramOpt).JoinGroup(0x12751708, 0x12740d28, 0x482380, 0x12740ce0, 0x0, 0x0)
    /Users/tom/workspace/go/src/golang.org/x/net/ipv4/dgramopt_posix.go:109 +0x3c
github.com/oleksandr/bonjour.newServer(0x0, 0x10, 0x10, 0x1271b37c)
    /Users/tom/workspace/go/src/github.com/oleksandr/bonjour/server.go:195 +0x404
github.com/oleksandr/bonjour.RegisterProxy(0x31685a, 0xa, 0x316904, 0xa, 0x0, 0x0, 0xa505, 0x1271b320, 0xc, 0x1271ab00, ...)
    /Users/tom/workspace/go/src/github.com/oleksandr/bonjour/server.go:142 +0x2d0
github.com/brutella/hc.(*MDNSService).Publish(0x1270d288, 0x1270d288, 0xa505)
    /Users/tom/workspace/go/src/github.com/brutella/hc/mdns.go:44 +0x198
github.com/brutella/hc.(*ipTransport).Start(0x12780140)
    /Users/tom/workspace/go/src/github.com/brutella/hc/ip_transport.go:134 +0x160
main.(*HomeKitService).RunLoop(0x1287c1c0)
    /Users/tom/workspace/go/src/github.com/tomtaylor/heating/thermostat/homekit.go:84 +0x50
created by main.main
    /Users/tom/workspace/go/src/github.com/tomtaylor/heating/thermostat/main.go:61 +0x4c8

Any idea? Seems to happen when I use the zeroconf fork too.

ruudk commented 7 years ago

Same issue here.

ruudk commented 7 years ago

Found out that I had an old $GOPATH/src/golang.org/x/net installation. I removed that directory and tried to go get golang.org/x/net it again and it worked :)

tomtaylor commented 7 years ago

Hurrah! That worked for me. Thank you!