Skip to content

fix: sysctl update from system path#3948

Open
kapishupadhyay22 wants to merge 7 commits intomainfrom
sysctl-path-fix
Open

fix: sysctl update from system path#3948
kapishupadhyay22 wants to merge 7 commits intomainfrom
sysctl-path-fix

Conversation

@kapishupadhyay22
Copy link
Copy Markdown
Member

@kapishupadhyay22 kapishupadhyay22 commented Mar 20, 2026

Describe the changes that are made

This pull request introduces changes to the Setup method in pkg/platform/http/agent.go to improve how the perf_event_paranoid kernel parameter is managed on Linux systems. The update adds logic to check the current value before attempting to set it, ensuring unnecessary writes are avoided, and provides more detailed logging for debugging and observability.

Key improvements to Linux kernel parameter management:

  • The code now reads the current value of /proc/sys/kernel/perf_event_paranoid and only attempts to update it if necessary, avoiding redundant writes and providing debug output about the current state.
  • Additional debug and informational log messages (and temporary fmt.Println statements) have been added to help trace the execution flow, especially in Docker Compose scenarios. [1] [2]

Links & References

Closes: https://github.com/keploy/enterprise/issues/1774

What type of PR is this? (check all applicable)

  • 📦 Chore
  • 🍕 Feature
  • 🐞 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🔁 CI
  • ⏩ Revert

Added e2e test pipeline?

  • 👍 yes
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help

Added comments for hard-to-understand areas?

  • 👍 yes
  • 🙅 no, because the code is self-explanatory

Added to documentation?

  • 📜 README.md
  • 📓 Wiki
  • 🙅 no documentation needed

Are there any sample code or steps to test the changes?

  • 👍 yes, mentioned below
  • 🙅 no, because it is not needed

Self Review done?

  • ✅ yes
  • ❌ no, because I need help

Any relevant screenshots, recordings or logs?

  • NA

🧠 Semantics for PR Title & Branch Name

Please ensure your PR title and branch name follow the Keploy semantics:

📌 PR Semantics Guide
📌 Branch Semantics Guide

Examples:

  • PR Title: fix: patch MongoDB document update bug
  • Branch Name: feat/#1-login-flow (You may skip mentioning the issue number in the branch name if the change is small and the PR description clearly explains it.)

Additional checklist:

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Linux perf_event_paranoid handling during AgentClient.Setup for Docker/Docker Compose flows, switching from an unconditional sysctl -w call to reading /proc/sys/kernel/perf_event_paranoid first and only writing when a relaxation is needed.

Changes:

  • Read /proc/sys/kernel/perf_event_paranoid and skip updates when it’s already sufficiently relaxed.
  • Write 2\n directly to the procfs sysctl path instead of invoking the sysctl binary.
  • Add debug/info/error logging around the sysctl state and update attempt.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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