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

Delete existing template if a new invalid one is received #383

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

antoninbas
Copy link
Member

This is particularly useful for UDP collection, as there is no feedback mechanism to let the sender know that the new template is invalid (while with TCP, we can close the connection). If we keep the old template and the sender sends data records which use the new template, we would try to decode them according to the old template, which would cause issues. Instead we will ignore data records for that observation domain and template ID until a new valid template is received.

This is particularly useful for UDP collection, as there is no feedback
mechanism to let the sender know that the new template is invalid (while
with TCP, we can close the connection). If we keep the old template and
the sender sends data records which use the new template, we would try
to decode them according to the old template, which would cause
issues. Instead we will ignore data records for that observation domain
and template ID until a new valid template is received.

Signed-off-by: Antonin Bas <[email protected]>
@yuntanghsu
Copy link
Contributor

yuntanghsu commented Nov 21, 2024

I think the new template will have new template_id? Then it should be good if new template has any issues?
Or it is possible that user update its old template and use the same template_id?

User should be responsible for the missing data when they provide invalid template when using UDP, right?

@antoninbas
Copy link
Member Author

Or it is possible that user update its old template and use the same template_id?

We always use the same template ID in Antrea, even when we add new fields / IEs

User should be responsible for the missing data when they provide invalid template when using UDP, right?

Yes, but they key change in this PR is to make sure we won't try to decode a "new" data record using an "old" template, which can actually cause a panic.
With UDP, when the exporter sends a template, it will assume that it was accepted and will proceed with sending data records right away. That creates issues if the template was actually rejected. I think the best course of action (assuming the same template ID was used of course, otherwise there is no issue) is to forget the old template in that case and have a clean state.

Copy link
Contributor

@yuntanghsu yuntanghsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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

Successfully merging this pull request may close these issues.

3 participants