Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

closed channel #15

Open
adamjacobmuller opened this issue Feb 15, 2018 · 4 comments
Open

closed channel #15

adamjacobmuller opened this issue Feb 15, 2018 · 4 comments

Comments

@adamjacobmuller
Copy link

adamjacobmuller commented Feb 15, 2018

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
}
@adamjacobmuller
Copy link
Author

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

@adamjacobmuller
Copy link
Author

this does not happen with GOMAXPROCS=1 (and disabling https://github.com/pdf/golifx/blob/master/cmd/lifx/lifx.go#L66)

@pdf
Copy link
Owner

pdf commented Feb 17, 2018

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.

@adamjacobmuller
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants