golifx
golifx copied to clipboard
closed channel
panic: close of closed channel
goroutine 424 [running]:
github.com/pdf/golifx/protocol/v2/device.(*Device).delSeq(0xc420164120, 0xc42016e008)
/Users/adam/Scripts/go/src/github.com/pdf/golifx/protocol/v2/device/device.go:827 +0xa2
github.com/pdf/golifx/protocol/v2/device.(*Device).handler.func1(0xc420164120, 0xc4202b8020, 0xc420145000, 0x8)
/Users/adam/Scripts/go/src/github.com/pdf/golifx/protocol/v2/device/device.go:787 +0x1f0
created by github.com/pdf/golifx/protocol/v2/device.(*Device).handler
/Users/adam/Scripts/go/src/github.com/pdf/golifx/protocol/v2/device/device.go:768 +0x368
exit status 2
also:
panic: send on closed channel
goroutine 453 [running]:
github.com/pdf/golifx/protocol/v2/device.(*Device).handler.func1(0xc420114120, 0xc420241100, 0xc4202822e0, 0x8)
/Users/adam/Scripts/go/src/github.com/pdf/golifx/protocol/v2/device/device.go:776 +0x166
created by github.com/pdf/golifx/protocol/v2/device.(*Device).handler
/Users/adam/Scripts/go/src/github.com/pdf/golifx/protocol/v2/device/device.go:768 +0x368
exit status 2
planning on looking at these myself, creating an issue to remember.
reproduce code is very simple:
func main() {
client, err := golifx.NewClient(&protocol.V2{Reliable: true, Port: 56700})
if err != nil {
panic(err)
}
logger := log.New()
logger.Level = log.InfoLevel
golifx.SetLogger(logger)
client.SetDiscoveryInterval(time.Second * 10)
sig := make(chan os.Signal, 1)
signal.Notify(sig, os.Interrupt, syscall.SIGTERM)
<-sig
}
time="2018-02-15T21:01:57-05:00" level=debug msg="[golifx] Processing packet from 10.0.8.51: source 552371782, type 107, sequence 83, target 6374332658640, tagged false, resRequired true, ackRequired false"
time="2018-02-15T21:01:57-05:00" level=debug msg="[golifx] Returning packet to device 6374332658640"
time="2018-02-15T21:01:57-05:00" level=debug msg="[golifx] Processing packet from 10.0.8.51: source 552371782, type 45, sequence 83, target 6374332658640, tagged false, resRequired true, ackRequired false"
time="2018-02-15T21:01:57-05:00" level=debug msg="[golifx] Returning packet to device 6374332658640"
time="2018-02-15T21:01:57-05:00" level=debug msg="[golifx] Handling packet on device 6374332658640"
time="2018-02-15T21:01:57-05:00" level=debug msg="[golifx] Returning seq 83 to caller on device 6374332658640"
time="2018-02-15T21:01:57-05:00" level=debug msg="[golifx] Handling packet on device 6374332658640"
time="2018-02-15T21:01:57-05:00" level=debug msg="[golifx] Returning seq 83 to caller on device 6374332658640"
panic: send on closed channel
goroutine 5060 [running]:
github.com/AdamJacobMuller/golifx/protocol/v2/device.(*Device).handler.func1(0xc42015c120, 0xc4202191c0, 0xc4202f0e80, 0x53)
/Users/adam/Scripts/go/src/github.com/AdamJacobMuller/golifx/protocol/v2/device/device.go:776 +0x166
created by github.com/AdamJacobMuller/golifx/protocol/v2/device.(*Device).handler
/Users/adam/Scripts/go/src/github.com/AdamJacobMuller/golifx/protocol/v2/device/device.go:768 +0x368
exit status 2
this does not happen with GOMAXPROCS=1 (and disabling https://github.com/pdf/golifx/blob/master/cmd/lifx/lifx.go#L66)
Makes sense @AdamJacobMuller I'll try and find some time tomorrow to take a look. This was some of the earliest Go code I wrote, I'd really love to rewrite it at some stage.
@pdf i think i know what's causing it (I think I've added about 200 logs to the code by now), not terribly urgent for you to take a look, commenting here to keep notes for myself more than to poke you/anyone.