goflow2 icon indicating copy to clipboard operation
goflow2 copied to clipboard

utils.go udpDataCh: panic: send on closed channel

Open AlexandreYang opened this issue 3 years ago • 2 comments

Hi 👋,

I just encountered this error.

panic: send on closed channel

goroutine 405 [running]:
github.com/netsampler/goflow2/utils.UDPStoppableRoutine.func1()
	go/pkg/mod/github.com/netsampler/[email protected]/utils/utils.go:171 +0x9a
created by github.com/netsampler/goflow2/utils.UDPStoppableRoutine
	go/pkg/mod/github.com/netsampler/[email protected]/utils/utils.go:164 +0x952

It seems that udpDataCh might be closed here https://github.com/netsampler/goflow2/blob/main/utils/utils.go#L184

But data will still be pushed to it from here https://github.com/netsampler/goflow2/blob/main/utils/utils.go#L171

AlexandreYang avatar Aug 04 '22 15:08 AlexandreYang

Hello, Thank you for the report. Could you give more information? How did it trigger? I believe it appears also during some testing. It's not the first time since #40 :/ Are you able to PR?

lspgn avatar Aug 05 '22 14:08 lspgn

Thank you for the report. Could you give more information? How did it trigger?

It triggered after sending a very high volume of NetFlow traffic to goflow2 and then stopping the goflow listeners.

It was indeed during some testing with high volume of NetFlow data, but seems something that could happen in production case too.

Are you able to PR?

Yes, let me see what I can do.

AlexandreYang avatar Aug 05 '22 14:08 AlexandreYang