Closed antoninbas closed 3 weeks ago
This actually supersedes https://github.com/vmware/go-ipfix/pull/277, which was never merged (because of a CLA issue?)
Attention: Patch coverage is 94.73684%
with 3 lines
in your changes missing coverage. Please review.
Project coverage is 70.37%. Comparing base (
79a2702
) to head (e474105
). Report is 3 commits behind head on main.
Files | Patch % | Lines |
---|---|---|
pkg/collector/udp.go | 92.68% | 3 Missing :warning: |
Previously, in case of a decoding error (e.g., an unknown template ID in a data set), the goroutine responsible for decoding messages would be stopped, but the client would not be deleted. This would lead to a deadlock as subsequent messages could not be written to the packetChan channel for the client, effectively breaking the UDP collecting process completely. To avoid this issue, we log an error when decoding fails, but keep the client alive. Note that for IPFIX over UDP, there is no way to notify a single UDP client of an error (with TCP, we can close the connection if we want). This is also why the template refresh mechanism exists.
We also fix possible race conditions in the UDP collecting process: all access to the clients map should be protected by locking the mutex.