From 974073614961affbc3c0b796b650373687ec8da5 Mon Sep 17 00:00:00 2001 From: nanimatta <84963246+nanimatta@users.noreply.github.com> Date: Tue, 7 Jul 2026 10:22:50 -0400 Subject: [PATCH 1/3] RDKEMW-21013: Add boot-time timeout for DeviceInfo MAC cache in SystemServices Configure --- lib/rdk/getDeviceDetails.sh | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/lib/rdk/getDeviceDetails.sh b/lib/rdk/getDeviceDetails.sh index b7899312..0cd89304 100755 --- a/lib/rdk/getDeviceDetails.sh +++ b/lib/rdk/getDeviceDetails.sh @@ -32,6 +32,15 @@ logFile="/opt/logs/getDeviceDetails.$$.log" lockDir=/tmp/.getDeviceDetails.lock lockPidFile=/tmp/.getDeviceDetails.lock/.lockPidFile deviceDetailsCache=/tmp/.deviceDetails.cache +DETAILS_CMD_TIMEOUT=5 + +run_with_timeout() { + if command -v timeout >/dev/null 2>&1; then + timeout "$DETAILS_CMD_TIMEOUT" "$@" + else + "$@" + fi +} # to enable logging: uncomment out echo and comment out colon : logMsg() @@ -131,19 +140,22 @@ getEcmMac() getEthernetMacAddress() { - EtherMac=$(ifconfig $ETHERNET_INTERFACE | awk '/HWaddr/ {print $5}') + #EtherMac=$(ifconfig $ETHERNET_INTERFACE | awk '/HWaddr/ {print $5}') + EtherMac=$(run_with_timeout ifconfig "$ETHERNET_INTERFACE" 2>/dev/null | awk '/HWaddr/ {print $5}') } getMocaMac() { - MocaMac=$(ifconfig $MOCA_INTERFACE | awk '/HWaddr/ {print $5}') + #MocaMac=$(ifconfig $MOCA_INTERFACE | awk '/HWaddr/ {print $5}') + MocaMac=$(run_with_timeout ifconfig "$MOCA_INTERFACE" 2>/dev/null | awk '/HWaddr/ {print $5}') } getWiFiMac() { # Get the wifi mac only if WIFI_INTERFACE is defined if [ "x$WIFI_INTERFACE" != "x" ]; then - WiFiMac=$(ifconfig $WIFI_INTERFACE | awk '/HWaddr/ {print $5}') + #WiFiMac=$(ifconfig $WIFI_INTERFACE | awk '/HWaddr/ {print $5}') + WiFiMac=$(run_with_timeout ifconfig "$WIFI_INTERFACE" 2>/dev/null | awk '/HWaddr/ {print $5}') fi } @@ -217,7 +229,8 @@ getModelNum() } getManufacturer(){ - output=$(mfr_util --Manufacturer 2>&1) + #output=$(mfr_util --Manufacturer 2>&1) + output=$(run_with_timeout mfr_util --Manufacturer 2>&1) if [ -n "$output" ] && ! echo "$output" | grep -iq "failed"; then output=$(echo $output | sed 's/ /_/g') echo "$output" | tee /tmp/.manufacturer @@ -227,7 +240,8 @@ getManufacturer(){ } getBrandName(){ - output=$(mfr_util --Manufacturer 2>&1) + #output=$(mfr_util --Manufacturer 2>&1) + output=$(run_with_timeout mfr_util --Manufacturer 2>&1) if [ -n "$output" ] && ! echo "$output" | grep -iq "failed"; then echo "$output" > /tmp/.brandname fi From ff5420fd3b6b63cb7908cfc7c1041de5bf5e6b68 Mon Sep 17 00:00:00 2001 From: nanimatta <84963246+nanimatta@users.noreply.github.com> Date: Tue, 7 Jul 2026 16:30:56 -0400 Subject: [PATCH 2/3] Update getDeviceDetails.sh --- lib/rdk/getDeviceDetails.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/rdk/getDeviceDetails.sh b/lib/rdk/getDeviceDetails.sh index 0cd89304..6f9997a2 100755 --- a/lib/rdk/getDeviceDetails.sh +++ b/lib/rdk/getDeviceDetails.sh @@ -32,14 +32,9 @@ logFile="/opt/logs/getDeviceDetails.$$.log" lockDir=/tmp/.getDeviceDetails.lock lockPidFile=/tmp/.getDeviceDetails.lock/.lockPidFile deviceDetailsCache=/tmp/.deviceDetails.cache -DETAILS_CMD_TIMEOUT=5 - -run_with_timeout() { - if command -v timeout >/dev/null 2>&1; then - timeout "$DETAILS_CMD_TIMEOUT" "$@" - else - "$@" - fi +GDD_TRACE=${GDD_TRACE:-1} +trace_gdd() { + [ "$GDD_TRACE" = "1" ] && echo "GDD_TRACE: ts=$(date +%s) pid=$$ cmd=$command param=$parameter $*" >> /tmp/gdd_trace.log } # to enable logging: uncomment out echo and comment out colon : @@ -422,7 +417,9 @@ executeServiceRequest() echo "$IPAddress" > /tmp/.estb_ip ;; "macAddress" | "estb_mac") + trace_gdd "estb_mac_start" MacAddress=`getEstbMacAddress` + trace_gdd "estb_mac_done rc=$?" echo "$MacAddress" > /tmp/.macAddress echo "$MacAddress" > /tmp/.estb_mac ;; @@ -442,7 +439,9 @@ executeServiceRequest() "wifi_mac") [ -f /proc/device-tree/wifi-mac-addr ] && WiFiMac=$(cat /proc/device-tree/wifi-mac-addr) || WiFiMac= if [ "$WiFiMac" == "" ]; then + trace_gdd "wifi_mac_start" getWiFiMac + trace_gdd "wifi_mac_done rc=$?" fi echo "$WiFiMac" > /tmp/.wifi_mac ;; @@ -558,6 +557,7 @@ updateMissingParameters() lock() { +trace_gdd "lock_wait_start" locktime=0 while ! mkdir "$lockDir" &>/dev/null ; do logMsg "wait to acquire lock" @@ -580,6 +580,7 @@ lock() echo "$$" > $lockPidFile logMsg "lock acquired successfully" trap 'unlock "active process"' 0 1 13 15 &>/dev/null + trace_gdd "lock_wait_done" } unlock() From ae7ec3c578e85d995c1246674b0adbd049a18df9 Mon Sep 17 00:00:00 2001 From: nanimatta <84963246+nanimatta@users.noreply.github.com> Date: Tue, 7 Jul 2026 16:46:14 -0400 Subject: [PATCH 3/3] Update getDeviceDetails.sh --- lib/rdk/getDeviceDetails.sh | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/rdk/getDeviceDetails.sh b/lib/rdk/getDeviceDetails.sh index 6f9997a2..a233da16 100755 --- a/lib/rdk/getDeviceDetails.sh +++ b/lib/rdk/getDeviceDetails.sh @@ -135,22 +135,19 @@ getEcmMac() getEthernetMacAddress() { - #EtherMac=$(ifconfig $ETHERNET_INTERFACE | awk '/HWaddr/ {print $5}') - EtherMac=$(run_with_timeout ifconfig "$ETHERNET_INTERFACE" 2>/dev/null | awk '/HWaddr/ {print $5}') + EtherMac=$(ifconfig $ETHERNET_INTERFACE | awk '/HWaddr/ {print $5}') } getMocaMac() { - #MocaMac=$(ifconfig $MOCA_INTERFACE | awk '/HWaddr/ {print $5}') - MocaMac=$(run_with_timeout ifconfig "$MOCA_INTERFACE" 2>/dev/null | awk '/HWaddr/ {print $5}') + MocaMac=$(ifconfig $MOCA_INTERFACE | awk '/HWaddr/ {print $5}') } getWiFiMac() { # Get the wifi mac only if WIFI_INTERFACE is defined if [ "x$WIFI_INTERFACE" != "x" ]; then - #WiFiMac=$(ifconfig $WIFI_INTERFACE | awk '/HWaddr/ {print $5}') - WiFiMac=$(run_with_timeout ifconfig "$WIFI_INTERFACE" 2>/dev/null | awk '/HWaddr/ {print $5}') + WiFiMac=$(ifconfig $WIFI_INTERFACE | awk '/HWaddr/ {print $5}') fi } @@ -224,8 +221,7 @@ getModelNum() } getManufacturer(){ - #output=$(mfr_util --Manufacturer 2>&1) - output=$(run_with_timeout mfr_util --Manufacturer 2>&1) + output=$(mfr_util --Manufacturer 2>&1) if [ -n "$output" ] && ! echo "$output" | grep -iq "failed"; then output=$(echo $output | sed 's/ /_/g') echo "$output" | tee /tmp/.manufacturer @@ -235,8 +231,7 @@ getManufacturer(){ } getBrandName(){ - #output=$(mfr_util --Manufacturer 2>&1) - output=$(run_with_timeout mfr_util --Manufacturer 2>&1) + output=$(mfr_util --Manufacturer 2>&1) if [ -n "$output" ] && ! echo "$output" | grep -iq "failed"; then echo "$output" > /tmp/.brandname fi