mtconnect / cppagent_dev

Private C++ Agent for Pending Release Development
Apache License 2.0
1 stars 1 forks source link

Agent stops when agent.cfg and devices.xml are changed from MTConnect spec 1.2 to 1.3 in RC23 for x86 #229

Closed hulinning2 closed 1 year ago

hulinning2 commented 2 years ago

Test:

Stop agent Run Adapter and configures to run MTConnect spec 1.2 Start Agent Check browser for correct MTConnect output using current command ==> All OK While adapter is running, adpater is configured to use MTConnect 1.3 ==> the content of agent.cfg and devices.xml are changed to MTConnect spec 1.3 Agent is still running OK Refresh MS Edge browser ==> Agent stops Note: It seems that agent can handle the changes without error if there is no browser (clients) connecting to MTConnect agent

Thanks

Microsoft Windows [Version 10.0.19044.2006] (c) Microsoft Corporation. All rights reserved.

C:\Users\lhuynh>d:

D:>cd D:\Program Files\Okuma\Okuma MT Connect Adapter

D:\Program Files\Okuma\Okuma MT Connect Adapter>agent debug Configuration search path: "D:\Program Files\Okuma\Okuma MT Connect Adapter" and "D:\Program Files\Okuma\Okuma MT Connect Adapter" MTConnect Agent Version 2.0.0.12 (_RC23) - built on Wed Jul 13 09:12:45 2022 [2022-11-01 08:09:46.597055] [0x00003c10] [info] Loading configuration from: "D:\Program Files\Okuma\Okuma MT Connect Adapter\agent.cfg" Loading configuration from:"D:\Program Files\Okuma\Okuma MT Connect Adapter\agent.cfg"2022-11-01T12:09:46.600056Z (0x00003c10) [info] MAIN->AgentConfiguration::initialize->AgentConfiguration::loadConfig: Starting agent on port 5000 2022-11-01T12:09:46.620058Z (0x00003c10) [warning] MAIN->AgentConfiguration::initialize->AgentConfiguration::loadConfig->AgentConfiguration::loadAdapters: Cannot locate device name 'OKUMA.Machine.Adapter', trying default 2022-11-01T12:09:46.620058Z (0x00003c10) [info] MAIN->AgentConfiguration::initialize->AgentConfiguration::loadConfig->AgentConfiguration::loadAdapters: Assigning default device OKUMA.Lathe to adapter 2022-11-01T12:09:46.620058Z (0x00003c10) [info] MAIN->AgentConfiguration::initialize->AgentConfiguration::loadConfig->AgentConfiguration::loadAdapters: shdr: Adding adapter for OKUMA.Lathe: OKUMA.Machine.Adapter 2022-11-01T12:09:46.622056Z (0x00003c10) [debug] MAIN: Waiting for monitor thread to exit to restart agent 2022-11-01T12:09:46.622056Z (0x00003c10) [debug] MAIN->AgentConfiguration::monitorThread: Monitoring files: "D:\Program Files\Okuma\Okuma MT Connect Adapter\agent.cfg" and D:\Program Files\Okuma\Okuma MT Connect Adapter\Devices.xml, will warm start if they change. 2022-11-01T12:09:46.622056Z (0x00003c10) [debug] MAIN->AgentConfiguration::monitorThread: Setting device and config times 2022-11-01T12:09:46.625058Z (0x00003c10) [warning] MAIN->Agent::start->pipeline.deliver: Could not find data item: _7714929c63_asset_update_rate, exiting metrics 2022-11-01T12:09:46.625058Z (0x00003c10) [warning] MAIN->Agent::start->pipeline.deliver: Could not find data item: _7714929c63_observation_update_rate, exiting metrics 2022-11-01T12:09:46.631055Z (0x00003b14) [debug] Connector::resolved->Connector::connect: Connecting to data source: localhost on port: 7878 2022-11-01T12:09:48.668091Z (0x00003b14) [info] Connector::connected: Connected with: 127.0.0.1:7878 2022-11-01T12:09:48.669061Z (0x00003b14) [debug] Connector::connected->Connector::sendCommand: (Port:52247) Sending PING 2022-11-01T12:09:48.670058Z (0x00003b14) [debug] Connector::reader->Connector::parseSocketBuffer->Connector::processLine: (Port:52247) Received a PONG for localhost on port 7878 2022-11-01T12:09:48.674056Z (0x00003b14) [debug] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->Connector::startHeartbeats: (Port:52247)Received PONG, starting heartbeats every 10000ms 2022-11-01T12:09:48.677058Z (0x00003b14) [debug] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::protocolCommand: Processing command: adapterversion: adapterVersion:5.0.0.1 2022-11-01T12:09:48.678055Z (0x00003b14) [warning] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::protocolCommand: Cannot find data item for the Agent device when processing command adapterversion with value 5.0.0.1 for adapter _7714929c63 2022-11-01T12:09:48.679059Z (0x00003b14) [debug] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::protocolCommand: Processing command: adapterversion: adapterVersion:5.0.0.1 2022-11-01T12:09:48.681055Z (0x00003b14) [warning] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::protocolCommand: Cannot find data item for the Agent device when processing command adapterversion with value 5.0.0.1 for adapter _7714929c63 2022-11-01T12:09:48.687057Z (0x00003b14) [debug] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::protocolCommand: Processing command: mtconnectversion: mtconnectVersion:1.2 2022-11-01T12:09:48.690057Z (0x00003b14) [warning] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::protocolCommand: Cannot find data item for the Agent device when processing command mtconnectversion with value 1.2 for adapter _7714929c63 2022-11-01T12:09:53.542057Z (0x00003b14) [info] SessionImpl::requested: ReST Request: From [127.0.0.1:52254]: GET /current 2022-11-01T12:09:56.629097Z (0x00003b14) [debug] AgentConfiguration::monitorThread: Monitoring files: "D:\Program Files\Okuma\Okuma MT Connect Adapter\agent.cfg" and D:\Program Files\Okuma\Okuma MT Connect Adapter\Devices.xml, will warm start if they change. 2022-11-01T12:09:57.756093Z (0x00003b14) [info] SessionImpl::requested: ReST Request: From [127.0.0.1:52259]: GET /current 2022-11-01T12:09:58.684057Z (0x00003b14) [debug] Connector::heartbeat: Sending heartbeat 2022-11-01T12:09:58.685058Z (0x00003b14) [debug] Connector::heartbeat->Connector::sendCommand: (Port:52247) Sending PING 2022-11-01T12:09:58.686058Z (0x00003b14) [debug] Connector::reader->Connector::parseSocketBuffer->Connector::processLine: (Port:52247) Received a PONG for localhost on port 7878 2022-11-01T12:10:06.633057Z (0x00003b14) [debug] AgentConfiguration::monitorThread: Monitoring files: "D:\Program Files\Okuma\Okuma MT Connect Adapter\agent.cfg" and D:\Program Files\Okuma\Okuma MT Connect Adapter\Devices.xml, will warm start if they change. 2022-11-01T12:10:07.767055Z (0x00003b14) [info] SessionImpl::requested: ReST Request: From [127.0.0.1:52259]: GET /probe 2022-11-01T12:10:07.770057Z (0x00003b14) [info] SessionImpl::requested: ReST Request: From [127.0.0.1:52259]: GET /current 2022-11-01T12:10:07.773058Z (0x00003b14) [info] SessionImpl::requested: ReST Request: From [127.0.0.1:52259]: GET /sample?from=1&count=200&interval=500 2022-11-01T12:10:07.777055Z (0x00003b14) [info] SessionImpl::requested: ReST Request: From [127.0.0.1:52263]: GET /assets/123456.98 2022-11-01T12:10:08.695058Z (0x00003b14) [debug] Connector::heartbeat: Sending heartbeat 2022-11-01T12:10:08.696059Z (0x00003b14) [debug] Connector::heartbeat->Connector::sendCommand: (Port:52247) Sending PING 2022-11-01T12:10:08.698057Z (0x00003b14) [debug] Connector::reader->Connector::parseSocketBuffer->Connector::processLine: (Port:52247) Received a PONG for localhost on port 7878 2022-11-01T12:10:16.642057Z (0x00003b14) [debug] AgentConfiguration::monitorThread: Monitoring files: "D:\Program Files\Okuma\Okuma MT Connect Adapter\agent.cfg" and D:\Program Files\Okuma\Okuma MT Connect Adapter\Devices.xml, will warm start if they change. 2022-11-01T12:10:18.705056Z (0x00003b14) [debug] Connector::heartbeat: Sending heartbeat 2022-11-01T12:10:18.719058Z (0x00003b14) [debug] Connector::heartbeat->Connector::sendCommand: (Port:52247) Sending PING 2022-11-01T12:10:18.720058Z (0x00003b14) [debug] Connector::reader->Connector::parseSocketBuffer->Connector::processLine: (Port:52247) Received a PONG for localhost on port 7878 2022-11-01T12:10:23.549057Z (0x00003b14) [warning] SessionImpl::requested->Session::fail: Operation failed: Could not read request 2022-11-01T12:10:23.557058Z (0x00003b14) [warning] SessionImpl::requested->Session::fail: Closing: The socket was closed due to a timeout - The socket was closed due to a timeout 2022-11-01T12:10:23.561061Z (0x00003b14) [warning] SessionImpl::requested->Session::fail: Operation failed: Could not read request 2022-11-01T12:10:23.563065Z (0x00003b14) [warning] SessionImpl::requested->Session::fail: Closing: The socket was closed due to a timeout - The socket was closed due to a timeout 2022-11-01T12:10:23.813090Z (0x00003b14) [warning] SessionImpl::requested->Session::fail: Operation failed: Could not read request 2022-11-01T12:10:23.813090Z (0x00003b14) [warning] SessionImpl::requested->Session::fail: Closing: The socket was closed due to a timeout - The socket was closed due to a timeout 2022-11-01T12:10:26.656055Z (0x00003b14) [debug] AgentConfiguration::monitorThread: Monitoring files: "D:\Program Files\Okuma\Okuma MT Connect Adapter\agent.cfg" and D:\Program Files\Okuma\Okuma MT Connect Adapter\Devices.xml, will warm start if they change. 2022-11-01T12:10:28.722126Z (0x00003b14) [debug] Connector::heartbeat: Sending heartbeat 2022-11-01T12:10:28.723160Z (0x00003b14) [debug] Connector::heartbeat->Connector::sendCommand: (Port:52247) Sending PING 2022-11-01T12:10:28.726125Z (0x00003b14) [debug] Connector::reader->Connector::parseSocketBuffer->Connector::processLine: (Port:52247) Received a PONG for localhost on port 7878 2022-11-01T12:10:28.729127Z (0x00003b14) [error] Connector::reader: End of file: End of file 2022-11-01T12:10:28.730125Z (0x00003b14) [error] Connector::reader->Connector::reconnect->Connector::close: Closing localhost:7878 (Local Port:52247) 2022-11-01T12:10:28.731126Z (0x00003b14) [debug] Connector::reader->Connector::reconnect->Connector::close: Disconnected from adapter, setting all values to UNAVAILABLE 2022-11-01T12:10:28.732127Z (0x00003b14) [info] Connector::reader->Connector::reconnect: reconnect: retry connection in 10000ms 2022-11-01T12:10:36.666128Z (0x00003b14) [debug] AgentConfiguration::monitorThread: Monitoring files: "D:\Program Files\Okuma\Okuma MT Connect Adapter\agent.cfg" and D:\Program Files\Okuma\Okuma MT Connect Adapter\Devices.xml, will warm start if they change. 2022-11-01T12:10:36.668133Z (0x00003b14) [warning] AgentConfiguration::monitorThread: Detected change in configuration files. Will reload when youngest file is at least 1 seconds old 2022-11-01T12:10:36.672129Z (0x00003c10) [info] MAIN->Agent::receiveDevice: Updating device OKUMA.Lathe.123456 to new device model 2022-11-01T12:10:36.673126Z (0x00003c10) [info] MAIN->Agent::receiveDevice: Device OKUMA.Lathe.123456 changed, updating mappings 2022-11-01T12:10:37.785125Z (0x00000ca8) [warning] SessionImpl::requested->Session::fail: Operation failed: Could not read request 2022-11-01T12:10:37.786128Z (0x00000ca8) [warning] SessionImpl::requested->Session::fail: Closing: The socket was closed due to a timeout - The socket was closed due to a timeout 2022-11-01T12:10:38.736125Z (0x00000ca8) [info] : reconnect: retrying connection 2022-11-01T12:10:38.737130Z (0x00000ca8) [debug] Connector::connect: Connecting to data source: localhost on port: 7878 2022-11-01T12:10:41.178126Z (0x00000ca8) [info] Connector::connected: Connected with: 127.0.0.1:7878 2022-11-01T12:10:41.179127Z (0x00000ca8) [debug] Connector::connected->Connector::sendCommand: (Port:52275) Sending PING 2022-11-01T12:10:41.183125Z (0x00000ca8) [debug] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::protocolCommand: Processing command: adapterversion: adapterVersion:5.0.0.1 2022-11-01T12:10:41.185126Z (0x00000ca8) [warning] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::protocolCommand: Cannot find data item for the Agent device when processing command adapterversion with value 5.0.0.1 for adapter _7714929c63 2022-11-01T12:10:41.187124Z (0x00000ca8) [debug] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::protocolCommand: Processing command: adapterversion: adapterVersion:5.0.0.1 2022-11-01T12:10:41.189124Z (0x00000ca8) [warning] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::protocolCommand: Cannot find data item for the Agent device when processing command adapterversion with value 5.0.0.1 for adapter _7714929c63 2022-11-01T12:10:41.191124Z (0x00000ca8) [debug] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::protocolCommand: Processing command: mtconnectversion: mtconnectVersion:1.3 2022-11-01T12:10:41.194126Z (0x00000ca8) [warning] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::protocolCommand: Cannot find data item for the Agent device when processing command mtconnectversion with value 1.3 for adapter _7714929c63 2022-11-01T12:10:41.197124Z (0x00000ca8) [debug] Connector::reader->Connector::parseSocketBuffer->Connector::processLine: (Port:52275) Received a PONG for localhost on port 7878 2022-11-01T12:10:41.198124Z (0x00000ca8) [debug] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->Connector::startHeartbeats: (Port:52275)Received PONG, starting heartbeats every 10000ms 2022-11-01T12:10:43.740126Z (0x00000ca8) [info] SessionImpl::requested: ReST Request: From [127.0.0.1:52277]: GET /assets/123456.98 2022-11-01T12:10:46.682126Z (0x00000ca8) [debug] AgentConfiguration::monitorThread: Monitoring files: "D:\Program Files\Okuma\Okuma MT Connect Adapter\agent.cfg" and D:\Program Files\Okuma\Okuma MT Connect Adapter\Devices.xml, will warm start if they change. 2022-11-01T12:10:46.684126Z (0x00000ca8) [debug] AgentConfiguration::monitorThread: Setting device and config times 2022-11-01T12:10:51.206123Z (0x00000ca8) [debug] Connector::heartbeat: Sending heartbeat 2022-11-01T12:10:51.207154Z (0x00000ca8) [debug] Connector::heartbeat->Connector::sendCommand: (Port:52275) Sending PING 2022-11-01T12:10:51.208169Z (0x00000ca8) [debug] Connector::reader->Connector::parseSocketBuffer->Connector::processLine: (Port:52275) Received a PONG for localhost on port 7878 2022-11-01T12:10:56.217863Z (0x00000ca8) [info] SessionImpl::requested: ReST Request: From [127.0.0.1:52286]: GET /current

D:\Program Files\Okuma\Okuma MT Connect Adapter>

wsobel commented 2 years ago

Try RC 24-changes the way device changes are handled and updates to the observations. Now handles orphaning correctly.

wsobel commented 1 year ago

I just changed the behavior of the device file reload to warm start the agent if the version changes. I also improved version handling.

There are too many edge cases when versions change, better to start clean.

hulinning2 commented 1 year ago

Will, RC25 fixed the issue.

Thanks