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

feat(cli): Use SIGUSR2 to run sysctl commands #949

Merged
merged 1 commit into from
Feb 14, 2024
Merged

Conversation

msbrogli
Copy link
Member

@msbrogli msbrogli commented Feb 9, 2024

Motivation

Sometimes the CPU is so high that sysctl become irresponsive. So this PR adds another method to send command to sysctl.

Acceptance Criteria

  1. Handle SIGUSR2 on cli run_node.
  2. Create a named pipe to receive a list of sysctl commands, one per line.
  3. Execute the sysctl commands and log their results.
  4. The named pipe will be created at the data directory if it exists. Otherwise, a temporary folder will be created.
  5. Add decorator @signal_handler_safe to mark setters as safe to be executed during a signal handling.
  6. Add require_signal_handler_safe: bool = False to the SysctlRunner.run() method.
  7. Rename _get_getter() and _set_setter() to get_getter() and set_setter() on Sysctl.
  8. Rename set() to unsafe_set() on Sysctl. It also updates the docstring to explain that it is unsafe to call this method directly.
  9. Mark max_enabled_sync, enabled_sync_versions and kill_connection as signal handler safe on ConnectionsManagerSysctl.

Checklist

  • If you are requesting a merge into master, confirm this code is production-ready and can be included in future releases as soon as it gets merged

@msbrogli msbrogli self-assigned this Feb 9, 2024
@msbrogli msbrogli requested a review from jansegre as a code owner February 9, 2024 18:07
@msbrogli msbrogli force-pushed the feat/sigusr2-sysctl branch 2 times, most recently from 41b456d to 5d646e4 Compare February 9, 2024 18:16
Copy link

codecov bot commented Feb 9, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (f4d6a28) 85.34% compared to head (565377f) 85.26%.

Files Patch % Lines
hathor/sysctl/runner.py 75.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #949      +/-   ##
==========================================
- Coverage   85.34%   85.26%   -0.08%     
==========================================
  Files         291      291              
  Lines       22540    22553      +13     
  Branches     3393     3399       +6     
==========================================
- Hits        19236    19230       -6     
- Misses       2630     2643      +13     
- Partials      674      680       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

jansegre
jansegre previously approved these changes Feb 9, 2024
hathor/cli/run_node.py Outdated Show resolved Hide resolved
hathor/cli/run_node.py Show resolved Hide resolved
hathor/cli/run_node.py Outdated Show resolved Hide resolved
@msbrogli msbrogli force-pushed the feat/sigusr2-sysctl branch 9 times, most recently from 34b120d to 565377f Compare February 10, 2024 00:15
@msbrogli msbrogli force-pushed the feat/sigusr2-sysctl branch from 565377f to b33f03e Compare February 14, 2024 22:43
@msbrogli msbrogli merged commit b33f03e into master Feb 14, 2024
1 check passed
@msbrogli msbrogli deleted the feat/sigusr2-sysctl branch February 14, 2024 22:44
@jansegre jansegre mentioned this pull request Feb 15, 2024
2 tasks
@jansegre jansegre mentioned this pull request Feb 26, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants