From 66c291973314ef13bb038a4e6806fe9d3a525bb2 Mon Sep 17 00:00:00 2001 From: Rifay R Date: Thu, 7 Aug 2025 13:11:32 +0000 Subject: [PATCH 1/2] RDKB-60778 : logging/event, when FD have exceeded Reason for change: t2 event when FD count increases above 1024 Test Procedure: - Risks: Medium Signed-off-by: Mohamed Rifayudeen R --- scripts/task_health_monitor.sh | 51 ++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/scripts/task_health_monitor.sh b/scripts/task_health_monitor.sh index ac2e3f6..c0ffa50 100644 --- a/scripts/task_health_monitor.sh +++ b/scripts/task_health_monitor.sh @@ -4841,6 +4841,54 @@ print_hcm_process_stats() { echo_t "HCM_PROCESS_STATS: $CPU_RM_KB,$RSS_RM_KB,$VMSize_RM_KB" } +# Check file descriptor usage for processes +check_fd_limit() { + local pname=$1 + local fd_limit=$2 + local pids=$(pidof $pname) + + for pid in $pids; do + if [ -n "$pid" ]; then + local fd_count=$(ls /proc/$pid/fd 2>/dev/null | wc -l) + if [ "$fd_count" -gt "$fd_limit" ]; then + echo_t "MESH: $pname (PID $pid) has exceeded $fd_limit file descriptors (current: $fd_count)" + #or use t2 event + t2ValNotify "TELEMETRY_FD_EXCEEDED" "$pname $pid $fd_count" + fi + fi + done +} + +monitor_mesh_process_fd_limits() { + local fd_limit=1024 # Set your warning threshold here + + # Array of processes to check file descriptors + MONITOR_PROCESSES=( + MeshWifiOptimizer + meshAgent + ovs-vswitchd + OneWifi + ovsdb-server + OvsAgent + pl2rld # OpenSync processes + dm + bm + cm + rdkm + nm + lm + sm + ovsm + qm + ts + ) + + for proc in "${MONITOR_PROCESSES[@]}"; do + check_fd_limit $proc $fd_limit + done +} + + hcm_handle_recovery() { if [ ! -f "/proc/$hcm_mwo_pid/status" ] && [ -f "/proc/$hcm_mqtt_pid/status" ] then @@ -5098,5 +5146,8 @@ if [ "$brlan1_count" -gt 200 ]; then done fi +# Monitors the file descriptor limits of mesh processes +monitor_mesh_process_fd_limits + # Clean up the temporary file rm -f /tmp/check_promsc_mode.txt From af29b7bdad0706d6e5adfc2693f8ec70b52ab022 Mon Sep 17 00:00:00 2001 From: Rifay R Date: Mon, 11 Aug 2025 07:59:14 +0000 Subject: [PATCH 2/2] RDKB-60778 : logging/event, when FD have exceeded Reason for change: t2 event when FD count increases above 1024 Test Procedure: - Risks: Medium Signed-off-by: Mohamed Rifayudeen R --- scripts/task_health_monitor.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/task_health_monitor.sh b/scripts/task_health_monitor.sh index c0ffa50..f93d59c 100644 --- a/scripts/task_health_monitor.sh +++ b/scripts/task_health_monitor.sh @@ -4860,7 +4860,7 @@ check_fd_limit() { } monitor_mesh_process_fd_limits() { - local fd_limit=1024 # Set your warning threshold here + local fd_limit=819 # 80% of 1024 = 819 # Array of processes to check file descriptors MONITOR_PROCESSES=(