gomq icon indicating copy to clipboard operation
gomq copied to clipboard

Socket.recv() panics when tcp read timeout

Open myzhan opened this issue 6 years ago • 0 comments

boomer is using gomq to pull message from master like this.

Sometimes I got a panic(index out of range) from inside gomq, generated by this line.

Then I print out msg.Err, it's read tcp i/o timeout.

func (s *Socket) Recv() ([]byte, error) {
	msg := <-s.recvChannel
	if msg.MessageType == zmtp.CommandMessage {
	}
	if msg.Err != nil {
		fmt.Printf("%v\n", msg.Err)
		return []byte(""), msg.Err
		// os.Exit(-1)
	}
	return msg.Body[0], msg.Err
}

myzhan avatar Nov 08 '18 11:11 myzhan