Skip to content

opcua: discovery scan is one-shot - gateway stuck on localhost default when the PLC is not up at boot #601

Description

@mfaferek93

With no endpoint_url pinned and network discovery enabled, the subnet scan runs once at plugin init. If the PLC does not answer at that moment (gateway boots before the PLC, PLC in STOP during a power cycle), the plugin logs:

OPC-UA discovery summary: 0 data server(s), ...
OPC-UA discovery: no auto-connectable None/Anonymous data server found; leaving endpoint at default.

and then retries opc.tcp://localhost:4840 every 60 s forever. The scan is never re-run, so the gateway stays disconnected even when the PLC comes back minutes later. Observed on a gateway that sat on the localhost default for 4 days while the PLC was reachable the whole time; a container restart re-ran the scan and it reconnected immediately.

Whoever boots second wins - a box that survives a plant power cycle worse than the PLC defeats the point of config-less discovery.

Proposal: while unconnected and unpinned, re-run the discovery scan on a backoff (e.g. every 60 s) instead of hammering the localhost default. Related: the reconnect path also never re-browses (#584 follow-up).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions