goczmq icon indicating copy to clipboard operation
goczmq copied to clipboard

Channeler sometimes panics while handling destroy command

Open twavv opened this issue 3 years ago • 1 comments

This seems to happen when cleaning up tests.

Context: In my test, I have a defer c.Destroy() where c is a Channeler. This seems to occasionally (maybe ~10% of the time) cause the channeler goroutine to panic while trying to pipe.RecvMessage:

panic: recv frame error

goroutine 34 [running]:
github.com/zeromq/goczmq.(*Channeler).channeler(0xc00022e0c0, 0xc0002203c0, 0xc000220420)
        /Users/travigd/Mynerva/kernel-sidecar-go/vendor/github.com/zeromq/goczmq/channeler.go:177 +0x5ac
created by github.com/zeromq/goczmq.newChanneler
        /Users/travigd/Mynerva/kernel-sidecar-go/vendor/github.com/zeromq/goczmq/channeler.go:231 +0x276
// channeler.go
// snip
			case "destroy":
				err = pipe.SendFrame([]byte("destroy"), FlagNone)
				if err != nil {
					panic(err)
				}
				_, err = pipe.RecvMessage()
				if err != nil {
					panic(err)
                                     // ^^^^^^^^^^ this is the bit that panics
				}
				goto ExitChanneler
// snip

My guess was that something about the timing (trying to handle it during the test cleanup) causes it to panic, but I added a time.Sleep for one second after the destroy and it doesn't seem to fix it.

twavv avatar Mar 30 '21 19:03 twavv

This might be fixed now - I was using 4.1. (related: #279)

twavv avatar Mar 30 '21 19:03 twavv