fix(opcuaclient): split the per-endpoint connect budget into reachability + session phases (#912)

PerEndpointConnectTimeout (3 s) now bounds only TCP + discovery, so failover past a
dead endpoint stays fast. The new SessionCreateTimeout (10 s) bounds OpenSecureChannel
+ CreateSession on an endpoint that answered discovery, where the client-side cert and
crypto work lives (#910). 2 x (3 + 10) s stays inside the host's 30 s initialise bound.
Expiries name the budget that ran out; both budgets must be positive; AdminUI form
carries the new field so a save does not drop it; driver docs updated.

Closes #912
This commit is contained in:
Joseph Doherty
2026-11-15 16:55:22 -05:00
parent 8ff424fc5a
commit 678498a4a6
6 changed files with 150 additions and 29 deletions
@@ -37,7 +37,13 @@
<label for="@FieldId("field-05")" class="form-label">Per-endpoint connect timeout (s)</label>
<InputNumber DisplayName="Per-endpoint connect timeout (s)" aria-describedby="@FieldIds("field-05-error", "field-05-hint")" id="@FieldId("field-05")" @bind-Value="_form.OpcUa.PerEndpointConnectTimeoutSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-05-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.OpcUa.PerEndpointConnectTimeoutSeconds)" /> }</div>
<div id="@FieldId("field-05-hint")" class="form-text">Default 3 s — failover sweep budget.</div>
<div id="@FieldId("field-05-hint")" class="form-text">Default 3 s — TCP + discovery; how fast failover passes a dead endpoint.</div>
</div>
<div class="col-md-3">
<label for="@FieldId("field-30")" class="form-label">Session create timeout (s)</label>
<InputNumber DisplayName="Session create timeout (s)" aria-describedby="@FieldIds("field-30-error", "field-30-hint")" id="@FieldId("field-30")" @bind-Value="_form.OpcUa.SessionCreateTimeoutSeconds" @bind-Value:after="EmitAsync" class="form-control form-control-sm" />
<div id="@FieldId("field-30-error")" class="field-error">@if (_fieldEditContext is not null) { <ValidationMessage For="@(() => _form.OpcUa.SessionCreateTimeoutSeconds)" /> }</div>
<div id="@FieldId("field-30-hint")" class="form-text">Default 10 s — secure channel + session on a reachable endpoint.</div>
</div>
<div class="col-md-3">
<label for="@FieldId("field-06")" class="form-label">Operation timeout (s)</label>
@@ -366,6 +372,7 @@
public string SessionName { get; set; } = "OtOpcUa-Gateway";
public bool AutoAcceptCertificates { get; set; } = false;
public int PerEndpointConnectTimeoutSeconds { get; set; } = 3;
public int SessionCreateTimeoutSeconds { get; set; } = 10;
public int TimeoutSeconds { get; set; } = 10;
public int SessionTimeoutSeconds { get; set; } = 120;
public int KeepAliveIntervalSeconds { get; set; } = 5;
@@ -407,6 +414,7 @@
SessionName = r.SessionName,
AutoAcceptCertificates = r.AutoAcceptCertificates,
PerEndpointConnectTimeoutSeconds = (int)r.PerEndpointConnectTimeout.TotalSeconds,
SessionCreateTimeoutSeconds = (int)r.SessionCreateTimeout.TotalSeconds,
TimeoutSeconds = (int)r.Timeout.TotalSeconds,
SessionTimeoutSeconds = (int)r.SessionTimeout.TotalSeconds,
KeepAliveIntervalSeconds = (int)r.KeepAliveInterval.TotalSeconds,
@@ -446,6 +454,7 @@
SessionName = SessionName,
AutoAcceptCertificates = AutoAcceptCertificates,
PerEndpointConnectTimeout = TimeSpan.FromSeconds(PerEndpointConnectTimeoutSeconds),
SessionCreateTimeout = TimeSpan.FromSeconds(SessionCreateTimeoutSeconds),
Timeout = TimeSpan.FromSeconds(TimeoutSeconds),
SessionTimeout = TimeSpan.FromSeconds(SessionTimeoutSeconds),
KeepAliveInterval = TimeSpan.FromSeconds(KeepAliveIntervalSeconds),