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

Avoid scan entire sys during cpu threshold check no sysinfo upgrade #2639

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/memcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,22 @@ jobs:
run: pgrep antnode | wc -l
if: always()

- name: confirm opened FDs
shell: bash
timeout-minutes: 1
run: |
fd_cap="30"
pids=$(pgrep antnode)
for pid in $pids; do
fd_count=$(ls /proc/$pid/fd | wc -l)
echo "Process $pid - File Descriptors: $fd_count"
if (( $(echo "$fd_count > $fd_cap" | bc -l) )); then
echo "Process $pid holding FD exceeded threshold: $fd_cap"
exit 1
fi
done
if: always()

- name: Stop the local network and upload logs
if: always()
uses: maidsafe/ant-local-testnet-action@main
Expand Down
2 changes: 1 addition & 1 deletion ant-logging/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct ProcessMetrics {
// Obtains the system metrics every UPDATE_INTERVAL and logs it.
// The function should be spawned as a task and should be re-run if our main process is restarted.
pub async fn init_metrics(pid: u32) {
let mut sys = System::new_all();
let mut sys = System::new();
let mut networks = Networks::new_with_refreshed_list();
let pid = Pid::from_u32(pid);

Expand Down
3 changes: 2 additions & 1 deletion ant-networking/src/metrics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,12 @@ impl NetworkMetricsRecorder {

let pid = Pid::from_u32(std::process::id());
let process_refresh_kind = ProcessRefreshKind::everything().without_disk_usage();
let mut system = System::new_all();
let mut system = System::new();
let physical_core_count = system.physical_core_count();

tokio::spawn(async move {
loop {
system.refresh_cpu();
system.refresh_process_specifics(pid, process_refresh_kind);
if let (Some(process), Some(core_count)) =
(system.process(pid), physical_core_count)
Expand Down
2 changes: 1 addition & 1 deletion ant-node/src/bin/antnode/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ You can check your reward balance by running:
const JITTER_MIN_S: u64 = 1;
const JITTER_MAX_S: u64 = 15;

let mut sys = System::new_all();
let mut sys = System::new();

let mut high_cpu_count: u8 = 0;

Expand Down
Loading