Files
lmxopcua/src/Drivers
Joseph Doherty 0eb620a223 fix(twincat): #982 symbol-table changes re-resolve on a fresh client; one dead device no longer stalls the rest
Review 2026-12-02 (09-ab-twincat-focas.md) TwinCAT findings:

- P-1: a stale client (ADS symbol-version event, a 1809, an invalidated
  notification, a probe non-Run -> Run transition, or a moved OnlineChangeCnt
  sampled every healthy probe tick) is never handed out again: the next call
  retires it (fresh Beckhoff symbol cache), native registrations replay on the
  fresh client (background or probe tick), its pushes are dropped, refused
  registrations re-arm, rediscovery is raised once per event. Verified against
  decompiled Beckhoff.TwinCAT.Ads 7.0.172: SymbolCache cleans itself only on
  the symbol-version event, which an online change does not raise.
- P-3: devices are read concurrently; the first comms failure on a device is
  checked against its ADS state once - gone => remaining tags fail fast with no
  wire attempt, alive => per-tag failure. Probe-unreachable devices fail fast;
  native subscribe applies the same rule.
- P-4: the probe connects without replaying registrations, probes, and
  re-registers only after the device answered; a replay against a dead device
  stops dialling it; one Warning per device per outage, Bad published once.
- P-12: unlisted device-layer ADS codes (0x700-0x73F) map to BadDeviceFailure
  (refusal, no health write, refusal backoff); 1817 DeviceTimeOut = BadTimeout;
  marshal/type read exceptions = BadTypeMismatch; the read guard refuses a
  scalar over a struct/FB (pointers/references still read as their address).
- P-19: symbol name / bit index pre-computed at init; health re-derived once
  per device per read call (health updates now serialised under a lock).
- P-22: the ADS client always carries the driver Timeout; the probe bounds
  only its own ReadState with Probe.Timeout.
- P-25: bit-indexed BOOL poll reads resolve the parent and read it at its own
  width; poll / notification / write agree on BadOutOfRange / BadTypeMismatch.

Tests: TwinCATReview20261202Tests (39 cases; the behavioural ones failed before
the fix). TwinCAT.Tests 712/712.
2026-12-03 10:04:09 -05:00
..