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

Update buffer position when returning kIgnored #1760

Merged
merged 2 commits into from
Nov 6, 2023

Conversation

kpattaswamy
Copy link
Member

Summary: This PR removes the frame's contents from the buffer in the case we return kIgnored when the frame is a type (opcode) we do not parse. When running the BPF test we noticed that the program would stall when the parser encountered a frame with an opcode it does not support. This was due to to the parser returning kIgnored to ParseFramesLoop and it not moving the buffer forward before calling ParseFrame again. This change will update the buffer position before returning kIgnored to ParseFramesLoop so that the remaining frames in the buffer can be parsed.

Related issues: #640

Type of change: /kind bug

Test Plan: Modified the existing test checking for the unsupported opcode type.

…Ignored

Signed-off-by: Kartik Pattaswamy <kpattaswamy@pixielabs.ai>
@kpattaswamy kpattaswamy changed the title Clear the frame contents from the buffer in the case that we return k… Update buffer position when returning kIgnored Nov 2, 2023
Comment on lines 68 to 69
if (!(frame_type == Type::kOPMsg || frame_type == Type::kOPCompressed ||
frame_type == Type::kReserved)) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we remove Type::kReserved and Type::kOPCompressed from this if statement to avoid adding the else if branch added in this PR?

I ran the updated unit test and it seems to pass still.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will modify the comment as well

Signed-off-by: Kartik Pattaswamy <kpattaswamy@pixielabs.ai>
@kpattaswamy kpattaswamy marked this pull request as ready for review November 2, 2023 22:39
@kpattaswamy kpattaswamy requested a review from etep November 2, 2023 22:40
@aimichelle aimichelle merged commit 62b8080 into pixie-io:main Nov 6, 2023
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants