From 475bd05237849472d9a199be67df519fa0d40389 Mon Sep 17 00:00:00 2001 From: Sang Woo Kim Date: Sun, 19 Jul 2026 17:36:31 +0900 Subject: [PATCH] cac: reject a non-positive or non-finite EPICS_CA_CONN_TMO A successful parse of EPICS_CA_CONN_TMO stored the value into connTMO unchecked, so EPICS_CA_CONN_TMO=-5 or =0 left the connection-verify watchdog deadline permanently in the past. The watchdog then fires continuously, flooding stderr with "Virtual circuit unresponsive" and pinning a CPU while updates still arrive. NaN and inf (which epicsScanDouble also accepts) slip past any ordering comparison: a NaN period leaves the watchdog deadline arithmetic undefined, and an infinite period silently disables circuit verification. Fold the validity check into the existing parse-failure branch, so an unparsable, non-finite, or non-positive value takes the same path: warn once and fall back to the 30 s CA_CONN_VERIFY_PERIOD default. This mirrors the sibling EPICS_CA_MAX_ARRAY_BYTES handling a few lines below, which already gates a parse failure and an out-of-range value in one condition, and matches the finite() gate on EPICS_CA_MAX_SEARCH_PERIOD in udpiiu.cpp. --- modules/ca/src/client/cac.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/ca/src/client/cac.cpp b/modules/ca/src/client/cac.cpp index 13ef7514c..7b059a6f5 100644 --- a/modules/ca/src/client/cac.cpp +++ b/modules/ca/src/client/cac.cpp @@ -33,6 +33,7 @@ #include "epicsSignal.h" #include "envDefs.h" #include "locationException.h" +#include "epicsMath.h" #include "errlog.h" #include "epicsExport.h" @@ -186,10 +187,10 @@ cac::cac ( static_cast (CA_SERVER_PORT) ); status = envGetDoubleConfigParam ( &EPICS_CA_CONN_TMO, &this->connTMO ); - if ( status ) { + if ( status || ! finite ( this->connTMO ) || this->connTMO <= 0.0 ) { this->connTMO = CA_CONN_VERIFY_PERIOD; epicsGuard < epicsMutex > cbGuard ( this->cbMutex ); - errlogPrintf ( "EPICS \"%s\" double fetch failed\n", EPICS_CA_CONN_TMO.name ); + errlogPrintf ( "EPICS \"%s\" was not a positive real number\n", EPICS_CA_CONN_TMO.name ); errlogPrintf ( "Defaulting \"%s\" = %f\n", EPICS_CA_CONN_TMO.name, this->connTMO ); }