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

ovs: fix memory leak in qos #2871

Merged
merged 1 commit into from
May 29, 2023
Merged

Conversation

zhangzujian
Copy link
Member

@zhangzujian zhangzujian commented May 26, 2023

What type of this PR

  • Bug fixes

Which issue(s) this PR fixes:

Fixes #(issue-number)

WHAT

🤖 Generated by Copilot at de46bd6

This pull request fixes a memory leak in ovs.SetNetemQos and simplifies the pod creation and deletion in the qos package. It improves the performance and readability of the code in pkg/daemon/ovs_linux.go and test/e2e/kube-ovn/qos/qos.go.

🤖 Generated by Copilot at de46bd6

SetNetemQos leaks
Fix by moving to the end
Winter of bug hunt

HOW

🤖 Generated by Copilot at de46bd6

  • Avoid memory leak in ovs function netem_install__ by setting netem QoS after configuring the nic in the daemon package (link,link)
  • Simplify test setup by removing unused variables and using a single podName variable for pod creation in the qos package (link,link,link,link,link)
  • Optimize test code by removing redundant pod deletion since the ginkgo.AfterEach block already deletes the pod with the podName variable in the qos package (link,link,link)

@zhangzujian zhangzujian added bug Something isn't working need backport labels May 26, 2023
@github-actions
Copy link
Contributor

  • The code patch removes the call to ovs.SetNetemQos() before configuring the container NIC. This could potentially cause issues with memory leaks in the netem_install__() function of OVS. It is recommended to keep the call to ovs.SetNetemQos() before configuring the container NIC.
  • The comment added to explain why ovs.SetNetemQos() is called after configuring the container NIC is not clear and may lead to confusion for future developers. It is recommended to rephrase the comment to make it more understandable.
  • In the test file, the variable subnetName is declared but never used. It is recommended to remove this variable declaration to avoid confusion.
  • In the test file, the pod name is generated using framework.RandomSuffix(). This can potentially cause issues with identifying pods during testing. It is recommended to use a more descriptive name for the pod.
  • In the test file, the deletion of the pod is done in the AfterEach() function. However, the deletion of the pod should be done in the BeforeEach() function to ensure that the pod is deleted before creating a new one.

@github-actions
Copy link
Contributor

  • The Dockerfile.base patch adds a fix for a memory leak in qos. This is an important fix and should be prioritized for merging.
  • The qos.go test file has some formatting issues, such as inconsistent spacing and unnecessary comments. These should be cleaned up to improve readability.
  • In the qos.go test file, there are several instances where pod names are generated using framework.RandomSuffix(). It would be better to use a more descriptive name to make it easier to identify which pods are being referred to in the test.
  • The qos.go test file has a few instances where a pod is created without QoS annotations, but the pod is not deleted until after the QoS annotations have been added and validated. This could potentially cause issues if the pod is reused in subsequent tests.
  • The qos.go test file has a comment indicating that support for netem QoS was introduced in v1.9, but there is no corresponding comment for when support for htb QoS with priority was introduced. It would be helpful to add this information for clarity.

@zhangzujian zhangzujian changed the title cni-server: set netem QoS at the last to avoid memory leak in ovs function netem_install__() ovs: fix memory leak in netem qos May 26, 2023
@zhangzujian zhangzujian changed the title ovs: fix memory leak in netem qos ovs: fix memory leak in qos May 26, 2023
@github-actions
Copy link
Contributor

  • The Dockerfile.base patch adds a fix for a memory leak in qos. This is an important fix that should be included.
  • The qos.go file has some formatting issues, such as inconsistent spacing and indentation. These should be fixed to improve readability.
  • In the qos.go file, there are several instances where pod names are generated using "RandomSuffix". It would be better to use a more descriptive name to make it easier to identify pods in logs and debugging.
  • The qos.go file has some duplicated code for creating and deleting pods. This could be refactored into a helper function to reduce code duplication and improve maintainability.
  • The qos.go file has some comments that are not very informative, such as "Creating pod" or "Deleting pod". These comments should be improved to provide more context and information about what is happening.

@github-actions
Copy link
Contributor

  • Increase timeout-minutes to 20 in build-x86-image.yaml to avoid potential build failures due to longer build times.
  • Remove unused subnetClient and subnetName variables in qos.go.
  • Refactor the code in qos.go to remove duplicate code for creating and deleting pods.
  • Add a comment in Dockerfile.base explaining the purpose of the newly added patch for fixing memory leaks in qos.
  • Consider adding more detailed comments in qos.go to explain the purpose of each test case.

@zhangzujian zhangzujian marked this pull request as ready for review May 26, 2023 10:59
@zhangzujian zhangzujian requested a review from oilbeater May 26, 2023 10:59
@zhangzujian zhangzujian merged commit 7c80a13 into kubeovn:master May 29, 2023
@zhangzujian zhangzujian deleted the fix-memleak branch May 29, 2023 01:35
zhangzujian added a commit to zhangzujian/kube-ovn that referenced this pull request May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need backport
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants