chore(historian): drop dead pipe package ref + stale pipe strings (review)

This commit is contained in:
Joseph Doherty
2026-06-12 12:02:05 -04:00
parent 72f32045a4
commit e2960515cf
6 changed files with 18 additions and 22 deletions
@@ -8,12 +8,12 @@ using ZB.MOM.WW.OtOpcUa.Driver.Historian.Wonderware.Client.Ipc;
namespace ZB.MOM.WW.OtOpcUa.Driver.Historian.Wonderware.Client.Internal; namespace ZB.MOM.WW.OtOpcUa.Driver.Historian.Wonderware.Client.Internal;
/// <summary> /// <summary>
/// Owns one connection to the Wonderware historian sidecar pipe. Handles the Hello /// Owns one TCP connection to the Wonderware historian sidecar. Handles the Hello
/// handshake, serializes outgoing requests + waits for the matching reply frame, and /// handshake, serializes outgoing requests + waits for the matching reply frame, and
/// reconnects on transport failure with exponential backoff. /// reconnects on transport failure with exponential backoff.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Single in-flight call at a time — the sidecar's pipe protocol is request/response /// Single in-flight call at a time — the sidecar's TCP protocol is request/response
/// over a single bidirectional stream, so multiple concurrent <see cref="InvokeAsync"/> /// over a single bidirectional stream, so multiple concurrent <see cref="InvokeAsync"/>
/// calls would interleave replies. A <see cref="SemaphoreSlim"/> serializes them. PR 6.x /// calls would interleave replies. A <see cref="SemaphoreSlim"/> serializes them. PR 6.x
/// can layer batching on top. /// can layer batching on top.
@@ -147,7 +147,7 @@ internal sealed class FrameChannel : IAsyncDisposable
} }
catch (Exception ex) when (ex is IOException or EndOfStreamException or ObjectDisposedException) catch (Exception ex) when (ex is IOException or EndOfStreamException or ObjectDisposedException)
{ {
_logger.LogWarning(ex, "Sidecar pipe transport failure on {Kind}; reconnecting", requestKind); _logger.LogWarning(ex, "Sidecar TCP transport failure on {Kind}; reconnecting", requestKind);
ResetTransport(); ResetTransport();
await ConnectInternalAsync(timeout.Token).ConfigureAwait(false); await ConnectInternalAsync(timeout.Token).ConfigureAwait(false);
// One retry. If the second attempt also fails, propagate. // One retry. If the second attempt also fails, propagate.
@@ -162,7 +162,7 @@ internal sealed class FrameChannel : IAsyncDisposable
{ {
await _writer!.WriteAsync(requestKind, request, ct).ConfigureAwait(false); await _writer!.WriteAsync(requestKind, request, ct).ConfigureAwait(false);
var frame = await _reader!.ReadFrameAsync(ct).ConfigureAwait(false) var frame = await _reader!.ReadFrameAsync(ct).ConfigureAwait(false)
?? throw new EndOfStreamException("Sidecar closed pipe before reply."); ?? throw new EndOfStreamException("Sidecar closed connection before reply.");
if (frame.Kind != expectedReplyKind) if (frame.Kind != expectedReplyKind)
{ {
throw new InvalidDataException( throw new InvalidDataException(
@@ -189,7 +189,7 @@ internal sealed class FrameChannel : IAsyncDisposable
await _writer.WriteAsync(MessageKind.Hello, hello, ct).ConfigureAwait(false); await _writer.WriteAsync(MessageKind.Hello, hello, ct).ConfigureAwait(false);
var ackFrame = await _reader.ReadFrameAsync(ct).ConfigureAwait(false) var ackFrame = await _reader.ReadFrameAsync(ct).ConfigureAwait(false)
?? throw new EndOfStreamException("Sidecar closed pipe before HelloAck."); ?? throw new EndOfStreamException("Sidecar closed connection before HelloAck.");
if (ackFrame.Kind != MessageKind.HelloAck) if (ackFrame.Kind != MessageKind.HelloAck)
{ {
ResetTransport(); ResetTransport();
@@ -204,7 +204,7 @@ internal sealed class FrameChannel : IAsyncDisposable
$"Sidecar rejected Hello: {ack.RejectReason ?? "<no reason>"}."); $"Sidecar rejected Hello: {ack.RejectReason ?? "<no reason>"}.");
} }
_logger.LogInformation("Sidecar pipe connected — host={Host}", ack.HostName); _logger.LogInformation("Sidecar TCP connected — host={Host}", ack.HostName);
} }
private void ResetTransport() private void ResetTransport()
@@ -210,11 +210,11 @@ public sealed class WonderwareHistorianClient : IHistorianDataSource, IAlarmHist
} }
/// <summary> /// <summary>
/// Returns a snapshot of operation counters and the single pipe channel's connection /// Returns a snapshot of operation counters and the single TCP channel's connection
/// state. /// state.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// This client owns one duplex named-pipe channel to the sidecar — it has no notion of /// This client owns one TCP channel to the sidecar — it has no notion of
/// separate process / event connections and no per-node telemetry. The single channel's /// separate process / event connections and no per-node telemetry. The single channel's
/// connected state is reported for both <see cref="HistorianHealthSnapshot.ProcessConnectionOpen"/> /// connected state is reported for both <see cref="HistorianHealthSnapshot.ProcessConnectionOpen"/>
/// and <see cref="HistorianHealthSnapshot.EventConnectionOpen"/>, and /// and <see cref="HistorianHealthSnapshot.EventConnectionOpen"/>, and
@@ -521,7 +521,7 @@ public sealed class WonderwareHistorianClient : IHistorianDataSource, IAlarmHist
_ => throw new NotSupportedException($"Unknown HistoryAggregateType {aggregate}"), _ => throw new NotSupportedException($"Unknown HistoryAggregateType {aggregate}"),
}; };
/// <summary>Asynchronously disposes the client and its underlying pipe channel.</summary> /// <summary>Asynchronously disposes the client and its underlying TCP channel.</summary>
/// <returns>A task that completes when the client has been disposed.</returns> /// <returns>A task that completes when the client has been disposed.</returns>
public ValueTask DisposeAsync() => _channel.DisposeAsync(); public ValueTask DisposeAsync() => _channel.DisposeAsync();
@@ -6,11 +6,10 @@ namespace ZB.MOM.WW.OtOpcUa.Driver.Historian.Wonderware.Client;
/// <summary> /// <summary>
/// Driver probe for the <see cref="WonderwareHistorianClientOptions"/>-shaped driver config. /// Driver probe for the <see cref="WonderwareHistorianClientOptions"/>-shaped driver config.
/// The Wonderware Historian client communicates over a Windows named pipe (not a TCP socket), /// The Wonderware Historian client communicates over TCP, but a lightweight TCP-connect +
/// so a cheap TCP-connect probe is not applicable for this transport. This probe always /// Hello-frame probe is not yet implemented. This probe always returns a well-formed
/// returns a well-formed "not applicable" result so the AdminUI can display a meaningful /// "not applicable" result so the AdminUI can display a meaningful message instead of a
/// message instead of a red error. A full named-pipe connect + Hello-frame probe is a /// red error. A full TCP connect + Hello-frame probe is a documented follow-up.
/// documented follow-up.
/// </summary> /// </summary>
public sealed class WonderwareHistorianDriverProbe : IDriverProbe public sealed class WonderwareHistorianDriverProbe : IDriverProbe
{ {
@@ -36,12 +35,11 @@ public sealed class WonderwareHistorianDriverProbe : IDriverProbe
if (opts is null) if (opts is null)
return Task.FromResult(new DriverProbeResult(false, "Config JSON deserialized to null.", null)); return Task.FromResult(new DriverProbeResult(false, "Config JSON deserialized to null.", null));
// The Wonderware Historian sidecar communicates over a Windows named pipe; there is no // The Wonderware Historian sidecar communicates over TCP; a full TCP connect +
// TCP endpoint to connect to. A full pipe connect + Hello-frame probe is a follow-up. // Hello-frame probe is a documented follow-up.
return Task.FromResult(new DriverProbeResult( return Task.FromResult(new DriverProbeResult(
false, false,
"TCP probe not applicable for this transport — the Historian sidecar uses a named pipe. " + "Full TCP probe (connect + Hello handshake) is not yet implemented for this driver — it is a documented follow-up.",
"A full named-pipe probe is a documented follow-up.",
null)); null));
} }
} }
@@ -21,8 +21,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="MessagePack"/> <PackageReference Include="MessagePack"/>
<PackageReference Include="System.IO.Pipes.AccessControl"/> <PackageReference Include="System.Memory"/>
<PackageReference Include="System.Memory"/>
<PackageReference Include="System.Threading.Tasks.Extensions"/> <PackageReference Include="System.Threading.Tasks.Extensions"/>
<PackageReference Include="System.Data.SqlClient"/> <PackageReference Include="System.Data.SqlClient"/>
<PackageReference Include="Serilog"/> <PackageReference Include="Serilog"/>
@@ -100,7 +100,7 @@ else
<div class="col-md-3"> <div class="col-md-3">
<label class="form-label">Connect timeout (s, blank = default 10 s)</label> <label class="form-label">Connect timeout (s, blank = default 10 s)</label>
<InputNumber @bind-Value="_form.Historian.ConnectTimeoutSeconds" class="form-control form-control-sm" /> <InputNumber @bind-Value="_form.Historian.ConnectTimeoutSeconds" class="form-control form-control-sm" />
<div class="form-text">Cap on pipe connect + Hello round-trip. Null = 10 s.</div> <div class="form-text">Cap on TCP connect + Hello round-trip. Null = 10 s.</div>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<label class="form-label">Call timeout (s, blank = default 30 s)</label> <label class="form-label">Call timeout (s, blank = default 30 s)</label>
@@ -14,7 +14,6 @@
"AlarmHistorian": { "AlarmHistorian": {
"Enabled": false, "Enabled": false,
"DatabasePath": "alarm-historian.db", "DatabasePath": "alarm-historian.db",
"PipeName": "OtOpcUaHistorian",
"Host": "localhost", "Host": "localhost",
"Port": 32569, "Port": 32569,
"UseTls": false, "UseTls": false,