feat(worker,gateway): report record-info pin outcome in WorkerReady; drain-thread completion tests
The worker logged its MXSTATUS_PROXY record-info pin outcome only to its own stderr, which the gateway's launcher does not capture, so operators never saw whether the pin took. - Contract (additive, internal IPC): WorkerReady.record_info_pin_status = 5. No protocol version bump; an older peer ignores it or sends it empty. Regenerated Contracts/Generated, the client protoset, the Rust vendored proto, and the Go/Python/Java worker bindings (real delta only). - Worker: the handshake copies MxStatusProxyRecordInfoPin.Status into WorkerReady unless the runtime already set it. - Gateway: WorkerClient records it (IWorkerClient.RecordInfoPinStatus, default null) and logs it at Information when pinned, Warning otherwise; empty is not logged. Shown as "Record-info pin" in the dashboard session details Worker table via DashboardSessionSummary.WorkerRecordInfoPinStatus. - Tests: drain-thread cancellation (task ends Canceled; RunAsync cancels, runtime disposed, thread exits, no EventDrain stop-failure log) and fault (exception on the thread faults RunAsync with the same instance) paths; WorkerReady carries the pin status; gateway logging/recording and the dashboard projection. - Docs: gateway.md STA thread model (drain thread, pin step in COM lifetime), MxAccessWorkerInstanceDesign, GatewayProcessDesign, GatewayDashboardDesign, WorkerFrameProtocol.
This commit is contained in:
@@ -580,8 +580,15 @@ type WorkerReady struct {
|
||||
MxaccessProgid string `protobuf:"bytes,2,opt,name=mxaccess_progid,json=mxaccessProgid,proto3" json:"mxaccess_progid,omitempty"`
|
||||
MxaccessClsid string `protobuf:"bytes,3,opt,name=mxaccess_clsid,json=mxaccessClsid,proto3" json:"mxaccess_clsid,omitempty"`
|
||||
ReadyTimestamp *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=ready_timestamp,json=readyTimestamp,proto3" json:"ready_timestamp,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
// Outcome of the worker's process-wide MXSTATUS_PROXY record-info pin
|
||||
// (MxStatusProxyRecordInfoPin): "pinned {library-guid} vM.m record {record-guid}" on
|
||||
// success, or the failing call and HRESULT / exception type otherwise. Empty when the
|
||||
// worker made no attempt (an older worker, or a runtime that never created the
|
||||
// MXAccess COM object). Diagnostic only: the gateway logs it and shows it on the
|
||||
// dashboard, and never gates readiness on it, because the pin is a cache warm-up.
|
||||
RecordInfoPinStatus string `protobuf:"bytes,5,opt,name=record_info_pin_status,json=recordInfoPinStatus,proto3" json:"record_info_pin_status,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *WorkerReady) Reset() {
|
||||
@@ -642,6 +649,13 @@ func (x *WorkerReady) GetReadyTimestamp() *timestamppb.Timestamp {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WorkerReady) GetRecordInfoPinStatus() string {
|
||||
if x != nil {
|
||||
return x.RecordInfoPinStatus
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type WorkerCommand struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Command *MxCommand `protobuf:"bytes,1,opt,name=command,proto3" json:"command,omitempty"`
|
||||
@@ -1139,12 +1153,13 @@ const file_mxaccess_worker_proto_rawDesc = "" +
|
||||
"\x10protocol_version\x18\x01 \x01(\rR\x0fprotocolVersion\x12\x14\n" +
|
||||
"\x05nonce\x18\x02 \x01(\tR\x05nonce\x12*\n" +
|
||||
"\x11worker_process_id\x18\x03 \x01(\x05R\x0fworkerProcessId\x12%\n" +
|
||||
"\x0eworker_version\x18\x04 \x01(\tR\rworkerVersion\"\xce\x01\n" +
|
||||
"\x0eworker_version\x18\x04 \x01(\tR\rworkerVersion\"\x83\x02\n" +
|
||||
"\vWorkerReady\x12*\n" +
|
||||
"\x11worker_process_id\x18\x01 \x01(\x05R\x0fworkerProcessId\x12'\n" +
|
||||
"\x0fmxaccess_progid\x18\x02 \x01(\tR\x0emxaccessProgid\x12%\n" +
|
||||
"\x0emxaccess_clsid\x18\x03 \x01(\tR\rmxaccessClsid\x12C\n" +
|
||||
"\x0fready_timestamp\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\x0ereadyTimestamp\"\x92\x01\n" +
|
||||
"\x0fready_timestamp\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\x0ereadyTimestamp\x123\n" +
|
||||
"\x16record_info_pin_status\x18\x05 \x01(\tR\x13recordInfoPinStatus\"\x92\x01\n" +
|
||||
"\rWorkerCommand\x128\n" +
|
||||
"\acommand\x18\x01 \x01(\v2\x1e.mxaccess_gateway.v1.MxCommandR\acommand\x12G\n" +
|
||||
"\x11enqueue_timestamp\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\x10enqueueTimestamp\"\x9c\x01\n" +
|
||||
|
||||
@@ -5477,6 +5477,36 @@ public final class MxaccessWorker extends com.google.protobuf.GeneratedFile {
|
||||
* <code>.google.protobuf.Timestamp ready_timestamp = 4;</code>
|
||||
*/
|
||||
com.google.protobuf.TimestampOrBuilder getReadyTimestampOrBuilder();
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Outcome of the worker's process-wide MXSTATUS_PROXY record-info pin
|
||||
* (MxStatusProxyRecordInfoPin): "pinned {library-guid} vM.m record {record-guid}" on
|
||||
* success, or the failing call and HRESULT / exception type otherwise. Empty when the
|
||||
* worker made no attempt (an older worker, or a runtime that never created the
|
||||
* MXAccess COM object). Diagnostic only: the gateway logs it and shows it on the
|
||||
* dashboard, and never gates readiness on it, because the pin is a cache warm-up.
|
||||
* </pre>
|
||||
*
|
||||
* <code>string record_info_pin_status = 5;</code>
|
||||
* @return The recordInfoPinStatus.
|
||||
*/
|
||||
java.lang.String getRecordInfoPinStatus();
|
||||
/**
|
||||
* <pre>
|
||||
* Outcome of the worker's process-wide MXSTATUS_PROXY record-info pin
|
||||
* (MxStatusProxyRecordInfoPin): "pinned {library-guid} vM.m record {record-guid}" on
|
||||
* success, or the failing call and HRESULT / exception type otherwise. Empty when the
|
||||
* worker made no attempt (an older worker, or a runtime that never created the
|
||||
* MXAccess COM object). Diagnostic only: the gateway logs it and shows it on the
|
||||
* dashboard, and never gates readiness on it, because the pin is a cache warm-up.
|
||||
* </pre>
|
||||
*
|
||||
* <code>string record_info_pin_status = 5;</code>
|
||||
* @return The bytes for recordInfoPinStatus.
|
||||
*/
|
||||
com.google.protobuf.ByteString
|
||||
getRecordInfoPinStatusBytes();
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code mxaccess_worker.v1.WorkerReady}
|
||||
@@ -5502,6 +5532,7 @@ public final class MxaccessWorker extends com.google.protobuf.GeneratedFile {
|
||||
private WorkerReady() {
|
||||
mxaccessProgid_ = "";
|
||||
mxaccessClsid_ = "";
|
||||
recordInfoPinStatus_ = "";
|
||||
}
|
||||
|
||||
public static final com.google.protobuf.Descriptors.Descriptor
|
||||
@@ -5633,6 +5664,63 @@ public final class MxaccessWorker extends com.google.protobuf.GeneratedFile {
|
||||
return readyTimestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : readyTimestamp_;
|
||||
}
|
||||
|
||||
public static final int RECORD_INFO_PIN_STATUS_FIELD_NUMBER = 5;
|
||||
@SuppressWarnings("serial")
|
||||
private volatile java.lang.Object recordInfoPinStatus_ = "";
|
||||
/**
|
||||
* <pre>
|
||||
* Outcome of the worker's process-wide MXSTATUS_PROXY record-info pin
|
||||
* (MxStatusProxyRecordInfoPin): "pinned {library-guid} vM.m record {record-guid}" on
|
||||
* success, or the failing call and HRESULT / exception type otherwise. Empty when the
|
||||
* worker made no attempt (an older worker, or a runtime that never created the
|
||||
* MXAccess COM object). Diagnostic only: the gateway logs it and shows it on the
|
||||
* dashboard, and never gates readiness on it, because the pin is a cache warm-up.
|
||||
* </pre>
|
||||
*
|
||||
* <code>string record_info_pin_status = 5;</code>
|
||||
* @return The recordInfoPinStatus.
|
||||
*/
|
||||
@java.lang.Override
|
||||
public java.lang.String getRecordInfoPinStatus() {
|
||||
java.lang.Object ref = recordInfoPinStatus_;
|
||||
if (ref instanceof java.lang.String) {
|
||||
return (java.lang.String) ref;
|
||||
} else {
|
||||
com.google.protobuf.ByteString bs =
|
||||
(com.google.protobuf.ByteString) ref;
|
||||
java.lang.String s = bs.toStringUtf8();
|
||||
recordInfoPinStatus_ = s;
|
||||
return s;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* Outcome of the worker's process-wide MXSTATUS_PROXY record-info pin
|
||||
* (MxStatusProxyRecordInfoPin): "pinned {library-guid} vM.m record {record-guid}" on
|
||||
* success, or the failing call and HRESULT / exception type otherwise. Empty when the
|
||||
* worker made no attempt (an older worker, or a runtime that never created the
|
||||
* MXAccess COM object). Diagnostic only: the gateway logs it and shows it on the
|
||||
* dashboard, and never gates readiness on it, because the pin is a cache warm-up.
|
||||
* </pre>
|
||||
*
|
||||
* <code>string record_info_pin_status = 5;</code>
|
||||
* @return The bytes for recordInfoPinStatus.
|
||||
*/
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.ByteString
|
||||
getRecordInfoPinStatusBytes() {
|
||||
java.lang.Object ref = recordInfoPinStatus_;
|
||||
if (ref instanceof java.lang.String) {
|
||||
com.google.protobuf.ByteString b =
|
||||
com.google.protobuf.ByteString.copyFromUtf8(
|
||||
(java.lang.String) ref);
|
||||
recordInfoPinStatus_ = b;
|
||||
return b;
|
||||
} else {
|
||||
return (com.google.protobuf.ByteString) ref;
|
||||
}
|
||||
}
|
||||
|
||||
private byte memoizedIsInitialized = -1;
|
||||
@java.lang.Override
|
||||
public final boolean isInitialized() {
|
||||
@@ -5659,6 +5747,9 @@ public final class MxaccessWorker extends com.google.protobuf.GeneratedFile {
|
||||
if (((bitField0_ & 0x00000001) != 0)) {
|
||||
output.writeMessage(4, getReadyTimestamp());
|
||||
}
|
||||
if (!com.google.protobuf.GeneratedMessage.isStringEmpty(recordInfoPinStatus_)) {
|
||||
com.google.protobuf.GeneratedMessage.writeString(output, 5, recordInfoPinStatus_);
|
||||
}
|
||||
getUnknownFields().writeTo(output);
|
||||
}
|
||||
|
||||
@@ -5682,6 +5773,9 @@ public final class MxaccessWorker extends com.google.protobuf.GeneratedFile {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeMessageSize(4, getReadyTimestamp());
|
||||
}
|
||||
if (!com.google.protobuf.GeneratedMessage.isStringEmpty(recordInfoPinStatus_)) {
|
||||
size += com.google.protobuf.GeneratedMessage.computeStringSize(5, recordInfoPinStatus_);
|
||||
}
|
||||
size += getUnknownFields().getSerializedSize();
|
||||
memoizedSize = size;
|
||||
return size;
|
||||
@@ -5708,6 +5802,8 @@ public final class MxaccessWorker extends com.google.protobuf.GeneratedFile {
|
||||
if (!getReadyTimestamp()
|
||||
.equals(other.getReadyTimestamp())) return false;
|
||||
}
|
||||
if (!getRecordInfoPinStatus()
|
||||
.equals(other.getRecordInfoPinStatus())) return false;
|
||||
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
|
||||
return true;
|
||||
}
|
||||
@@ -5729,6 +5825,8 @@ public final class MxaccessWorker extends com.google.protobuf.GeneratedFile {
|
||||
hash = (37 * hash) + READY_TIMESTAMP_FIELD_NUMBER;
|
||||
hash = (53 * hash) + getReadyTimestamp().hashCode();
|
||||
}
|
||||
hash = (37 * hash) + RECORD_INFO_PIN_STATUS_FIELD_NUMBER;
|
||||
hash = (53 * hash) + getRecordInfoPinStatus().hashCode();
|
||||
hash = (29 * hash) + getUnknownFields().hashCode();
|
||||
memoizedHashCode = hash;
|
||||
return hash;
|
||||
@@ -5874,6 +5972,7 @@ public final class MxaccessWorker extends com.google.protobuf.GeneratedFile {
|
||||
readyTimestampBuilder_.dispose();
|
||||
readyTimestampBuilder_ = null;
|
||||
}
|
||||
recordInfoPinStatus_ = "";
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -5923,6 +6022,9 @@ public final class MxaccessWorker extends com.google.protobuf.GeneratedFile {
|
||||
: readyTimestampBuilder_.build();
|
||||
to_bitField0_ |= 0x00000001;
|
||||
}
|
||||
if (((from_bitField0_ & 0x00000010) != 0)) {
|
||||
result.recordInfoPinStatus_ = recordInfoPinStatus_;
|
||||
}
|
||||
result.bitField0_ |= to_bitField0_;
|
||||
}
|
||||
|
||||
@@ -5954,6 +6056,11 @@ public final class MxaccessWorker extends com.google.protobuf.GeneratedFile {
|
||||
if (other.hasReadyTimestamp()) {
|
||||
mergeReadyTimestamp(other.getReadyTimestamp());
|
||||
}
|
||||
if (!other.getRecordInfoPinStatus().isEmpty()) {
|
||||
recordInfoPinStatus_ = other.recordInfoPinStatus_;
|
||||
bitField0_ |= 0x00000010;
|
||||
onChanged();
|
||||
}
|
||||
this.mergeUnknownFields(other.getUnknownFields());
|
||||
onChanged();
|
||||
return this;
|
||||
@@ -6002,6 +6109,11 @@ public final class MxaccessWorker extends com.google.protobuf.GeneratedFile {
|
||||
bitField0_ |= 0x00000008;
|
||||
break;
|
||||
} // case 34
|
||||
case 42: {
|
||||
recordInfoPinStatus_ = input.readStringRequireUtf8();
|
||||
bitField0_ |= 0x00000010;
|
||||
break;
|
||||
} // case 42
|
||||
default: {
|
||||
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
|
||||
done = true; // was an endgroup tag
|
||||
@@ -6316,6 +6428,123 @@ public final class MxaccessWorker extends com.google.protobuf.GeneratedFile {
|
||||
return readyTimestampBuilder_;
|
||||
}
|
||||
|
||||
private java.lang.Object recordInfoPinStatus_ = "";
|
||||
/**
|
||||
* <pre>
|
||||
* Outcome of the worker's process-wide MXSTATUS_PROXY record-info pin
|
||||
* (MxStatusProxyRecordInfoPin): "pinned {library-guid} vM.m record {record-guid}" on
|
||||
* success, or the failing call and HRESULT / exception type otherwise. Empty when the
|
||||
* worker made no attempt (an older worker, or a runtime that never created the
|
||||
* MXAccess COM object). Diagnostic only: the gateway logs it and shows it on the
|
||||
* dashboard, and never gates readiness on it, because the pin is a cache warm-up.
|
||||
* </pre>
|
||||
*
|
||||
* <code>string record_info_pin_status = 5;</code>
|
||||
* @return The recordInfoPinStatus.
|
||||
*/
|
||||
public java.lang.String getRecordInfoPinStatus() {
|
||||
java.lang.Object ref = recordInfoPinStatus_;
|
||||
if (!(ref instanceof java.lang.String)) {
|
||||
com.google.protobuf.ByteString bs =
|
||||
(com.google.protobuf.ByteString) ref;
|
||||
java.lang.String s = bs.toStringUtf8();
|
||||
recordInfoPinStatus_ = s;
|
||||
return s;
|
||||
} else {
|
||||
return (java.lang.String) ref;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* Outcome of the worker's process-wide MXSTATUS_PROXY record-info pin
|
||||
* (MxStatusProxyRecordInfoPin): "pinned {library-guid} vM.m record {record-guid}" on
|
||||
* success, or the failing call and HRESULT / exception type otherwise. Empty when the
|
||||
* worker made no attempt (an older worker, or a runtime that never created the
|
||||
* MXAccess COM object). Diagnostic only: the gateway logs it and shows it on the
|
||||
* dashboard, and never gates readiness on it, because the pin is a cache warm-up.
|
||||
* </pre>
|
||||
*
|
||||
* <code>string record_info_pin_status = 5;</code>
|
||||
* @return The bytes for recordInfoPinStatus.
|
||||
*/
|
||||
public com.google.protobuf.ByteString
|
||||
getRecordInfoPinStatusBytes() {
|
||||
java.lang.Object ref = recordInfoPinStatus_;
|
||||
if (ref instanceof String) {
|
||||
com.google.protobuf.ByteString b =
|
||||
com.google.protobuf.ByteString.copyFromUtf8(
|
||||
(java.lang.String) ref);
|
||||
recordInfoPinStatus_ = b;
|
||||
return b;
|
||||
} else {
|
||||
return (com.google.protobuf.ByteString) ref;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* Outcome of the worker's process-wide MXSTATUS_PROXY record-info pin
|
||||
* (MxStatusProxyRecordInfoPin): "pinned {library-guid} vM.m record {record-guid}" on
|
||||
* success, or the failing call and HRESULT / exception type otherwise. Empty when the
|
||||
* worker made no attempt (an older worker, or a runtime that never created the
|
||||
* MXAccess COM object). Diagnostic only: the gateway logs it and shows it on the
|
||||
* dashboard, and never gates readiness on it, because the pin is a cache warm-up.
|
||||
* </pre>
|
||||
*
|
||||
* <code>string record_info_pin_status = 5;</code>
|
||||
* @param value The recordInfoPinStatus to set.
|
||||
* @return This builder for chaining.
|
||||
*/
|
||||
public Builder setRecordInfoPinStatus(
|
||||
java.lang.String value) {
|
||||
if (value == null) { throw new NullPointerException(); }
|
||||
recordInfoPinStatus_ = value;
|
||||
bitField0_ |= 0x00000010;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* Outcome of the worker's process-wide MXSTATUS_PROXY record-info pin
|
||||
* (MxStatusProxyRecordInfoPin): "pinned {library-guid} vM.m record {record-guid}" on
|
||||
* success, or the failing call and HRESULT / exception type otherwise. Empty when the
|
||||
* worker made no attempt (an older worker, or a runtime that never created the
|
||||
* MXAccess COM object). Diagnostic only: the gateway logs it and shows it on the
|
||||
* dashboard, and never gates readiness on it, because the pin is a cache warm-up.
|
||||
* </pre>
|
||||
*
|
||||
* <code>string record_info_pin_status = 5;</code>
|
||||
* @return This builder for chaining.
|
||||
*/
|
||||
public Builder clearRecordInfoPinStatus() {
|
||||
recordInfoPinStatus_ = getDefaultInstance().getRecordInfoPinStatus();
|
||||
bitField0_ = (bitField0_ & ~0x00000010);
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* Outcome of the worker's process-wide MXSTATUS_PROXY record-info pin
|
||||
* (MxStatusProxyRecordInfoPin): "pinned {library-guid} vM.m record {record-guid}" on
|
||||
* success, or the failing call and HRESULT / exception type otherwise. Empty when the
|
||||
* worker made no attempt (an older worker, or a runtime that never created the
|
||||
* MXAccess COM object). Diagnostic only: the gateway logs it and shows it on the
|
||||
* dashboard, and never gates readiness on it, because the pin is a cache warm-up.
|
||||
* </pre>
|
||||
*
|
||||
* <code>string record_info_pin_status = 5;</code>
|
||||
* @param value The bytes for recordInfoPinStatus to set.
|
||||
* @return This builder for chaining.
|
||||
*/
|
||||
public Builder setRecordInfoPinStatusBytes(
|
||||
com.google.protobuf.ByteString value) {
|
||||
if (value == null) { throw new NullPointerException(); }
|
||||
checkByteStringIsUtf8(value);
|
||||
recordInfoPinStatus_ = value;
|
||||
bitField0_ |= 0x00000010;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:mxaccess_worker.v1.WorkerReady)
|
||||
}
|
||||
|
||||
@@ -12698,60 +12927,61 @@ public final class MxaccessWorker extends com.google.protobuf.GeneratedFile {
|
||||
"ay_version\030\003 \001(\t\022\027\n\017max_frame_bytes\030\004 \001(" +
|
||||
"\r\"i\n\013WorkerHello\022\030\n\020protocol_version\030\001 \001" +
|
||||
"(\r\022\r\n\005nonce\030\002 \001(\t\022\031\n\021worker_process_id\030\003" +
|
||||
" \001(\005\022\026\n\016worker_version\030\004 \001(\t\"\216\001\n\013WorkerR" +
|
||||
" \001(\005\022\026\n\016worker_version\030\004 \001(\t\"\256\001\n\013WorkerR" +
|
||||
"eady\022\031\n\021worker_process_id\030\001 \001(\005\022\027\n\017mxacc" +
|
||||
"ess_progid\030\002 \001(\t\022\026\n\016mxaccess_clsid\030\003 \001(\t" +
|
||||
"\0223\n\017ready_timestamp\030\004 \001(\0132\032.google.proto" +
|
||||
"buf.Timestamp\"w\n\rWorkerCommand\022/\n\007comman" +
|
||||
"d\030\001 \001(\0132\036.mxaccess_gateway.v1.MxCommand\022" +
|
||||
"5\n\021enqueue_timestamp\030\002 \001(\0132\032.google.prot" +
|
||||
"obuf.Timestamp\"\201\001\n\022WorkerCommandReply\0222\n" +
|
||||
"\005reply\030\001 \001(\0132#.mxaccess_gateway.v1.MxCom" +
|
||||
"mandReply\0227\n\023completed_timestamp\030\002 \001(\0132\032" +
|
||||
".google.protobuf.Timestamp\"\036\n\014WorkerCanc" +
|
||||
"el\022\016\n\006reason\030\001 \001(\t\"Q\n\016WorkerShutdown\022/\n\014" +
|
||||
"grace_period\030\001 \001(\0132\031.google.protobuf.Dur" +
|
||||
"ation\022\016\n\006reason\030\002 \001(\t\"H\n\021WorkerShutdownA" +
|
||||
"ck\0223\n\006status\030\001 \001(\0132#.mxaccess_gateway.v1" +
|
||||
".ProtocolStatus\":\n\013WorkerEvent\022+\n\005event\030" +
|
||||
"\001 \001(\0132\034.mxaccess_gateway.v1.MxEvent\"\245\002\n\017" +
|
||||
"WorkerHeartbeat\022\031\n\021worker_process_id\030\001 \001" +
|
||||
"(\005\022.\n\005state\030\002 \001(\0162\037.mxaccess_worker.v1.W" +
|
||||
"orkerState\022?\n\033last_sta_activity_timestam" +
|
||||
"p\030\003 \001(\0132\032.google.protobuf.Timestamp\022\035\n\025p" +
|
||||
"ending_command_count\030\004 \001(\r\022\"\n\032outbound_e" +
|
||||
"vent_queue_depth\030\005 \001(\r\022\033\n\023last_event_seq" +
|
||||
"uence\030\006 \001(\004\022&\n\036current_command_correlati" +
|
||||
"on_id\030\007 \001(\t\"\364\001\n\013WorkerFault\0229\n\010category\030" +
|
||||
"\001 \001(\0162\'.mxaccess_worker.v1.WorkerFaultCa" +
|
||||
"tegory\022\026\n\016command_method\030\002 \001(\t\022\024\n\007hresul" +
|
||||
"t\030\003 \001(\005H\000\210\001\001\022\026\n\016exception_type\030\004 \001(\t\022\032\n\022" +
|
||||
"diagnostic_message\030\005 \001(\t\022<\n\017protocol_sta" +
|
||||
"tus\030\006 \001(\0132#.mxaccess_gateway.v1.Protocol" +
|
||||
"StatusB\n\n\010_hresult*\227\002\n\013WorkerState\022\034\n\030WO" +
|
||||
"RKER_STATE_UNSPECIFIED\020\000\022\031\n\025WORKER_STATE" +
|
||||
"_STARTING\020\001\022\034\n\030WORKER_STATE_HANDSHAKING\020" +
|
||||
"\002\022!\n\035WORKER_STATE_INITIALIZING_STA\020\003\022\026\n\022" +
|
||||
"WORKER_STATE_READY\020\004\022\"\n\036WORKER_STATE_EXE" +
|
||||
"CUTING_COMMAND\020\005\022\036\n\032WORKER_STATE_SHUTTIN" +
|
||||
"G_DOWN\020\006\022\030\n\024WORKER_STATE_STOPPED\020\007\022\030\n\024WO" +
|
||||
"RKER_STATE_FAULTED\020\010*\307\004\n\023WorkerFaultCate" +
|
||||
"gory\022%\n!WORKER_FAULT_CATEGORY_UNSPECIFIE" +
|
||||
"D\020\000\022+\n\'WORKER_FAULT_CATEGORY_INVALID_ARG" +
|
||||
"UMENTS\020\001\0227\n3WORKER_FAULT_CATEGORY_GATEWA" +
|
||||
"Y_AUTHENTICATION_FAILED\020\002\022+\n\'WORKER_FAUL" +
|
||||
"T_CATEGORY_PROTOCOL_MISMATCH\020\003\022,\n(WORKER" +
|
||||
"_FAULT_CATEGORY_PROTOCOL_VIOLATION\020\004\022+\n\'" +
|
||||
"WORKER_FAULT_CATEGORY_PIPE_DISCONNECTED\020" +
|
||||
"\005\0222\n.WORKER_FAULT_CATEGORY_MXACCESS_CREA" +
|
||||
"TION_FAILED\020\006\0221\n-WORKER_FAULT_CATEGORY_M" +
|
||||
"XACCESS_COMMAND_FAILED\020\007\022:\n6WORKER_FAULT" +
|
||||
"_CATEGORY_MXACCESS_EVENT_CONVERSION_FAIL" +
|
||||
"ED\020\010\022\"\n\036WORKER_FAULT_CATEGORY_STA_HUNG\020\t" +
|
||||
"\022(\n$WORKER_FAULT_CATEGORY_QUEUE_OVERFLOW" +
|
||||
"\020\n\022*\n&WORKER_FAULT_CATEGORY_SHUTDOWN_TIM" +
|
||||
"EOUT\020\013B&\252\002#ZB.MOM.WW.MxGateway.Contracts" +
|
||||
".Protob\006proto3"
|
||||
"buf.Timestamp\022\036\n\026record_info_pin_status\030" +
|
||||
"\005 \001(\t\"w\n\rWorkerCommand\022/\n\007command\030\001 \001(\0132" +
|
||||
"\036.mxaccess_gateway.v1.MxCommand\0225\n\021enque" +
|
||||
"ue_timestamp\030\002 \001(\0132\032.google.protobuf.Tim" +
|
||||
"estamp\"\201\001\n\022WorkerCommandReply\0222\n\005reply\030\001" +
|
||||
" \001(\0132#.mxaccess_gateway.v1.MxCommandRepl" +
|
||||
"y\0227\n\023completed_timestamp\030\002 \001(\0132\032.google." +
|
||||
"protobuf.Timestamp\"\036\n\014WorkerCancel\022\016\n\006re" +
|
||||
"ason\030\001 \001(\t\"Q\n\016WorkerShutdown\022/\n\014grace_pe" +
|
||||
"riod\030\001 \001(\0132\031.google.protobuf.Duration\022\016\n" +
|
||||
"\006reason\030\002 \001(\t\"H\n\021WorkerShutdownAck\0223\n\006st" +
|
||||
"atus\030\001 \001(\0132#.mxaccess_gateway.v1.Protoco" +
|
||||
"lStatus\":\n\013WorkerEvent\022+\n\005event\030\001 \001(\0132\034." +
|
||||
"mxaccess_gateway.v1.MxEvent\"\245\002\n\017WorkerHe" +
|
||||
"artbeat\022\031\n\021worker_process_id\030\001 \001(\005\022.\n\005st" +
|
||||
"ate\030\002 \001(\0162\037.mxaccess_worker.v1.WorkerSta" +
|
||||
"te\022?\n\033last_sta_activity_timestamp\030\003 \001(\0132" +
|
||||
"\032.google.protobuf.Timestamp\022\035\n\025pending_c" +
|
||||
"ommand_count\030\004 \001(\r\022\"\n\032outbound_event_que" +
|
||||
"ue_depth\030\005 \001(\r\022\033\n\023last_event_sequence\030\006 " +
|
||||
"\001(\004\022&\n\036current_command_correlation_id\030\007 " +
|
||||
"\001(\t\"\364\001\n\013WorkerFault\0229\n\010category\030\001 \001(\0162\'." +
|
||||
"mxaccess_worker.v1.WorkerFaultCategory\022\026" +
|
||||
"\n\016command_method\030\002 \001(\t\022\024\n\007hresult\030\003 \001(\005H" +
|
||||
"\000\210\001\001\022\026\n\016exception_type\030\004 \001(\t\022\032\n\022diagnost" +
|
||||
"ic_message\030\005 \001(\t\022<\n\017protocol_status\030\006 \001(" +
|
||||
"\0132#.mxaccess_gateway.v1.ProtocolStatusB\n" +
|
||||
"\n\010_hresult*\227\002\n\013WorkerState\022\034\n\030WORKER_STA" +
|
||||
"TE_UNSPECIFIED\020\000\022\031\n\025WORKER_STATE_STARTIN" +
|
||||
"G\020\001\022\034\n\030WORKER_STATE_HANDSHAKING\020\002\022!\n\035WOR" +
|
||||
"KER_STATE_INITIALIZING_STA\020\003\022\026\n\022WORKER_S" +
|
||||
"TATE_READY\020\004\022\"\n\036WORKER_STATE_EXECUTING_C" +
|
||||
"OMMAND\020\005\022\036\n\032WORKER_STATE_SHUTTING_DOWN\020\006" +
|
||||
"\022\030\n\024WORKER_STATE_STOPPED\020\007\022\030\n\024WORKER_STA" +
|
||||
"TE_FAULTED\020\010*\307\004\n\023WorkerFaultCategory\022%\n!" +
|
||||
"WORKER_FAULT_CATEGORY_UNSPECIFIED\020\000\022+\n\'W" +
|
||||
"ORKER_FAULT_CATEGORY_INVALID_ARGUMENTS\020\001" +
|
||||
"\0227\n3WORKER_FAULT_CATEGORY_GATEWAY_AUTHEN" +
|
||||
"TICATION_FAILED\020\002\022+\n\'WORKER_FAULT_CATEGO" +
|
||||
"RY_PROTOCOL_MISMATCH\020\003\022,\n(WORKER_FAULT_C" +
|
||||
"ATEGORY_PROTOCOL_VIOLATION\020\004\022+\n\'WORKER_F" +
|
||||
"AULT_CATEGORY_PIPE_DISCONNECTED\020\005\0222\n.WOR" +
|
||||
"KER_FAULT_CATEGORY_MXACCESS_CREATION_FAI" +
|
||||
"LED\020\006\0221\n-WORKER_FAULT_CATEGORY_MXACCESS_" +
|
||||
"COMMAND_FAILED\020\007\022:\n6WORKER_FAULT_CATEGOR" +
|
||||
"Y_MXACCESS_EVENT_CONVERSION_FAILED\020\010\022\"\n\036" +
|
||||
"WORKER_FAULT_CATEGORY_STA_HUNG\020\t\022(\n$WORK" +
|
||||
"ER_FAULT_CATEGORY_QUEUE_OVERFLOW\020\n\022*\n&WO" +
|
||||
"RKER_FAULT_CATEGORY_SHUTDOWN_TIMEOUT\020\013B&" +
|
||||
"\252\002#ZB.MOM.WW.MxGateway.Contracts.Protob\006" +
|
||||
"proto3"
|
||||
};
|
||||
descriptor = com.google.protobuf.Descriptors.FileDescriptor
|
||||
.internalBuildGeneratedFileFrom(descriptorData,
|
||||
@@ -12783,7 +13013,7 @@ public final class MxaccessWorker extends com.google.protobuf.GeneratedFile {
|
||||
internal_static_mxaccess_worker_v1_WorkerReady_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_mxaccess_worker_v1_WorkerReady_descriptor,
|
||||
new java.lang.String[] { "WorkerProcessId", "MxaccessProgid", "MxaccessClsid", "ReadyTimestamp", });
|
||||
new java.lang.String[] { "WorkerProcessId", "MxaccessProgid", "MxaccessClsid", "ReadyTimestamp", "RecordInfoPinStatus", });
|
||||
internal_static_mxaccess_worker_v1_WorkerCommand_descriptor =
|
||||
getDescriptor().getMessageType(4);
|
||||
internal_static_mxaccess_worker_v1_WorkerCommand_fieldAccessorTable = new
|
||||
|
||||
Binary file not shown.
@@ -27,7 +27,7 @@ from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__
|
||||
import mxaccess_gateway_pb2 as mxaccess__gateway__pb2
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15mxaccess_worker.proto\x12\x12mxaccess_worker.v1\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x16mxaccess_gateway.proto\"\x95\x06\n\x0eWorkerEnvelope\x12\x18\n\x10protocol_version\x18\x01 \x01(\r\x12\x12\n\nsession_id\x18\x02 \x01(\t\x12\x10\n\x08sequence\x18\x03 \x01(\x04\x12\x16\n\x0e\x63orrelation_id\x18\x04 \x01(\t\x12\x39\n\rgateway_hello\x18\n \x01(\x0b\x32 .mxaccess_worker.v1.GatewayHelloH\x00\x12\x37\n\x0cworker_hello\x18\x0b \x01(\x0b\x32\x1f.mxaccess_worker.v1.WorkerHelloH\x00\x12\x37\n\x0cworker_ready\x18\x0c \x01(\x0b\x32\x1f.mxaccess_worker.v1.WorkerReadyH\x00\x12;\n\x0eworker_command\x18\r \x01(\x0b\x32!.mxaccess_worker.v1.WorkerCommandH\x00\x12\x46\n\x14worker_command_reply\x18\x0e \x01(\x0b\x32&.mxaccess_worker.v1.WorkerCommandReplyH\x00\x12\x39\n\rworker_cancel\x18\x0f \x01(\x0b\x32 .mxaccess_worker.v1.WorkerCancelH\x00\x12=\n\x0fworker_shutdown\x18\x10 \x01(\x0b\x32\".mxaccess_worker.v1.WorkerShutdownH\x00\x12\x44\n\x13worker_shutdown_ack\x18\x11 \x01(\x0b\x32%.mxaccess_worker.v1.WorkerShutdownAckH\x00\x12\x37\n\x0cworker_event\x18\x12 \x01(\x0b\x32\x1f.mxaccess_worker.v1.WorkerEventH\x00\x12?\n\x10worker_heartbeat\x18\x13 \x01(\x0b\x32#.mxaccess_worker.v1.WorkerHeartbeatH\x00\x12\x37\n\x0cworker_fault\x18\x14 \x01(\x0b\x32\x1f.mxaccess_worker.v1.WorkerFaultH\x00\x42\x06\n\x04\x62ody\"s\n\x0cGatewayHello\x12\"\n\x1asupported_protocol_version\x18\x01 \x01(\r\x12\r\n\x05nonce\x18\x02 \x01(\t\x12\x17\n\x0fgateway_version\x18\x03 \x01(\t\x12\x17\n\x0fmax_frame_bytes\x18\x04 \x01(\r\"i\n\x0bWorkerHello\x12\x18\n\x10protocol_version\x18\x01 \x01(\r\x12\r\n\x05nonce\x18\x02 \x01(\t\x12\x19\n\x11worker_process_id\x18\x03 \x01(\x05\x12\x16\n\x0eworker_version\x18\x04 \x01(\t\"\x8e\x01\n\x0bWorkerReady\x12\x19\n\x11worker_process_id\x18\x01 \x01(\x05\x12\x17\n\x0fmxaccess_progid\x18\x02 \x01(\t\x12\x16\n\x0emxaccess_clsid\x18\x03 \x01(\t\x12\x33\n\x0fready_timestamp\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"w\n\rWorkerCommand\x12/\n\x07\x63ommand\x18\x01 \x01(\x0b\x32\x1e.mxaccess_gateway.v1.MxCommand\x12\x35\n\x11\x65nqueue_timestamp\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\x81\x01\n\x12WorkerCommandReply\x12\x32\n\x05reply\x18\x01 \x01(\x0b\x32#.mxaccess_gateway.v1.MxCommandReply\x12\x37\n\x13\x63ompleted_timestamp\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\x1e\n\x0cWorkerCancel\x12\x0e\n\x06reason\x18\x01 \x01(\t\"Q\n\x0eWorkerShutdown\x12/\n\x0cgrace_period\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x0e\n\x06reason\x18\x02 \x01(\t\"H\n\x11WorkerShutdownAck\x12\x33\n\x06status\x18\x01 \x01(\x0b\x32#.mxaccess_gateway.v1.ProtocolStatus\":\n\x0bWorkerEvent\x12+\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x1c.mxaccess_gateway.v1.MxEvent\"\xa5\x02\n\x0fWorkerHeartbeat\x12\x19\n\x11worker_process_id\x18\x01 \x01(\x05\x12.\n\x05state\x18\x02 \x01(\x0e\x32\x1f.mxaccess_worker.v1.WorkerState\x12?\n\x1blast_sta_activity_timestamp\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1d\n\x15pending_command_count\x18\x04 \x01(\r\x12\"\n\x1aoutbound_event_queue_depth\x18\x05 \x01(\r\x12\x1b\n\x13last_event_sequence\x18\x06 \x01(\x04\x12&\n\x1e\x63urrent_command_correlation_id\x18\x07 \x01(\t\"\xf4\x01\n\x0bWorkerFault\x12\x39\n\x08\x63\x61tegory\x18\x01 \x01(\x0e\x32\'.mxaccess_worker.v1.WorkerFaultCategory\x12\x16\n\x0e\x63ommand_method\x18\x02 \x01(\t\x12\x14\n\x07hresult\x18\x03 \x01(\x05H\x00\x88\x01\x01\x12\x16\n\x0e\x65xception_type\x18\x04 \x01(\t\x12\x1a\n\x12\x64iagnostic_message\x18\x05 \x01(\t\x12<\n\x0fprotocol_status\x18\x06 \x01(\x0b\x32#.mxaccess_gateway.v1.ProtocolStatusB\n\n\x08_hresult*\x97\x02\n\x0bWorkerState\x12\x1c\n\x18WORKER_STATE_UNSPECIFIED\x10\x00\x12\x19\n\x15WORKER_STATE_STARTING\x10\x01\x12\x1c\n\x18WORKER_STATE_HANDSHAKING\x10\x02\x12!\n\x1dWORKER_STATE_INITIALIZING_STA\x10\x03\x12\x16\n\x12WORKER_STATE_READY\x10\x04\x12\"\n\x1eWORKER_STATE_EXECUTING_COMMAND\x10\x05\x12\x1e\n\x1aWORKER_STATE_SHUTTING_DOWN\x10\x06\x12\x18\n\x14WORKER_STATE_STOPPED\x10\x07\x12\x18\n\x14WORKER_STATE_FAULTED\x10\x08*\xc7\x04\n\x13WorkerFaultCategory\x12%\n!WORKER_FAULT_CATEGORY_UNSPECIFIED\x10\x00\x12+\n\'WORKER_FAULT_CATEGORY_INVALID_ARGUMENTS\x10\x01\x12\x37\n3WORKER_FAULT_CATEGORY_GATEWAY_AUTHENTICATION_FAILED\x10\x02\x12+\n\'WORKER_FAULT_CATEGORY_PROTOCOL_MISMATCH\x10\x03\x12,\n(WORKER_FAULT_CATEGORY_PROTOCOL_VIOLATION\x10\x04\x12+\n\'WORKER_FAULT_CATEGORY_PIPE_DISCONNECTED\x10\x05\x12\x32\n.WORKER_FAULT_CATEGORY_MXACCESS_CREATION_FAILED\x10\x06\x12\x31\n-WORKER_FAULT_CATEGORY_MXACCESS_COMMAND_FAILED\x10\x07\x12:\n6WORKER_FAULT_CATEGORY_MXACCESS_EVENT_CONVERSION_FAILED\x10\x08\x12\"\n\x1eWORKER_FAULT_CATEGORY_STA_HUNG\x10\t\x12(\n$WORKER_FAULT_CATEGORY_QUEUE_OVERFLOW\x10\n\x12*\n&WORKER_FAULT_CATEGORY_SHUTDOWN_TIMEOUT\x10\x0b\x42&\xaa\x02#ZB.MOM.WW.MxGateway.Contracts.Protob\x06proto3')
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15mxaccess_worker.proto\x12\x12mxaccess_worker.v1\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x16mxaccess_gateway.proto\"\x95\x06\n\x0eWorkerEnvelope\x12\x18\n\x10protocol_version\x18\x01 \x01(\r\x12\x12\n\nsession_id\x18\x02 \x01(\t\x12\x10\n\x08sequence\x18\x03 \x01(\x04\x12\x16\n\x0e\x63orrelation_id\x18\x04 \x01(\t\x12\x39\n\rgateway_hello\x18\n \x01(\x0b\x32 .mxaccess_worker.v1.GatewayHelloH\x00\x12\x37\n\x0cworker_hello\x18\x0b \x01(\x0b\x32\x1f.mxaccess_worker.v1.WorkerHelloH\x00\x12\x37\n\x0cworker_ready\x18\x0c \x01(\x0b\x32\x1f.mxaccess_worker.v1.WorkerReadyH\x00\x12;\n\x0eworker_command\x18\r \x01(\x0b\x32!.mxaccess_worker.v1.WorkerCommandH\x00\x12\x46\n\x14worker_command_reply\x18\x0e \x01(\x0b\x32&.mxaccess_worker.v1.WorkerCommandReplyH\x00\x12\x39\n\rworker_cancel\x18\x0f \x01(\x0b\x32 .mxaccess_worker.v1.WorkerCancelH\x00\x12=\n\x0fworker_shutdown\x18\x10 \x01(\x0b\x32\".mxaccess_worker.v1.WorkerShutdownH\x00\x12\x44\n\x13worker_shutdown_ack\x18\x11 \x01(\x0b\x32%.mxaccess_worker.v1.WorkerShutdownAckH\x00\x12\x37\n\x0cworker_event\x18\x12 \x01(\x0b\x32\x1f.mxaccess_worker.v1.WorkerEventH\x00\x12?\n\x10worker_heartbeat\x18\x13 \x01(\x0b\x32#.mxaccess_worker.v1.WorkerHeartbeatH\x00\x12\x37\n\x0cworker_fault\x18\x14 \x01(\x0b\x32\x1f.mxaccess_worker.v1.WorkerFaultH\x00\x42\x06\n\x04\x62ody\"s\n\x0cGatewayHello\x12\"\n\x1asupported_protocol_version\x18\x01 \x01(\r\x12\r\n\x05nonce\x18\x02 \x01(\t\x12\x17\n\x0fgateway_version\x18\x03 \x01(\t\x12\x17\n\x0fmax_frame_bytes\x18\x04 \x01(\r\"i\n\x0bWorkerHello\x12\x18\n\x10protocol_version\x18\x01 \x01(\r\x12\r\n\x05nonce\x18\x02 \x01(\t\x12\x19\n\x11worker_process_id\x18\x03 \x01(\x05\x12\x16\n\x0eworker_version\x18\x04 \x01(\t\"\xae\x01\n\x0bWorkerReady\x12\x19\n\x11worker_process_id\x18\x01 \x01(\x05\x12\x17\n\x0fmxaccess_progid\x18\x02 \x01(\t\x12\x16\n\x0emxaccess_clsid\x18\x03 \x01(\t\x12\x33\n\x0fready_timestamp\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1e\n\x16record_info_pin_status\x18\x05 \x01(\t\"w\n\rWorkerCommand\x12/\n\x07\x63ommand\x18\x01 \x01(\x0b\x32\x1e.mxaccess_gateway.v1.MxCommand\x12\x35\n\x11\x65nqueue_timestamp\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\x81\x01\n\x12WorkerCommandReply\x12\x32\n\x05reply\x18\x01 \x01(\x0b\x32#.mxaccess_gateway.v1.MxCommandReply\x12\x37\n\x13\x63ompleted_timestamp\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\x1e\n\x0cWorkerCancel\x12\x0e\n\x06reason\x18\x01 \x01(\t\"Q\n\x0eWorkerShutdown\x12/\n\x0cgrace_period\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x0e\n\x06reason\x18\x02 \x01(\t\"H\n\x11WorkerShutdownAck\x12\x33\n\x06status\x18\x01 \x01(\x0b\x32#.mxaccess_gateway.v1.ProtocolStatus\":\n\x0bWorkerEvent\x12+\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x1c.mxaccess_gateway.v1.MxEvent\"\xa5\x02\n\x0fWorkerHeartbeat\x12\x19\n\x11worker_process_id\x18\x01 \x01(\x05\x12.\n\x05state\x18\x02 \x01(\x0e\x32\x1f.mxaccess_worker.v1.WorkerState\x12?\n\x1blast_sta_activity_timestamp\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1d\n\x15pending_command_count\x18\x04 \x01(\r\x12\"\n\x1aoutbound_event_queue_depth\x18\x05 \x01(\r\x12\x1b\n\x13last_event_sequence\x18\x06 \x01(\x04\x12&\n\x1e\x63urrent_command_correlation_id\x18\x07 \x01(\t\"\xf4\x01\n\x0bWorkerFault\x12\x39\n\x08\x63\x61tegory\x18\x01 \x01(\x0e\x32\'.mxaccess_worker.v1.WorkerFaultCategory\x12\x16\n\x0e\x63ommand_method\x18\x02 \x01(\t\x12\x14\n\x07hresult\x18\x03 \x01(\x05H\x00\x88\x01\x01\x12\x16\n\x0e\x65xception_type\x18\x04 \x01(\t\x12\x1a\n\x12\x64iagnostic_message\x18\x05 \x01(\t\x12<\n\x0fprotocol_status\x18\x06 \x01(\x0b\x32#.mxaccess_gateway.v1.ProtocolStatusB\n\n\x08_hresult*\x97\x02\n\x0bWorkerState\x12\x1c\n\x18WORKER_STATE_UNSPECIFIED\x10\x00\x12\x19\n\x15WORKER_STATE_STARTING\x10\x01\x12\x1c\n\x18WORKER_STATE_HANDSHAKING\x10\x02\x12!\n\x1dWORKER_STATE_INITIALIZING_STA\x10\x03\x12\x16\n\x12WORKER_STATE_READY\x10\x04\x12\"\n\x1eWORKER_STATE_EXECUTING_COMMAND\x10\x05\x12\x1e\n\x1aWORKER_STATE_SHUTTING_DOWN\x10\x06\x12\x18\n\x14WORKER_STATE_STOPPED\x10\x07\x12\x18\n\x14WORKER_STATE_FAULTED\x10\x08*\xc7\x04\n\x13WorkerFaultCategory\x12%\n!WORKER_FAULT_CATEGORY_UNSPECIFIED\x10\x00\x12+\n\'WORKER_FAULT_CATEGORY_INVALID_ARGUMENTS\x10\x01\x12\x37\n3WORKER_FAULT_CATEGORY_GATEWAY_AUTHENTICATION_FAILED\x10\x02\x12+\n\'WORKER_FAULT_CATEGORY_PROTOCOL_MISMATCH\x10\x03\x12,\n(WORKER_FAULT_CATEGORY_PROTOCOL_VIOLATION\x10\x04\x12+\n\'WORKER_FAULT_CATEGORY_PIPE_DISCONNECTED\x10\x05\x12\x32\n.WORKER_FAULT_CATEGORY_MXACCESS_CREATION_FAILED\x10\x06\x12\x31\n-WORKER_FAULT_CATEGORY_MXACCESS_COMMAND_FAILED\x10\x07\x12:\n6WORKER_FAULT_CATEGORY_MXACCESS_EVENT_CONVERSION_FAILED\x10\x08\x12\"\n\x1eWORKER_FAULT_CATEGORY_STA_HUNG\x10\t\x12(\n$WORKER_FAULT_CATEGORY_QUEUE_OVERFLOW\x10\n\x12*\n&WORKER_FAULT_CATEGORY_SHUTDOWN_TIMEOUT\x10\x0b\x42&\xaa\x02#ZB.MOM.WW.MxGateway.Contracts.Protob\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
@@ -35,10 +35,10 @@ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'mxaccess_worker_pb2', _glob
|
||||
if not _descriptor._USE_C_DESCRIPTORS:
|
||||
_globals['DESCRIPTOR']._loaded_options = None
|
||||
_globals['DESCRIPTOR']._serialized_options = b'\252\002#ZB.MOM.WW.MxGateway.Contracts.Proto'
|
||||
_globals['_WORKERSTATE']._serialized_start=2341
|
||||
_globals['_WORKERSTATE']._serialized_end=2620
|
||||
_globals['_WORKERFAULTCATEGORY']._serialized_start=2623
|
||||
_globals['_WORKERFAULTCATEGORY']._serialized_end=3206
|
||||
_globals['_WORKERSTATE']._serialized_start=2373
|
||||
_globals['_WORKERSTATE']._serialized_end=2652
|
||||
_globals['_WORKERFAULTCATEGORY']._serialized_start=2655
|
||||
_globals['_WORKERFAULTCATEGORY']._serialized_end=3238
|
||||
_globals['_WORKERENVELOPE']._serialized_start=135
|
||||
_globals['_WORKERENVELOPE']._serialized_end=924
|
||||
_globals['_GATEWAYHELLO']._serialized_start=926
|
||||
@@ -46,21 +46,21 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
||||
_globals['_WORKERHELLO']._serialized_start=1043
|
||||
_globals['_WORKERHELLO']._serialized_end=1148
|
||||
_globals['_WORKERREADY']._serialized_start=1151
|
||||
_globals['_WORKERREADY']._serialized_end=1293
|
||||
_globals['_WORKERCOMMAND']._serialized_start=1295
|
||||
_globals['_WORKERCOMMAND']._serialized_end=1414
|
||||
_globals['_WORKERCOMMANDREPLY']._serialized_start=1417
|
||||
_globals['_WORKERCOMMANDREPLY']._serialized_end=1546
|
||||
_globals['_WORKERCANCEL']._serialized_start=1548
|
||||
_globals['_WORKERCANCEL']._serialized_end=1578
|
||||
_globals['_WORKERSHUTDOWN']._serialized_start=1580
|
||||
_globals['_WORKERSHUTDOWN']._serialized_end=1661
|
||||
_globals['_WORKERSHUTDOWNACK']._serialized_start=1663
|
||||
_globals['_WORKERSHUTDOWNACK']._serialized_end=1735
|
||||
_globals['_WORKEREVENT']._serialized_start=1737
|
||||
_globals['_WORKEREVENT']._serialized_end=1795
|
||||
_globals['_WORKERHEARTBEAT']._serialized_start=1798
|
||||
_globals['_WORKERHEARTBEAT']._serialized_end=2091
|
||||
_globals['_WORKERFAULT']._serialized_start=2094
|
||||
_globals['_WORKERFAULT']._serialized_end=2338
|
||||
_globals['_WORKERREADY']._serialized_end=1325
|
||||
_globals['_WORKERCOMMAND']._serialized_start=1327
|
||||
_globals['_WORKERCOMMAND']._serialized_end=1446
|
||||
_globals['_WORKERCOMMANDREPLY']._serialized_start=1449
|
||||
_globals['_WORKERCOMMANDREPLY']._serialized_end=1578
|
||||
_globals['_WORKERCANCEL']._serialized_start=1580
|
||||
_globals['_WORKERCANCEL']._serialized_end=1610
|
||||
_globals['_WORKERSHUTDOWN']._serialized_start=1612
|
||||
_globals['_WORKERSHUTDOWN']._serialized_end=1693
|
||||
_globals['_WORKERSHUTDOWNACK']._serialized_start=1695
|
||||
_globals['_WORKERSHUTDOWNACK']._serialized_end=1767
|
||||
_globals['_WORKEREVENT']._serialized_start=1769
|
||||
_globals['_WORKEREVENT']._serialized_end=1827
|
||||
_globals['_WORKERHEARTBEAT']._serialized_start=1830
|
||||
_globals['_WORKERHEARTBEAT']._serialized_end=2123
|
||||
_globals['_WORKERFAULT']._serialized_start=2126
|
||||
_globals['_WORKERFAULT']._serialized_end=2370
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
|
||||
@@ -65,6 +65,13 @@ message WorkerReady {
|
||||
string mxaccess_progid = 2;
|
||||
string mxaccess_clsid = 3;
|
||||
google.protobuf.Timestamp ready_timestamp = 4;
|
||||
// Outcome of the worker's process-wide MXSTATUS_PROXY record-info pin
|
||||
// (MxStatusProxyRecordInfoPin): "pinned {library-guid} vM.m record {record-guid}" on
|
||||
// success, or the failing call and HRESULT / exception type otherwise. Empty when the
|
||||
// worker made no attempt (an older worker, or a runtime that never created the
|
||||
// MXAccess COM object). Diagnostic only: the gateway logs it and shows it on the
|
||||
// dashboard, and never gates readiness on it, because the pin is a cache warm-up.
|
||||
string record_info_pin_status = 5;
|
||||
}
|
||||
|
||||
message WorkerCommand {
|
||||
@@ -127,6 +134,10 @@ enum WorkerState {
|
||||
|
||||
enum WorkerFaultCategory {
|
||||
WORKER_FAULT_CATEGORY_UNSPECIFIED = 0;
|
||||
// Values 1 and 2 are reserved: never emitted. Bootstrap failures (bad
|
||||
// arguments, gateway authentication) exit via WorkerExitCode before the pipe
|
||||
// exists, so there is no channel to carry a fault. Names kept so the numbers
|
||||
// are not reused.
|
||||
WORKER_FAULT_CATEGORY_INVALID_ARGUMENTS = 1;
|
||||
WORKER_FAULT_CATEGORY_GATEWAY_AUTHENTICATION_FAILED = 2;
|
||||
WORKER_FAULT_CATEGORY_PROTOCOL_MISMATCH = 3;
|
||||
|
||||
@@ -482,7 +482,9 @@ Shows:
|
||||
- a session section: state badge, backend, client identity, client session name,
|
||||
client correlation id (all redacted), open time, last activity, lease expiry,
|
||||
events received, and last fault;
|
||||
- a worker section: process id, worker state, and last heartbeat time;
|
||||
- a worker section: process id, worker state, last heartbeat time, and the
|
||||
worker's `MXSTATUS_PROXY` record-info pin outcome from `WorkerReady` (`-` for an
|
||||
older worker that does not report it);
|
||||
- a "Recent events" table — the newest 50 events from the in-process mirror, with
|
||||
worker sequence, family, server handle, item handle, and status (no values), plus
|
||||
a live/offline pill; gated by the session ACL, so a caller who may not observe the
|
||||
|
||||
@@ -507,6 +507,15 @@ and nonce, waits for `WorkerReady`, and only then exposes `Ready` state. The
|
||||
read loop starts after readiness so the handshake has a single owner for its
|
||||
ordered frames.
|
||||
|
||||
`WorkerReady.record_info_pin_status` carries the worker's `MXSTATUS_PROXY`
|
||||
record-info pin outcome (see `MxAccessWorkerInstanceDesign.md`). The gateway does
|
||||
not capture worker stderr, so `WorkerClient` is where operators see it: a status
|
||||
starting `pinned ` is logged at Information, anything else at Warning, because an
|
||||
unpinned worker pays a type-library reload on every data change. It is kept as
|
||||
`IWorkerClient.RecordInfoPinStatus` and shown on the dashboard's session details
|
||||
page. It never gates readiness, and an empty status (an older worker) is neither
|
||||
logged nor shown.
|
||||
|
||||
### Read loop
|
||||
|
||||
The read loop:
|
||||
|
||||
@@ -500,10 +500,12 @@ microsecond. Measured at ~240 events/s on the dev box, worker CPU fell from 67%
|
||||
with the pin alone.
|
||||
|
||||
The pin only warms a cache. It changes no MXAccess behaviour, and a failure is never fatal. The
|
||||
outcome is in `MxStatusProxyRecordInfoPin.Status`, and the worker logs it as `WorkerRecordInfoPin`
|
||||
just before `WorkerReady`. Worker logs go to stderr, which the gateway does not redirect, so the
|
||||
line lands wherever the host captures the gateway's stderr (the NSSM stderr log on deployed
|
||||
boxes).
|
||||
outcome is in `MxStatusProxyRecordInfoPin.Status`. During the handshake `WorkerPipeSession` logs it
|
||||
as `WorkerRecordInfoPin` and copies it into `WorkerReady.record_info_pin_status`, unless the runtime
|
||||
already filled that field. The copy is the one operators see: the worker's own log goes to stderr,
|
||||
which the gateway's launcher does not redirect. The gateway logs the reported status (Warning when
|
||||
it is not a successful pin) and shows it on the dashboard's session details page; see
|
||||
`GatewayProcessDesign.md`.
|
||||
|
||||
If COM creation fails, the worker should send a structured fault with:
|
||||
|
||||
@@ -602,7 +604,9 @@ CLR thread pool:
|
||||
- It blocks on the frame writer's batch write.
|
||||
- `RunEventDrainLoopAsync` starts the thread and returns a task that completes,
|
||||
faults or cancels exactly as the loop does, so the message loop's `Task.WhenAny`
|
||||
supervision is unchanged.
|
||||
supervision is unchanged. Cancelling the session ends the task Canceled, which
|
||||
teardown treats as a clean stop; an exception thrown on the thread faults the task
|
||||
with that same exception, which ends `RunAsync` with it as the async loop did.
|
||||
|
||||
The reason is .NET Framework's thread pool. As an async loop, every enqueue's
|
||||
semaphore release queued a continuation to the pool, and each pool worker that ran
|
||||
|
||||
@@ -90,6 +90,12 @@ Protocol violations throw `WorkerFrameProtocolException` with a
|
||||
`WorkerFrameProtocolErrorCode` so callers can distinguish malformed frames,
|
||||
oversized frames, protocol version mismatches, and session mismatches.
|
||||
|
||||
Fields added to a body without a protocol version bump must be ones both ends can
|
||||
ignore. `WorkerReady.record_info_pin_status` (field 5) is the current example: it is
|
||||
diagnostic only, so a newer worker talking to an older gateway is simply not
|
||||
reported, and an older worker leaves it empty, which the gateway treats as "not
|
||||
reported". Neither end gates readiness on it.
|
||||
|
||||
## Write Scheduling And Sequencing
|
||||
|
||||
This section covers write scheduling (priority classes, enqueue-then-contend,
|
||||
|
||||
+31
-7
@@ -837,16 +837,30 @@ STA thread
|
||||
|
||||
MXAccess event handler on STA
|
||||
-> convert event args to WorkerEvent
|
||||
-> enqueue outbound event
|
||||
-> enqueue outbound event, signal the drain thread
|
||||
|
||||
pipe writer thread
|
||||
-> dequeue replies/events
|
||||
-> write framed protobuf messages
|
||||
event drain thread (mxgw-event-drain, dedicated, not thread pool)
|
||||
-> park on the event queue's wake signal
|
||||
-> drain a batch of WorkerEvents
|
||||
-> write them as one framed batch, flushed synchronously
|
||||
|
||||
command replies and heartbeats
|
||||
-> written through the same frame writer, which orders control frames
|
||||
ahead of queued events
|
||||
```
|
||||
|
||||
Do not block the STA on pipe writes or gRPC calls. The STA should enqueue
|
||||
results/events and return to pumping messages.
|
||||
|
||||
The event drain loop has its own background thread because of the .NET
|
||||
Framework thread pool. As an async loop, every event woke a pool worker, and
|
||||
each one spun before parking again; a production trace put that spin at about a
|
||||
quarter of the worker's CPU at ~240 events/s. The dedicated thread parks on the
|
||||
signal, and with a synchronous flush the steady-state event path queues no pool
|
||||
work. The drain loop's task still completes, faults or cancels exactly as the
|
||||
loop does, so the session's supervision of it is unchanged. See
|
||||
`docs/MxAccessWorkerInstanceDesign.md`.
|
||||
|
||||
### Message Pump
|
||||
|
||||
The STA loop must pump Windows messages and service command work. A typical
|
||||
@@ -878,9 +892,19 @@ Worker startup:
|
||||
|
||||
1. set apartment state to STA,
|
||||
2. initialize COM on the STA,
|
||||
3. instantiate `LMXProxyServerClass` or the installed MXAccess interop class,
|
||||
4. attach event handlers,
|
||||
5. send `WorkerReady`.
|
||||
3. pin the LMXProxy type library and the `MXSTATUS_PROXY` record info for the
|
||||
process lifetime (once per process, best effort),
|
||||
4. instantiate `LMXProxyServerClass` or the installed MXAccess interop class,
|
||||
5. attach event handlers,
|
||||
6. send `WorkerReady`, carrying the pin outcome in `record_info_pin_status`.
|
||||
|
||||
The pin exists because `lmxproxy.dll` looks up the `MXSTATUS_PROXY` record type
|
||||
for every `OnDataChange`. With no live reference to it, oleaut32 re-reads the
|
||||
registry and reloads the type library on each call, which a production trace put
|
||||
at about 70% of the STA's CPU. Holding one reference makes the lookup a cache
|
||||
hit. A failed pin is never fatal, since MXAccess behaves the same either way, but
|
||||
the gateway logs it as a warning and shows it on the dashboard's session details
|
||||
page, because the worker's own stderr is not captured.
|
||||
|
||||
Worker shutdown:
|
||||
|
||||
|
||||
@@ -49,61 +49,62 @@ namespace ZB.MOM.WW.MxGateway.Contracts.Proto {
|
||||
"CRIXCg9nYXRld2F5X3ZlcnNpb24YAyABKAkSFwoPbWF4X2ZyYW1lX2J5dGVz",
|
||||
"GAQgASgNImkKC1dvcmtlckhlbGxvEhgKEHByb3RvY29sX3ZlcnNpb24YASAB",
|
||||
"KA0SDQoFbm9uY2UYAiABKAkSGQoRd29ya2VyX3Byb2Nlc3NfaWQYAyABKAUS",
|
||||
"FgoOd29ya2VyX3ZlcnNpb24YBCABKAkijgEKC1dvcmtlclJlYWR5EhkKEXdv",
|
||||
"FgoOd29ya2VyX3ZlcnNpb24YBCABKAkirgEKC1dvcmtlclJlYWR5EhkKEXdv",
|
||||
"cmtlcl9wcm9jZXNzX2lkGAEgASgFEhcKD214YWNjZXNzX3Byb2dpZBgCIAEo",
|
||||
"CRIWCg5teGFjY2Vzc19jbHNpZBgDIAEoCRIzCg9yZWFkeV90aW1lc3RhbXAY",
|
||||
"BCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wIncKDVdvcmtlckNv",
|
||||
"bW1hbmQSLwoHY29tbWFuZBgBIAEoCzIeLm14YWNjZXNzX2dhdGV3YXkudjEu",
|
||||
"TXhDb21tYW5kEjUKEWVucXVldWVfdGltZXN0YW1wGAIgASgLMhouZ29vZ2xl",
|
||||
"LnByb3RvYnVmLlRpbWVzdGFtcCKBAQoSV29ya2VyQ29tbWFuZFJlcGx5EjIK",
|
||||
"BXJlcGx5GAEgASgLMiMubXhhY2Nlc3NfZ2F0ZXdheS52MS5NeENvbW1hbmRS",
|
||||
"ZXBseRI3ChNjb21wbGV0ZWRfdGltZXN0YW1wGAIgASgLMhouZ29vZ2xlLnBy",
|
||||
"b3RvYnVmLlRpbWVzdGFtcCIeCgxXb3JrZXJDYW5jZWwSDgoGcmVhc29uGAEg",
|
||||
"ASgJIlEKDldvcmtlclNodXRkb3duEi8KDGdyYWNlX3BlcmlvZBgBIAEoCzIZ",
|
||||
"Lmdvb2dsZS5wcm90b2J1Zi5EdXJhdGlvbhIOCgZyZWFzb24YAiABKAkiSAoR",
|
||||
"V29ya2VyU2h1dGRvd25BY2sSMwoGc3RhdHVzGAEgASgLMiMubXhhY2Nlc3Nf",
|
||||
"Z2F0ZXdheS52MS5Qcm90b2NvbFN0YXR1cyI6CgtXb3JrZXJFdmVudBIrCgVl",
|
||||
"dmVudBgBIAEoCzIcLm14YWNjZXNzX2dhdGV3YXkudjEuTXhFdmVudCKlAgoP",
|
||||
"V29ya2VySGVhcnRiZWF0EhkKEXdvcmtlcl9wcm9jZXNzX2lkGAEgASgFEi4K",
|
||||
"BXN0YXRlGAIgASgOMh8ubXhhY2Nlc3Nfd29ya2VyLnYxLldvcmtlclN0YXRl",
|
||||
"Ej8KG2xhc3Rfc3RhX2FjdGl2aXR5X3RpbWVzdGFtcBgDIAEoCzIaLmdvb2ds",
|
||||
"ZS5wcm90b2J1Zi5UaW1lc3RhbXASHQoVcGVuZGluZ19jb21tYW5kX2NvdW50",
|
||||
"GAQgASgNEiIKGm91dGJvdW5kX2V2ZW50X3F1ZXVlX2RlcHRoGAUgASgNEhsK",
|
||||
"E2xhc3RfZXZlbnRfc2VxdWVuY2UYBiABKAQSJgoeY3VycmVudF9jb21tYW5k",
|
||||
"X2NvcnJlbGF0aW9uX2lkGAcgASgJIvQBCgtXb3JrZXJGYXVsdBI5CghjYXRl",
|
||||
"Z29yeRgBIAEoDjInLm14YWNjZXNzX3dvcmtlci52MS5Xb3JrZXJGYXVsdENh",
|
||||
"dGVnb3J5EhYKDmNvbW1hbmRfbWV0aG9kGAIgASgJEhQKB2hyZXN1bHQYAyAB",
|
||||
"KAVIAIgBARIWCg5leGNlcHRpb25fdHlwZRgEIAEoCRIaChJkaWFnbm9zdGlj",
|
||||
"X21lc3NhZ2UYBSABKAkSPAoPcHJvdG9jb2xfc3RhdHVzGAYgASgLMiMubXhh",
|
||||
"Y2Nlc3NfZ2F0ZXdheS52MS5Qcm90b2NvbFN0YXR1c0IKCghfaHJlc3VsdCqX",
|
||||
"AgoLV29ya2VyU3RhdGUSHAoYV09SS0VSX1NUQVRFX1VOU1BFQ0lGSUVEEAAS",
|
||||
"GQoVV09SS0VSX1NUQVRFX1NUQVJUSU5HEAESHAoYV09SS0VSX1NUQVRFX0hB",
|
||||
"TkRTSEFLSU5HEAISIQodV09SS0VSX1NUQVRFX0lOSVRJQUxJWklOR19TVEEQ",
|
||||
"AxIWChJXT1JLRVJfU1RBVEVfUkVBRFkQBBIiCh5XT1JLRVJfU1RBVEVfRVhF",
|
||||
"Q1VUSU5HX0NPTU1BTkQQBRIeChpXT1JLRVJfU1RBVEVfU0hVVFRJTkdfRE9X",
|
||||
"ThAGEhgKFFdPUktFUl9TVEFURV9TVE9QUEVEEAcSGAoUV09SS0VSX1NUQVRF",
|
||||
"X0ZBVUxURUQQCCrHBAoTV29ya2VyRmF1bHRDYXRlZ29yeRIlCiFXT1JLRVJf",
|
||||
"RkFVTFRfQ0FURUdPUllfVU5TUEVDSUZJRUQQABIrCidXT1JLRVJfRkFVTFRf",
|
||||
"Q0FURUdPUllfSU5WQUxJRF9BUkdVTUVOVFMQARI3CjNXT1JLRVJfRkFVTFRf",
|
||||
"Q0FURUdPUllfR0FURVdBWV9BVVRIRU5USUNBVElPTl9GQUlMRUQQAhIrCidX",
|
||||
"T1JLRVJfRkFVTFRfQ0FURUdPUllfUFJPVE9DT0xfTUlTTUFUQ0gQAxIsCihX",
|
||||
"T1JLRVJfRkFVTFRfQ0FURUdPUllfUFJPVE9DT0xfVklPTEFUSU9OEAQSKwon",
|
||||
"V09SS0VSX0ZBVUxUX0NBVEVHT1JZX1BJUEVfRElTQ09OTkVDVEVEEAUSMgou",
|
||||
"V09SS0VSX0ZBVUxUX0NBVEVHT1JZX01YQUNDRVNTX0NSRUFUSU9OX0ZBSUxF",
|
||||
"RBAGEjEKLVdPUktFUl9GQVVMVF9DQVRFR09SWV9NWEFDQ0VTU19DT01NQU5E",
|
||||
"X0ZBSUxFRBAHEjoKNldPUktFUl9GQVVMVF9DQVRFR09SWV9NWEFDQ0VTU19F",
|
||||
"VkVOVF9DT05WRVJTSU9OX0ZBSUxFRBAIEiIKHldPUktFUl9GQVVMVF9DQVRF",
|
||||
"R09SWV9TVEFfSFVORxAJEigKJFdPUktFUl9GQVVMVF9DQVRFR09SWV9RVUVV",
|
||||
"RV9PVkVSRkxPVxAKEioKJldPUktFUl9GQVVMVF9DQVRFR09SWV9TSFVURE9X",
|
||||
"Tl9USU1FT1VUEAtCJqoCI1pCLk1PTS5XVy5NeEdhdGV3YXkuQ29udHJhY3Rz",
|
||||
"LlByb3RvYgZwcm90bzM="));
|
||||
"BCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEh4KFnJlY29yZF9p",
|
||||
"bmZvX3Bpbl9zdGF0dXMYBSABKAkidwoNV29ya2VyQ29tbWFuZBIvCgdjb21t",
|
||||
"YW5kGAEgASgLMh4ubXhhY2Nlc3NfZ2F0ZXdheS52MS5NeENvbW1hbmQSNQoR",
|
||||
"ZW5xdWV1ZV90aW1lc3RhbXAYAiABKAsyGi5nb29nbGUucHJvdG9idWYuVGlt",
|
||||
"ZXN0YW1wIoEBChJXb3JrZXJDb21tYW5kUmVwbHkSMgoFcmVwbHkYASABKAsy",
|
||||
"Iy5teGFjY2Vzc19nYXRld2F5LnYxLk14Q29tbWFuZFJlcGx5EjcKE2NvbXBs",
|
||||
"ZXRlZF90aW1lc3RhbXAYAiABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0",
|
||||
"YW1wIh4KDFdvcmtlckNhbmNlbBIOCgZyZWFzb24YASABKAkiUQoOV29ya2Vy",
|
||||
"U2h1dGRvd24SLwoMZ3JhY2VfcGVyaW9kGAEgASgLMhkuZ29vZ2xlLnByb3Rv",
|
||||
"YnVmLkR1cmF0aW9uEg4KBnJlYXNvbhgCIAEoCSJIChFXb3JrZXJTaHV0ZG93",
|
||||
"bkFjaxIzCgZzdGF0dXMYASABKAsyIy5teGFjY2Vzc19nYXRld2F5LnYxLlBy",
|
||||
"b3RvY29sU3RhdHVzIjoKC1dvcmtlckV2ZW50EisKBWV2ZW50GAEgASgLMhwu",
|
||||
"bXhhY2Nlc3NfZ2F0ZXdheS52MS5NeEV2ZW50IqUCCg9Xb3JrZXJIZWFydGJl",
|
||||
"YXQSGQoRd29ya2VyX3Byb2Nlc3NfaWQYASABKAUSLgoFc3RhdGUYAiABKA4y",
|
||||
"Hy5teGFjY2Vzc193b3JrZXIudjEuV29ya2VyU3RhdGUSPwobbGFzdF9zdGFf",
|
||||
"YWN0aXZpdHlfdGltZXN0YW1wGAMgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRp",
|
||||
"bWVzdGFtcBIdChVwZW5kaW5nX2NvbW1hbmRfY291bnQYBCABKA0SIgoab3V0",
|
||||
"Ym91bmRfZXZlbnRfcXVldWVfZGVwdGgYBSABKA0SGwoTbGFzdF9ldmVudF9z",
|
||||
"ZXF1ZW5jZRgGIAEoBBImCh5jdXJyZW50X2NvbW1hbmRfY29ycmVsYXRpb25f",
|
||||
"aWQYByABKAki9AEKC1dvcmtlckZhdWx0EjkKCGNhdGVnb3J5GAEgASgOMicu",
|
||||
"bXhhY2Nlc3Nfd29ya2VyLnYxLldvcmtlckZhdWx0Q2F0ZWdvcnkSFgoOY29t",
|
||||
"bWFuZF9tZXRob2QYAiABKAkSFAoHaHJlc3VsdBgDIAEoBUgAiAEBEhYKDmV4",
|
||||
"Y2VwdGlvbl90eXBlGAQgASgJEhoKEmRpYWdub3N0aWNfbWVzc2FnZRgFIAEo",
|
||||
"CRI8Cg9wcm90b2NvbF9zdGF0dXMYBiABKAsyIy5teGFjY2Vzc19nYXRld2F5",
|
||||
"LnYxLlByb3RvY29sU3RhdHVzQgoKCF9ocmVzdWx0KpcCCgtXb3JrZXJTdGF0",
|
||||
"ZRIcChhXT1JLRVJfU1RBVEVfVU5TUEVDSUZJRUQQABIZChVXT1JLRVJfU1RB",
|
||||
"VEVfU1RBUlRJTkcQARIcChhXT1JLRVJfU1RBVEVfSEFORFNIQUtJTkcQAhIh",
|
||||
"Ch1XT1JLRVJfU1RBVEVfSU5JVElBTElaSU5HX1NUQRADEhYKEldPUktFUl9T",
|
||||
"VEFURV9SRUFEWRAEEiIKHldPUktFUl9TVEFURV9FWEVDVVRJTkdfQ09NTUFO",
|
||||
"RBAFEh4KGldPUktFUl9TVEFURV9TSFVUVElOR19ET1dOEAYSGAoUV09SS0VS",
|
||||
"X1NUQVRFX1NUT1BQRUQQBxIYChRXT1JLRVJfU1RBVEVfRkFVTFRFRBAIKscE",
|
||||
"ChNXb3JrZXJGYXVsdENhdGVnb3J5EiUKIVdPUktFUl9GQVVMVF9DQVRFR09S",
|
||||
"WV9VTlNQRUNJRklFRBAAEisKJ1dPUktFUl9GQVVMVF9DQVRFR09SWV9JTlZB",
|
||||
"TElEX0FSR1VNRU5UUxABEjcKM1dPUktFUl9GQVVMVF9DQVRFR09SWV9HQVRF",
|
||||
"V0FZX0FVVEhFTlRJQ0FUSU9OX0ZBSUxFRBACEisKJ1dPUktFUl9GQVVMVF9D",
|
||||
"QVRFR09SWV9QUk9UT0NPTF9NSVNNQVRDSBADEiwKKFdPUktFUl9GQVVMVF9D",
|
||||
"QVRFR09SWV9QUk9UT0NPTF9WSU9MQVRJT04QBBIrCidXT1JLRVJfRkFVTFRf",
|
||||
"Q0FURUdPUllfUElQRV9ESVNDT05ORUNURUQQBRIyCi5XT1JLRVJfRkFVTFRf",
|
||||
"Q0FURUdPUllfTVhBQ0NFU1NfQ1JFQVRJT05fRkFJTEVEEAYSMQotV09SS0VS",
|
||||
"X0ZBVUxUX0NBVEVHT1JZX01YQUNDRVNTX0NPTU1BTkRfRkFJTEVEEAcSOgo2",
|
||||
"V09SS0VSX0ZBVUxUX0NBVEVHT1JZX01YQUNDRVNTX0VWRU5UX0NPTlZFUlNJ",
|
||||
"T05fRkFJTEVEEAgSIgoeV09SS0VSX0ZBVUxUX0NBVEVHT1JZX1NUQV9IVU5H",
|
||||
"EAkSKAokV09SS0VSX0ZBVUxUX0NBVEVHT1JZX1FVRVVFX09WRVJGTE9XEAoS",
|
||||
"KgomV09SS0VSX0ZBVUxUX0NBVEVHT1JZX1NIVVRET1dOX1RJTUVPVVQQC0Im",
|
||||
"qgIjWkIuTU9NLldXLk14R2F0ZXdheS5Db250cmFjdHMuUHJvdG9iBnByb3Rv",
|
||||
"Mw=="));
|
||||
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
|
||||
new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::ZB.MOM.WW.MxGateway.Contracts.Proto.MxaccessGatewayReflection.Descriptor, },
|
||||
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::ZB.MOM.WW.MxGateway.Contracts.Proto.WorkerState), typeof(global::ZB.MOM.WW.MxGateway.Contracts.Proto.WorkerFaultCategory), }, null, new pbr::GeneratedClrTypeInfo[] {
|
||||
new pbr::GeneratedClrTypeInfo(typeof(global::ZB.MOM.WW.MxGateway.Contracts.Proto.WorkerEnvelope), global::ZB.MOM.WW.MxGateway.Contracts.Proto.WorkerEnvelope.Parser, new[]{ "ProtocolVersion", "SessionId", "Sequence", "CorrelationId", "GatewayHello", "WorkerHello", "WorkerReady", "WorkerCommand", "WorkerCommandReply", "WorkerCancel", "WorkerShutdown", "WorkerShutdownAck", "WorkerEvent", "WorkerHeartbeat", "WorkerFault" }, new[]{ "Body" }, null, null, null),
|
||||
new pbr::GeneratedClrTypeInfo(typeof(global::ZB.MOM.WW.MxGateway.Contracts.Proto.GatewayHello), global::ZB.MOM.WW.MxGateway.Contracts.Proto.GatewayHello.Parser, new[]{ "SupportedProtocolVersion", "Nonce", "GatewayVersion", "MaxFrameBytes" }, null, null, null, null),
|
||||
new pbr::GeneratedClrTypeInfo(typeof(global::ZB.MOM.WW.MxGateway.Contracts.Proto.WorkerHello), global::ZB.MOM.WW.MxGateway.Contracts.Proto.WorkerHello.Parser, new[]{ "ProtocolVersion", "Nonce", "WorkerProcessId", "WorkerVersion" }, null, null, null, null),
|
||||
new pbr::GeneratedClrTypeInfo(typeof(global::ZB.MOM.WW.MxGateway.Contracts.Proto.WorkerReady), global::ZB.MOM.WW.MxGateway.Contracts.Proto.WorkerReady.Parser, new[]{ "WorkerProcessId", "MxaccessProgid", "MxaccessClsid", "ReadyTimestamp" }, null, null, null, null),
|
||||
new pbr::GeneratedClrTypeInfo(typeof(global::ZB.MOM.WW.MxGateway.Contracts.Proto.WorkerReady), global::ZB.MOM.WW.MxGateway.Contracts.Proto.WorkerReady.Parser, new[]{ "WorkerProcessId", "MxaccessProgid", "MxaccessClsid", "ReadyTimestamp", "RecordInfoPinStatus" }, null, null, null, null),
|
||||
new pbr::GeneratedClrTypeInfo(typeof(global::ZB.MOM.WW.MxGateway.Contracts.Proto.WorkerCommand), global::ZB.MOM.WW.MxGateway.Contracts.Proto.WorkerCommand.Parser, new[]{ "Command", "EnqueueTimestamp" }, null, null, null, null),
|
||||
new pbr::GeneratedClrTypeInfo(typeof(global::ZB.MOM.WW.MxGateway.Contracts.Proto.WorkerCommandReply), global::ZB.MOM.WW.MxGateway.Contracts.Proto.WorkerCommandReply.Parser, new[]{ "Reply", "CompletedTimestamp" }, null, null, null, null),
|
||||
new pbr::GeneratedClrTypeInfo(typeof(global::ZB.MOM.WW.MxGateway.Contracts.Proto.WorkerCancel), global::ZB.MOM.WW.MxGateway.Contracts.Proto.WorkerCancel.Parser, new[]{ "Reason" }, null, null, null, null),
|
||||
@@ -1744,6 +1745,7 @@ namespace ZB.MOM.WW.MxGateway.Contracts.Proto {
|
||||
mxaccessProgid_ = other.mxaccessProgid_;
|
||||
mxaccessClsid_ = other.mxaccessClsid_;
|
||||
readyTimestamp_ = other.readyTimestamp_ != null ? other.readyTimestamp_.Clone() : null;
|
||||
recordInfoPinStatus_ = other.recordInfoPinStatus_;
|
||||
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
|
||||
}
|
||||
|
||||
@@ -1801,6 +1803,26 @@ namespace ZB.MOM.WW.MxGateway.Contracts.Proto {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "record_info_pin_status" field.</summary>
|
||||
public const int RecordInfoPinStatusFieldNumber = 5;
|
||||
private string recordInfoPinStatus_ = "";
|
||||
/// <summary>
|
||||
/// Outcome of the worker's process-wide MXSTATUS_PROXY record-info pin
|
||||
/// (MxStatusProxyRecordInfoPin): "pinned {library-guid} vM.m record {record-guid}" on
|
||||
/// success, or the failing call and HRESULT / exception type otherwise. Empty when the
|
||||
/// worker made no attempt (an older worker, or a runtime that never created the
|
||||
/// MXAccess COM object). Diagnostic only: the gateway logs it and shows it on the
|
||||
/// dashboard, and never gates readiness on it, because the pin is a cache warm-up.
|
||||
/// </summary>
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public string RecordInfoPinStatus {
|
||||
get { return recordInfoPinStatus_; }
|
||||
set {
|
||||
recordInfoPinStatus_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public override bool Equals(object other) {
|
||||
@@ -1820,6 +1842,7 @@ namespace ZB.MOM.WW.MxGateway.Contracts.Proto {
|
||||
if (MxaccessProgid != other.MxaccessProgid) return false;
|
||||
if (MxaccessClsid != other.MxaccessClsid) return false;
|
||||
if (!object.Equals(ReadyTimestamp, other.ReadyTimestamp)) return false;
|
||||
if (RecordInfoPinStatus != other.RecordInfoPinStatus) return false;
|
||||
return Equals(_unknownFields, other._unknownFields);
|
||||
}
|
||||
|
||||
@@ -1831,6 +1854,7 @@ namespace ZB.MOM.WW.MxGateway.Contracts.Proto {
|
||||
if (MxaccessProgid.Length != 0) hash ^= MxaccessProgid.GetHashCode();
|
||||
if (MxaccessClsid.Length != 0) hash ^= MxaccessClsid.GetHashCode();
|
||||
if (readyTimestamp_ != null) hash ^= ReadyTimestamp.GetHashCode();
|
||||
if (RecordInfoPinStatus.Length != 0) hash ^= RecordInfoPinStatus.GetHashCode();
|
||||
if (_unknownFields != null) {
|
||||
hash ^= _unknownFields.GetHashCode();
|
||||
}
|
||||
@@ -1865,6 +1889,10 @@ namespace ZB.MOM.WW.MxGateway.Contracts.Proto {
|
||||
output.WriteRawTag(34);
|
||||
output.WriteMessage(ReadyTimestamp);
|
||||
}
|
||||
if (RecordInfoPinStatus.Length != 0) {
|
||||
output.WriteRawTag(42);
|
||||
output.WriteString(RecordInfoPinStatus);
|
||||
}
|
||||
if (_unknownFields != null) {
|
||||
_unknownFields.WriteTo(output);
|
||||
}
|
||||
@@ -1891,6 +1919,10 @@ namespace ZB.MOM.WW.MxGateway.Contracts.Proto {
|
||||
output.WriteRawTag(34);
|
||||
output.WriteMessage(ReadyTimestamp);
|
||||
}
|
||||
if (RecordInfoPinStatus.Length != 0) {
|
||||
output.WriteRawTag(42);
|
||||
output.WriteString(RecordInfoPinStatus);
|
||||
}
|
||||
if (_unknownFields != null) {
|
||||
_unknownFields.WriteTo(ref output);
|
||||
}
|
||||
@@ -1913,6 +1945,9 @@ namespace ZB.MOM.WW.MxGateway.Contracts.Proto {
|
||||
if (readyTimestamp_ != null) {
|
||||
size += 1 + pb::CodedOutputStream.ComputeMessageSize(ReadyTimestamp);
|
||||
}
|
||||
if (RecordInfoPinStatus.Length != 0) {
|
||||
size += 1 + pb::CodedOutputStream.ComputeStringSize(RecordInfoPinStatus);
|
||||
}
|
||||
if (_unknownFields != null) {
|
||||
size += _unknownFields.CalculateSize();
|
||||
}
|
||||
@@ -1940,6 +1975,9 @@ namespace ZB.MOM.WW.MxGateway.Contracts.Proto {
|
||||
}
|
||||
ReadyTimestamp.MergeFrom(other.ReadyTimestamp);
|
||||
}
|
||||
if (other.RecordInfoPinStatus.Length != 0) {
|
||||
RecordInfoPinStatus = other.RecordInfoPinStatus;
|
||||
}
|
||||
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
|
||||
}
|
||||
|
||||
@@ -1978,6 +2016,10 @@ namespace ZB.MOM.WW.MxGateway.Contracts.Proto {
|
||||
input.ReadMessage(ReadyTimestamp);
|
||||
break;
|
||||
}
|
||||
case 42: {
|
||||
RecordInfoPinStatus = input.ReadString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -2016,6 +2058,10 @@ namespace ZB.MOM.WW.MxGateway.Contracts.Proto {
|
||||
input.ReadMessage(ReadyTimestamp);
|
||||
break;
|
||||
}
|
||||
case 42: {
|
||||
RecordInfoPinStatus = input.ReadString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +65,13 @@ message WorkerReady {
|
||||
string mxaccess_progid = 2;
|
||||
string mxaccess_clsid = 3;
|
||||
google.protobuf.Timestamp ready_timestamp = 4;
|
||||
// Outcome of the worker's process-wide MXSTATUS_PROXY record-info pin
|
||||
// (MxStatusProxyRecordInfoPin): "pinned {library-guid} vM.m record {record-guid}" on
|
||||
// success, or the failing call and HRESULT / exception type otherwise. Empty when the
|
||||
// worker made no attempt (an older worker, or a runtime that never created the
|
||||
// MXAccess COM object). Diagnostic only: the gateway logs it and shows it on the
|
||||
// dashboard, and never gates readiness on it, because the pin is a cache warm-up.
|
||||
string record_info_pin_status = 5;
|
||||
}
|
||||
|
||||
message WorkerCommand {
|
||||
|
||||
@@ -102,6 +102,7 @@ else
|
||||
<tr><th scope="row">Process id</th><td>@(CurrentSession.WorkerProcessId?.ToString(System.Globalization.CultureInfo.InvariantCulture) ?? "-")</td></tr>
|
||||
<tr><th scope="row">State</th><td><StatusBadge Text="@(CurrentSession.WorkerState?.ToString() ?? "-")" /></td></tr>
|
||||
<tr><th scope="row">Last heartbeat</th><td>@DashboardDisplay.DateTime(CurrentSession.LastWorkerHeartbeatAt)</td></tr>
|
||||
<tr><th scope="row">Record-info pin</th><td>@DashboardDisplay.Text(CurrentSession.WorkerRecordInfoPinStatus)</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -17,4 +17,5 @@ public sealed record DashboardSessionSummary(
|
||||
WorkerClientState? WorkerState,
|
||||
DateTimeOffset? LastWorkerHeartbeatAt,
|
||||
long EventsReceived,
|
||||
string? LastFault);
|
||||
string? LastFault,
|
||||
string? WorkerRecordInfoPinStatus = null);
|
||||
|
||||
@@ -285,7 +285,8 @@ public sealed class DashboardSnapshotService : IDashboardSnapshotService
|
||||
WorkerState: workerClient?.State,
|
||||
LastWorkerHeartbeatAt: workerClient?.LastHeartbeatAt,
|
||||
EventsReceived: eventsReceived,
|
||||
LastFault: DashboardRedactor.Redact(session.FinalFault));
|
||||
LastFault: DashboardRedactor.Redact(session.FinalFault),
|
||||
WorkerRecordInfoPinStatus: workerClient?.RecordInfoPinStatus);
|
||||
}
|
||||
|
||||
private static DashboardWorkerSummary CreateWorkerSummary(GatewaySession session)
|
||||
|
||||
@@ -27,6 +27,14 @@ public interface IWorkerClient : IAsyncDisposable
|
||||
/// </returns>
|
||||
Task? GetStateChangedSignal() => null;
|
||||
|
||||
/// <summary>
|
||||
/// Outcome of the worker's <c>MXSTATUS_PROXY</c> record-info pin, as reported in
|
||||
/// <see cref="WorkerReady"/>, or <see langword="null"/> before the handshake or when the
|
||||
/// worker did not report one. Diagnostic only; the default implementation returns
|
||||
/// <see langword="null"/>.
|
||||
/// </summary>
|
||||
string? RecordInfoPinStatus => null;
|
||||
|
||||
/// <summary>UTC timestamp of the most recent heartbeat from the worker.</summary>
|
||||
DateTimeOffset LastHeartbeatAt { get; }
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ namespace ZB.MOM.WW.MxGateway.Server.Workers;
|
||||
public sealed class WorkerClient : IWorkerClient
|
||||
{
|
||||
private const string GatewayVersionFallback = "unknown";
|
||||
// Prefix of a successful MxStatusProxyRecordInfoPin.Status in the worker; anything else is a failure.
|
||||
private const string RecordInfoPinnedPrefix = "pinned ";
|
||||
private static readonly TimeSpan DisposeTaskTimeout = TimeSpan.FromSeconds(5);
|
||||
private readonly object _syncRoot = new();
|
||||
private readonly WorkerClientConnection _connection;
|
||||
@@ -55,6 +57,7 @@ public sealed class WorkerClient : IWorkerClient
|
||||
private TaskCompletionSource _stateChanged = new(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
private DateTimeOffset _lastHeartbeatAt;
|
||||
private int? _processId;
|
||||
private string? _recordInfoPinStatus;
|
||||
private int _eventQueueDepth;
|
||||
private int _eventsReaderClaimed;
|
||||
private Task? _readLoopTask;
|
||||
@@ -161,6 +164,9 @@ public sealed class WorkerClient : IWorkerClient
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string? RecordInfoPinStatus => Volatile.Read(ref _recordInfoPinStatus);
|
||||
|
||||
/// <inheritdoc />
|
||||
public DateTimeOffset LastHeartbeatAt
|
||||
{
|
||||
@@ -1074,6 +1080,45 @@ public sealed class WorkerClient : IWorkerClient
|
||||
DateTimeOffset readyAt = _timeProvider.GetUtcNow();
|
||||
DateTimeOffset launchedAt = _connection.ProcessHandle?.LaunchedAt ?? readyAt;
|
||||
_metrics?.WorkerStarted(readyAt - launchedAt);
|
||||
RecordRecordInfoPinStatus(ready.RecordInfoPinStatus);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Records and logs the worker's <c>MXSTATUS_PROXY</c> record-info pin outcome from
|
||||
/// <see cref="WorkerReady"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The worker logs the outcome too, but to its own stderr, which the gateway does not
|
||||
/// capture; this is the line operators actually see. A failed pin is a warning rather than a
|
||||
/// fault: MXAccess still works, but every data change then pays a type-library reload, which
|
||||
/// is the dominant worker CPU cost at high event rates. An empty status means an older
|
||||
/// worker, so nothing is logged.
|
||||
/// </remarks>
|
||||
/// <param name="status">The status string the worker reported; empty when absent.</param>
|
||||
private void RecordRecordInfoPinStatus(string status)
|
||||
{
|
||||
if (string.IsNullOrEmpty(status))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Volatile.Write(ref _recordInfoPinStatus, status);
|
||||
if (status.StartsWith(RecordInfoPinnedPrefix, StringComparison.Ordinal))
|
||||
{
|
||||
_logger.LogInformation(
|
||||
"Worker {ProcessId} for session {SessionId} pinned the MXSTATUS_PROXY record info: {RecordInfoPinStatus}",
|
||||
ProcessId,
|
||||
SessionId,
|
||||
status);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning(
|
||||
"Worker {ProcessId} for session {SessionId} could not pin the MXSTATUS_PROXY record info; each data change will reload the MXAccess type library: {RecordInfoPinStatus}",
|
||||
ProcessId,
|
||||
SessionId,
|
||||
status);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Updates the heartbeat timestamp and process ID.</summary>
|
||||
|
||||
@@ -182,6 +182,31 @@ public sealed class DashboardSnapshotServiceTests
|
||||
Assert.Equal("worker pipe disconnected", fault.Message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The worker's record-info pin outcome, reported in <c>WorkerReady</c>, reaches the session
|
||||
/// summary the session-details page renders, since the worker's own log line is not captured.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void GetSnapshot_ProjectsWorkerRecordInfoPinStatus()
|
||||
{
|
||||
const string pinStatus = "LoadRegTypeLib failed (HRESULT 0x8002801D)";
|
||||
SessionRegistry registry = new();
|
||||
GatewaySession session = CreateSession(
|
||||
"session-pin",
|
||||
"client-one",
|
||||
DateTimeOffset.Parse("2026-04-26T10:00:00Z", CultureInfo.InvariantCulture));
|
||||
session.AttachWorkerClient(
|
||||
new FakeWorkerClient("session-pin", 1301, WorkerClientState.Ready) { RecordInfoPinStatus = pinStatus });
|
||||
session.MarkReady();
|
||||
registry.TryAdd(session);
|
||||
using GatewayMetrics metrics = new();
|
||||
DashboardSnapshotService service = CreateService(registry, metrics);
|
||||
|
||||
DashboardSessionSummary summary = Assert.Single(service.GetSnapshot().Sessions);
|
||||
|
||||
Assert.Equal(pinStatus, summary.WorkerRecordInfoPinStatus);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies snapshot metrics include the cumulative alarm provider switch count.
|
||||
/// </summary>
|
||||
@@ -929,6 +954,9 @@ public sealed class DashboardSnapshotServiceTests
|
||||
/// <inheritdoc />
|
||||
public WorkerClientState State { get; private set; } = state;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string? RecordInfoPinStatus { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public DateTimeOffset LastHeartbeatAt { get; } = DateTimeOffset.Parse("2026-04-26T10:02:00Z", CultureInfo.InvariantCulture);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Buffers.Binary;
|
||||
using System.IO.Pipes;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ZB.MOM.WW.MxGateway.Contracts;
|
||||
using ZB.MOM.WW.MxGateway.Contracts.Proto;
|
||||
using ZB.MOM.WW.MxGateway.Server.Metrics;
|
||||
@@ -108,11 +109,13 @@ public sealed class FakeWorkerHarness : IAsyncDisposable
|
||||
/// <param name="options">Configuration options for the worker client.</param>
|
||||
/// <param name="metrics">Gateway metrics collector.</param>
|
||||
/// <param name="timeProvider">Time provider for timestamps.</param>
|
||||
/// <param name="logger">Logger for the worker client; null uses a no-op logger.</param>
|
||||
/// <returns>A configured worker client connected to this harness.</returns>
|
||||
public WorkerClient CreateClient(
|
||||
WorkerClientOptions? options = null,
|
||||
GatewayMetrics? metrics = null,
|
||||
TimeProvider? timeProvider = null)
|
||||
TimeProvider? timeProvider = null,
|
||||
ILogger<WorkerClient>? logger = null)
|
||||
{
|
||||
if (_gatewayStream is null)
|
||||
{
|
||||
@@ -125,7 +128,7 @@ public sealed class FakeWorkerHarness : IAsyncDisposable
|
||||
_gatewayStream,
|
||||
_frameOptions);
|
||||
|
||||
return new WorkerClient(connection, options, metrics, timeProvider);
|
||||
return new WorkerClient(connection, options, metrics, timeProvider, logger);
|
||||
}
|
||||
|
||||
/// <summary>Completes the worker startup handshake by reading the gateway hello and sending worker hello and ready.</summary>
|
||||
@@ -229,12 +232,14 @@ public sealed class FakeWorkerHarness : IAsyncDisposable
|
||||
/// <param name="mxaccessProgid">MXAccess COM ProgID.</param>
|
||||
/// <param name="mxaccessClsid">MXAccess COM CLSID.</param>
|
||||
/// <param name="cancellationToken">Token to cancel the asynchronous operation.</param>
|
||||
/// <param name="recordInfoPinStatus">Record-info pin outcome to report; empty mimics an older worker.</param>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
public async Task SendWorkerReadyAsync(
|
||||
int workerProcessId = DefaultWorkerProcessId,
|
||||
string mxaccessProgid = "LMXProxy.LMXProxyServer.1",
|
||||
string mxaccessClsid = "{C30B52F5-2CB5-4760-AF0A-3A344A7EB5DC}",
|
||||
CancellationToken cancellationToken = default)
|
||||
CancellationToken cancellationToken = default,
|
||||
string recordInfoPinStatus = "")
|
||||
{
|
||||
await _writer.WriteAsync(
|
||||
CreateEnvelope(
|
||||
@@ -245,6 +250,7 @@ public sealed class FakeWorkerHarness : IAsyncDisposable
|
||||
MxaccessProgid = mxaccessProgid,
|
||||
MxaccessClsid = mxaccessClsid,
|
||||
ReadyTimestamp = Timestamp.FromDateTimeOffset(DateTimeOffset.UtcNow),
|
||||
RecordInfoPinStatus = recordInfoPinStatus,
|
||||
}),
|
||||
cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ZB.MOM.WW.MxGateway.Contracts.Proto;
|
||||
using ZB.MOM.WW.MxGateway.Server.Workers;
|
||||
using ZB.MOM.WW.MxGateway.Tests.Gateway.Workers.Fakes;
|
||||
using ZB.MOM.WW.MxGateway.Tests.TestSupport;
|
||||
|
||||
namespace ZB.MOM.WW.MxGateway.Tests.Gateway.Workers;
|
||||
|
||||
/// <summary>
|
||||
/// The worker reports its <c>MXSTATUS_PROXY</c> record-info pin outcome in <see cref="WorkerReady"/>
|
||||
/// because the gateway never sees the worker's own stderr log. These tests pin how the gateway
|
||||
/// surfaces it: kept on the client, logged at Information on success and Warning on failure,
|
||||
/// and silently absent for an older worker that sends no status.
|
||||
/// </summary>
|
||||
public sealed class WorkerClientRecordInfoPinTests
|
||||
{
|
||||
private const string PinnedStatus =
|
||||
"pinned {77e896ec-b3e3-4de4-b96f-f32570164211} v3.2 record {a162d9e4-9019-42f3-a087-79264007e542}";
|
||||
|
||||
private static readonly TimeSpan TestTimeout = TimeSpan.FromSeconds(5);
|
||||
|
||||
/// <summary>A successful pin is recorded on the client and logged at Information.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task StartAsync_WorkerReportsPinned_RecordsStatusAndLogsInformation()
|
||||
{
|
||||
RecordingLogger<WorkerClient> logger = new();
|
||||
await using FakeWorkerHarness harness = await FakeWorkerHarness.CreateConnectedPairAsync();
|
||||
await using WorkerClient client = harness.CreateClient(logger: logger);
|
||||
|
||||
await StartWithReadyAsync(client, harness, PinnedStatus);
|
||||
|
||||
Assert.Equal(PinnedStatus, client.RecordInfoPinStatus);
|
||||
(LogLevel level, string message, _) = Assert.Single(
|
||||
logger.Entries,
|
||||
entry => entry.Message.Contains("record info", StringComparison.Ordinal));
|
||||
Assert.Equal(LogLevel.Information, level);
|
||||
Assert.Contains(PinnedStatus, message, StringComparison.Ordinal);
|
||||
Assert.Contains(FakeWorkerHarness.DefaultSessionId, message, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A failed pin still lets the worker reach Ready (the pin is a cache warm-up, not a
|
||||
/// prerequisite) but is logged at Warning so the per-event CPU cost it implies is visible.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task StartAsync_WorkerReportsPinFailure_StaysReadyAndLogsWarning()
|
||||
{
|
||||
const string failedStatus = "LoadRegTypeLib failed (HRESULT 0x8002801D)";
|
||||
RecordingLogger<WorkerClient> logger = new();
|
||||
await using FakeWorkerHarness harness = await FakeWorkerHarness.CreateConnectedPairAsync();
|
||||
await using WorkerClient client = harness.CreateClient(logger: logger);
|
||||
|
||||
await StartWithReadyAsync(client, harness, failedStatus);
|
||||
|
||||
Assert.Equal(WorkerClientState.Ready, client.State);
|
||||
Assert.Equal(failedStatus, client.RecordInfoPinStatus);
|
||||
(LogLevel level, string message, _) = Assert.Single(
|
||||
logger.Entries,
|
||||
entry => entry.Message.Contains("record info", StringComparison.Ordinal));
|
||||
Assert.Equal(LogLevel.Warning, level);
|
||||
Assert.Contains(failedStatus, message, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
/// <summary>An older worker sends no status: nothing is recorded and nothing is logged about it.</summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task StartAsync_WorkerReportsNoStatus_RecordsNullAndDoesNotLog()
|
||||
{
|
||||
RecordingLogger<WorkerClient> logger = new();
|
||||
await using FakeWorkerHarness harness = await FakeWorkerHarness.CreateConnectedPairAsync();
|
||||
await using WorkerClient client = harness.CreateClient(logger: logger);
|
||||
|
||||
await StartWithReadyAsync(client, harness, recordInfoPinStatus: string.Empty);
|
||||
|
||||
Assert.Equal(WorkerClientState.Ready, client.State);
|
||||
Assert.Null(client.RecordInfoPinStatus);
|
||||
Assert.DoesNotContain(
|
||||
logger.Entries,
|
||||
entry => entry.Message.Contains("record info", StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
private static async Task StartWithReadyAsync(
|
||||
WorkerClient client,
|
||||
FakeWorkerHarness harness,
|
||||
string recordInfoPinStatus)
|
||||
{
|
||||
Task startTask = client.StartAsync(CancellationToken.None);
|
||||
WorkerEnvelope gatewayHello = await harness.ReadGatewayEnvelopeAsync().WaitAsync(TestTimeout);
|
||||
Assert.Equal(WorkerEnvelope.BodyOneofCase.GatewayHello, gatewayHello.BodyCase);
|
||||
await harness.SendWorkerHelloAsync().WaitAsync(TestTimeout);
|
||||
await harness.SendWorkerReadyAsync(recordInfoPinStatus: recordInfoPinStatus).WaitAsync(TestTimeout);
|
||||
await startTask.WaitAsync(TestTimeout);
|
||||
}
|
||||
}
|
||||
@@ -406,6 +406,151 @@ public sealed class WorkerPipeSessionTests
|
||||
await SendShutdownAndWaitAsync(pipePair, runTask, cancellation.Token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The drain loop's task mirrors the dedicated thread's outcome: cancelling its token ends
|
||||
/// the task Canceled (not faulted, not still running), which is what lets the message loop's
|
||||
/// teardown treat it as an ordinary stop. Exercised directly, before any runtime session is
|
||||
/// attached, so the loop is in its runtime-less poll and only the cancellation can end it.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task RunEventDrainLoopAsync_WhenCancelled_EndsCanceled()
|
||||
{
|
||||
WorkerFrameProtocolOptions options = CreateOptions();
|
||||
using MemoryStream inbound = new();
|
||||
using MemoryStream outbound = new();
|
||||
WorkerPipeSession session = CreateSession(inbound, outbound, options);
|
||||
using CancellationTokenSource stop = new();
|
||||
|
||||
Task drainTask = session.RunEventDrainLoopAsync(stop.Token);
|
||||
Assert.False(drainTask.IsCompleted);
|
||||
stop.Cancel();
|
||||
|
||||
Task completedTask = await Task.WhenAny(drainTask, Task.Delay(TimeSpan.FromSeconds(5)));
|
||||
Assert.Same(drainTask, completedTask);
|
||||
Assert.True(drainTask.IsCanceled, $"Expected Canceled but the drain task ended {drainTask.Status}.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancelling the session while the dedicated drain thread is parked on the event signal
|
||||
/// ends <see cref="WorkerPipeSession.RunAsync"/> as cancelled, disposes the runtime, and lets
|
||||
/// the drain thread exit. Teardown must not log the drain task as faulted or overrunning its
|
||||
/// stop budget: a cancelled drain is a clean stop.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task RunAsync_WhenCancelledWhileDrainThreadParked_EndsCanceledAndDrainThreadExits()
|
||||
{
|
||||
using CancellationTokenSource timeout = new(TimeSpan.FromSeconds(10));
|
||||
using CancellationTokenSource sessionCancellation = new();
|
||||
using PipePair pipePair = await PipePair.CreateAsync(timeout.Token);
|
||||
RecordingWorkerLogger logger = new();
|
||||
FakeRuntimeSession runtime = new()
|
||||
{
|
||||
WaitForEventsOnSignalOnly = true,
|
||||
};
|
||||
WorkerPipeSession session = CreatePipeSession(
|
||||
pipePair.WorkerStream,
|
||||
runtime,
|
||||
new WorkerPipeSessionOptions
|
||||
{
|
||||
HeartbeatInterval = TimeSpan.FromMilliseconds(100),
|
||||
HeartbeatGrace = TimeSpan.FromSeconds(5),
|
||||
},
|
||||
logger);
|
||||
Task runTask = session.RunAsync(sessionCancellation.Token);
|
||||
await CompleteGatewayHandshakeAsync(pipePair, timeout.Token);
|
||||
Thread drainThread = await WaitForDrainThreadAsync(runtime, timeout.Token);
|
||||
|
||||
sessionCancellation.Cancel();
|
||||
|
||||
Task completedTask = await Task.WhenAny(runTask, Task.Delay(TimeSpan.FromSeconds(5), timeout.Token));
|
||||
Assert.Same(runTask, completedTask);
|
||||
await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => await runTask);
|
||||
Assert.True(runtime.Disposed);
|
||||
Assert.True(drainThread.Join(TimeSpan.FromSeconds(5)), "The dedicated drain thread did not exit.");
|
||||
Assert.DoesNotContain(
|
||||
logger.Events,
|
||||
entry => entry.Fields.TryGetValue("task", out object? task) && (task as string) == "EventDrain");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An unexpected exception inside the loop on the dedicated drain thread faults the drain
|
||||
/// task with that same exception, so the message loop's <c>Task.WhenAny</c> supervision ends
|
||||
/// <see cref="WorkerPipeSession.RunAsync"/> with it exactly as it did when the loop was an
|
||||
/// async method: the session stops, the runtime is disposed, and the thread exits.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task RunAsync_WhenDrainLoopThrows_FaultsSessionWithTheSameException()
|
||||
{
|
||||
using CancellationTokenSource cancellation = new(TimeSpan.FromSeconds(10));
|
||||
using PipePair pipePair = await PipePair.CreateAsync(cancellation.Token);
|
||||
FakeRuntimeSession runtime = new()
|
||||
{
|
||||
WaitForEventsOnSignalOnly = true,
|
||||
};
|
||||
WorkerPipeSession session = CreatePipeSession(pipePair.WorkerStream, runtime);
|
||||
Task runTask = session.RunAsync(cancellation.Token);
|
||||
await CompleteGatewayHandshakeAsync(pipePair, cancellation.Token);
|
||||
Thread drainThread = await WaitForDrainThreadAsync(runtime, cancellation.Token);
|
||||
|
||||
InvalidOperationException scripted = new("scripted drain-loop failure");
|
||||
runtime.DrainEventsException = scripted;
|
||||
// Wake the parked thread; its next pass calls DrainEvents, which now throws.
|
||||
runtime.EnqueueEvent(CreateWorkerEvent(sequence: 4));
|
||||
|
||||
Task completedTask = await Task.WhenAny(runTask, Task.Delay(TimeSpan.FromSeconds(5), cancellation.Token));
|
||||
Assert.Same(runTask, completedTask);
|
||||
InvalidOperationException observed =
|
||||
await Assert.ThrowsAsync<InvalidOperationException>(async () => await runTask);
|
||||
Assert.Same(scripted, observed);
|
||||
Assert.True(runtime.Disposed);
|
||||
Assert.True(drainThread.Join(TimeSpan.FromSeconds(5)), "The dedicated drain thread did not exit.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The handshake copies the process-wide record-info pin outcome into <c>WorkerReady</c>, so
|
||||
/// the gateway can log it: the worker's own log goes to stderr, which the gateway does not
|
||||
/// capture. Whether the pin succeeds depends on the host, so only the hand-off is asserted.
|
||||
/// </summary>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
[Fact]
|
||||
public async Task CompleteStartupHandshakeAsync_ReportsRecordInfoPinStatusInWorkerReady()
|
||||
{
|
||||
_ = MxStatusProxyRecordInfoPin.EnsurePinned();
|
||||
string? pinStatus = MxStatusProxyRecordInfoPin.Status;
|
||||
Assert.False(string.IsNullOrEmpty(pinStatus));
|
||||
WorkerFrameProtocolOptions options = CreateOptions();
|
||||
using MemoryStream inbound = new();
|
||||
await new WorkerFrameWriter(inbound, options).WriteAsync(CreateGatewayHelloEnvelope());
|
||||
inbound.Position = 0;
|
||||
using MemoryStream outbound = new();
|
||||
WorkerPipeSession session = CreateSession(inbound, outbound, options);
|
||||
|
||||
await session.CompleteStartupHandshakeAsync(
|
||||
_ => Task.FromResult(new WorkerReady { WorkerProcessId = 1234 }));
|
||||
|
||||
WorkerEnvelope[] written = ReadWrittenFrames(outbound, options);
|
||||
Assert.Equal(WorkerEnvelope.BodyOneofCase.WorkerReady, written[1].BodyCase);
|
||||
Assert.Equal(pinStatus, written[1].WorkerReady.RecordInfoPinStatus);
|
||||
}
|
||||
|
||||
// Waits until the drain loop has parked on the fake's event signal at least once and returns the
|
||||
// thread it parked on: the dedicated drain thread.
|
||||
private static async Task<Thread> WaitForDrainThreadAsync(
|
||||
FakeRuntimeSession runtime,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
Thread? drainThread;
|
||||
while ((drainThread = runtime.LastWaitForEventsThread) is null)
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromMilliseconds(5), cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return drainThread;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that a Ping control command is answered on the worker side
|
||||
/// (not dispatched to the STA) with an OK reply that echoes the ping
|
||||
|
||||
@@ -42,6 +42,8 @@ internal sealed class FakeRuntimeSession : IWorkerRuntimeSession
|
||||
// disposed SemaphoreSlim would turn that shutdown into an ObjectDisposedException.
|
||||
private readonly SemaphoreSlim eventSignal = new(0, 1);
|
||||
private TimeSpan? lastWaitForEventsTimeout;
|
||||
private volatile Exception? drainEventsException;
|
||||
private volatile Thread? lastWaitForEventsThread;
|
||||
private bool refreshStaActivityOnCapture;
|
||||
private WorkerRuntimeHeartbeatSnapshot snapshot = new(
|
||||
DateTimeOffset.UtcNow,
|
||||
@@ -235,9 +237,25 @@ internal sealed class FakeRuntimeSession : IWorkerRuntimeSession
|
||||
/// </summary>
|
||||
public int? LastDrainMaxTotalBytes { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets an exception every <see cref="DrainEvents(uint)"/> call throws, standing in
|
||||
/// for an unexpected failure inside the event drain loop. Safe to set from the test thread
|
||||
/// while the drain thread is running.
|
||||
/// </summary>
|
||||
public Exception? DrainEventsException
|
||||
{
|
||||
get => drainEventsException;
|
||||
set => drainEventsException = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<WorkerEvent> DrainEvents(uint maxEvents)
|
||||
{
|
||||
if (drainEventsException is { } drainException)
|
||||
{
|
||||
throw drainException;
|
||||
}
|
||||
|
||||
if (SuppressDrainForBatchSize is uint suppressed && maxEvents == suppressed)
|
||||
{
|
||||
return Array.Empty<WorkerEvent>();
|
||||
@@ -393,9 +411,16 @@ internal sealed class FakeRuntimeSession : IWorkerRuntimeSession
|
||||
/// <summary>Gets whether the most recent <see cref="WaitForEvents"/> call ran on a thread-pool thread.</summary>
|
||||
public bool? LastWaitForEventsOnThreadPool { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the thread that made the most recent <see cref="WaitForEvents"/> call, so a test can
|
||||
/// assert the dedicated drain thread has exited after the session stops.
|
||||
/// </summary>
|
||||
public Thread? LastWaitForEventsThread => lastWaitForEventsThread;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void WaitForEvents(TimeSpan timeout, CancellationToken cancellationToken)
|
||||
{
|
||||
lastWaitForEventsThread = Thread.CurrentThread;
|
||||
LastWaitForEventsThreadName = Thread.CurrentThread.Name;
|
||||
LastWaitForEventsOnThreadPool = Thread.CurrentThread.IsThreadPoolThread;
|
||||
// Same knobs as the async form (signal-only, recorded timeout, backing queue); the drain
|
||||
|
||||
@@ -360,6 +360,14 @@ public sealed class WorkerPipeSession
|
||||
_logger?.Information(
|
||||
"WorkerRecordInfoPin",
|
||||
new Dictionary<string, object?> { ["status"] = pinStatus });
|
||||
|
||||
// The gateway does not capture worker stderr, so the log line above is rarely
|
||||
// seen; WorkerReady carries the outcome to the gateway, which logs it and shows it
|
||||
// on the dashboard. A runtime that already filled the field keeps its own value.
|
||||
if (string.IsNullOrEmpty(ready.RecordInfoPinStatus))
|
||||
{
|
||||
ready.RecordInfoPinStatus = pinStatus;
|
||||
}
|
||||
}
|
||||
|
||||
await WriteWorkerReadyAsync(ready, cancellationToken).ConfigureAwait(false);
|
||||
@@ -609,8 +617,12 @@ public sealed class WorkerPipeSession
|
||||
/// there. A dedicated thread parks on the signal instead, and with a synchronous flush the
|
||||
/// steady-state event path schedules no managed thread-pool work at all. The pipe write itself
|
||||
/// stays overlapped; its completion runs on an I/O completion thread, not a worker thread.
|
||||
/// Internal so the completion mapping can be tested directly; production code calls it only
|
||||
/// from <see cref="RunMessageLoopAsync"/>.
|
||||
/// </remarks>
|
||||
private Task RunEventDrainLoopAsync(CancellationToken cancellationToken)
|
||||
/// <param name="cancellationToken">Token that stops the loop; the returned task then ends Canceled.</param>
|
||||
/// <returns>A task that mirrors the loop's outcome.</returns>
|
||||
internal Task RunEventDrainLoopAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
TaskCompletionSource<bool> completion = new(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
Thread thread = new(() =>
|
||||
@@ -618,7 +630,18 @@ public sealed class WorkerPipeSession
|
||||
try
|
||||
{
|
||||
RunEventDrainLoop(cancellationToken);
|
||||
completion.TrySetResult(true);
|
||||
|
||||
// The loop returns only once its token is cancelled. Report that as Canceled
|
||||
// whether the loop noticed at its head or inside a wait (which throws), so a
|
||||
// stopped drain has one outcome rather than a timing-dependent pair.
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
completion.TrySetCanceled(cancellationToken);
|
||||
}
|
||||
else
|
||||
{
|
||||
completion.TrySetResult(true);
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user