From a quick look, the issue is that casStatsFetch() can't be called until/unless the CA server (RSRV) has successfully initialized. iocstats is starting it's 1Hz scan timer from a device support init() function, this happens before RSRV is started. So this would also crash if the initialization between these two points takes longer than 1 second.
At a minimum, iocStats should not start this timer until after RSRV has started, if not later. I'd suggest an initHook with initHookAfterCaServerRunning or initHookAfterIocRunning.
From a quick look, the issue is that casStatsFetch() can't be called until/unless the CA server (RSRV) has successfully initialized. iocstats is starting it's 1Hz scan timer from a device support init() function, this happens before RSRV is started. So this would also crash if the initialization between these two points takes longer than 1 second.
At a minimum, iocStats should not start this timer until after RSRV has started, if not later. I'd suggest an initHook with initHookAfterCa ServerRunning or initHookAfterIo cRunning.
https:/ /github. com/epics- modules/ iocStats/ blob/0cec4fc67a 4d4419c21161d88 9862766a7690daa /devIocStats/ devIocStatsAnal og.c#L405