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

Fix oomparser regex for kernels 5.0 and higher #2817

Merged
merged 1 commit into from
Mar 2, 2021

Conversation

kgtw
Copy link
Contributor

@kgtw kgtw commented Mar 1, 2021

#2418 introduced new regex for 5.0 kernels and higher, the regex had a typo and wasn't resolving the correct container names.

Fixes: #2813

…ntroduced in google#2418

Signed-off-by: Kris Gambirazzi <kris.gambirazzi@transferwise.com>
@google-cla
Copy link

google-cla bot commented Mar 1, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@k8s-ci-robot
Copy link
Collaborator

Hi @kgtw. Thanks for your PR.

I'm waiting for a google member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@kgtw
Copy link
Contributor Author

kgtw commented Mar 1, 2021

@googlebot I signed it!

@google-cla google-cla bot added cla: yes and removed cla: no labels Mar 1, 2021
@iwankgb
Copy link
Collaborator

iwankgb commented Mar 1, 2021

@kgtw would you be able to provide a unit test to save us from regression?

@kgtw
Copy link
Contributor Author

kgtw commented Mar 1, 2021

Hi @iwankgb - Thanks for the speedy review!

I believe the updated unit-test on L84 should cover regressions, it was previously validating the bad regex.

@iwankgb
Copy link
Collaborator

iwankgb commented Mar 1, 2021

@kgtw will the regexp work for pre-5.0 messages too?

@kgtw
Copy link
Contributor Author

kgtw commented Mar 1, 2021

The regex being changed is only for >=5.0 kernels.

OOM messages on kernels lower than 5.0 have a different format and are handled by a different regex pattern and the legacy test cases L33-L59

The existing functionality of getContainerName() has not changed, where it will try to parse the 5.0 regex, failing that it will fallback to legacy parsing.

func getContainerName(line string, currentOomInstance *OomInstance) (bool, error) {
parsedLine := containerRegexp.FindStringSubmatch(line)
if parsedLine == nil {
// Fall back to the legacy format if it isn't found here.
return false, getLegacyContainerName(line, currentOomInstance)
}
currentOomInstance.ContainerName = parsedLine[6]
currentOomInstance.VictimContainerName = parsedLine[5]
currentOomInstance.Constraint = parsedLine[1]
pid, err := strconv.Atoi(parsedLine[8])
if err != nil {
return false, err
}
currentOomInstance.Pid = pid
currentOomInstance.ProcessName = parsedLine[7]
return true, nil
}

Copy link
Collaborator

@iwankgb iwankgb left a comment

Choose a reason for hiding this comment

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

Thank you, sir!
@bobbypage you are still the only person that has power to LGTM it.

@iwankgb
Copy link
Collaborator

iwankgb commented Mar 2, 2021

/ok-to-test

@bobbypage
Copy link
Collaborator

thanks!

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.

OOM parsing incorrectly on 5.0 kernels and higher
4 participants