Checking server reachability

ecm.check_connections() probes every server configured in the pool individually and reports, per server, whether it is reachable, whether login succeeds, and which enaio server information (e.g. product version) it returns.

This does not call the server job krn.CheckServerConnection. That job is merely a counter that runs over an existing session and opens no connection. Instead, check_connections() opens its own throwaway connection to each configured server (TCP/TLS + login + krn.GetServerInfoEx), records the outcome, and closes it again immediately.

1. Difference from ecm.system.info()

ecm.system.info()

Reflects only the currently open pool connections (one per live connection). Says nothing about servers that are configured but not connected to right now.

ecm.check_connections()

Actively probes all configured servers from the pool configuration, regardless of whether a connection to them currently exists. The probe connections never enter the pool and do not change the pool statistics.

2. Connection

from ecmind_blue_client.ecm import ECM
from ecmind_blue_client.pool import SyncPoolClient

# Multiple servers in the pool: hostname:port:weight, separated by '#'
ecm = ECM(SyncPoolClient(
    servers="server1:4000:1#server2:4000:1",
    username="<user>",
    password="<pass>",
))

Async (AsyncPoolClient) works analogously with await before the call.

3. Minimal example

for check in ecm.check_connections():
    status = "ok" if check.reachable else f"down ({check.error})"
    version = check.server_info.product_version if check.server_info else "?"
    print(f"{check.hostname}:{check.port} {status} v={version}")

Async:

for check in await ecm.check_connections():
    ...

4. Return value: ECMServerConnectionCheck

check_connections() returns a list of ECMServerConnectionCheck — one entry per configured server, in configuration order. An unreachable server does not abort the others; failures are recorded in the error field instead of being raised.

Field Type Meaning

hostname

str

Hostname that was probed.

port

int

TCP port that was probed.

reachable

bool

True if the transport connection (TCP + TLS) was established — independent of credentials.

authenticated

bool

True if the enaio login succeeded (SessionAttachSessionPropertiesSetSessionLogin).

server_info

RpcServerInfo | None

Server information (product version, platform, …) if krn.GetServerInfoEx returned data, otherwise None.

error

str | None

"<error type>: <message>" of the cause, or None on full success.

5. Semantics of the result fields

Scenario reachable authenticated server_info error

Server down / refused / DNS failure / TCP timeout

False

False

None

ConnectionError: … / TimeoutError: …

TLS handshake fails

False

False

None

SSLError: …

TCP+TLS ok, bad credentials

True

False

None

PermissionError: … / BlueException: …

Login ok, GetServerInfoEx fails

True

True

None

None (best effort)

Full success

True

True

RpcServerInfo

None

In short: reachable = transport (TCP+TLS) established; authenticated = enaio login succeeded; server_info present = GetServerInfoEx returned data.

The session-setup jobs use no read timeout — the same as the regular pool. A server that accepts the TCP connection but then hangs during login blocks the probe for that server. Only the initial connect is bounded by connect_timeout.

  • info() for statistics on the currently open pool connections