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.
This commit is contained in:
Sang Woo Kim authored and Dirk Zimoch committed 2026-11-03 16:18:02 +01:00
1 parent d72b6b36d4
commit 475bd05237
1 file changed
+3 -2
+3 -2
View File
@@ -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 <unsigned short> (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 );
}