Agent is suddenly closing itself
Hello, I am currently working with the cpp agent version 2.3.0.9 and with multiple adapters. When I started only the agent, it worked and tried to connect the adapter. However, When I started the adapter and agent together, the agent worked and after a few minutes closed itself without giving an error or anything. Besides, when I started the adapter first and it runed for a while, I could not start the agent. It opens and closes itself suddenly. What do you think about my situation and do you have any suggestions?
Thank you,
I need to see your configuration files and get some more context. Also, any log files you have from the agent or the adapters would be helpful. (Sent from mobile)On May 17, 2024, at 07:51, Okan Berhoğlu @.***> wrote: Hello, I am currently working with the cpp agent version 2.3.0.9 and with multiple adapters. When I started only the agent, it worked and tried to connect the adapter. However, When I started the adapter and agent together, the agent worked and after a few minutes closed itself without giving an error or anything. Besides, when I started the adapter first and it runed for a while, I could not start the agent. It opens and closes itself suddenly. What do you think about my situation and do you have any suggestions? Thank you,
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>
Did this happen with previous versions?(Sent from mobile)On May 17, 2024, at 07:51, Okan Berhoğlu @.***> wrote: Hello, I am currently working with the cpp agent version 2.3.0.9 and with multiple adapters. When I started only the agent, it worked and tried to connect the adapter. However, When I started the adapter and agent together, the agent worked and after a few minutes closed itself without giving an error or anything. Besides, when I started the adapter first and it runed for a while, I could not start the agent. It opens and closes itself suddenly. What do you think about my situation and do you have any suggestions? Thank you,
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>
Yes, this happened with different versions. Agent Config File:
Devices = ./Devices.xml SchemaVersion = 2.0 Port = 5000 MonitorConfigFile = true Pretty = true BufferSize = 17 LegacyTimeout = 2000
Files { schemas { Path = ./schemas Location = /schemas/ } }
Adapters { controller { Device = m-10 Port = 7878 Host = 127.0.0.1 } controller { Device = m-12 Port = 7879 Host = 127.0.0.1 } controller { Device = m-11 Port = 7880 Host = 127.0.0.1 } }
logger_config { logger_level = debug }
Agents log:
2024-05-17T12:07:07.807020Z (0x000099d8) [info] MAIN->AgentConfiguration::initialize->AgentConfiguration::loadConfig: Starting agent on port 5000 2024-05-17T12:07:07.817185Z (0x000099d8) [info] MAIN->AgentConfiguration::initialize->AgentConfiguration::loadConfig->Agent::initialize->Agent::loadXMLDeviceFile: MTConnect Schema Version of file: C:\Users\Okan\Desktop\DataCollection\Agent\Devices.xml = 2.0 2024-05-17T12:07:07.817185Z (0x000099d8) [error] MAIN->AgentConfiguration::initialize->AgentConfiguration::loadConfig->Agent::initialize->Agent::loadXMLDeviceFile: Duplicate component id: m-10 for device m-10, skipping 2024-05-17T12:07:07.817185Z (0x000099d8) [error] MAIN->AgentConfiguration::initialize->AgentConfiguration::loadConfig->Agent::initialize->Agent::loadXMLDeviceFile: Duplicate component id: m-12 for device m-12, skipping 2024-05-17T12:07:07.817185Z (0x000099d8) [error] MAIN->AgentConfiguration::initialize->AgentConfiguration::loadConfig->Agent::initialize->Agent::loadXMLDeviceFile: Duplicate component id: m-11 for device m-11, skipping 2024-05-17T12:07:07.827202Z (0x000099d8) [info] MAIN->AgentConfiguration::initialize->AgentConfiguration::loadConfig->AgentConfiguration::loadAdapters: shdr: Adding adapter for m-10: controller 2024-05-17T12:07:07.827202Z (0x000099d8) [info] MAIN->AgentConfiguration::initialize->AgentConfiguration::loadConfig->AgentConfiguration::loadAdapters: shdr: Adding adapter for m-12: controller 2024-05-17T12:07:07.827202Z (0x000099d8) [info] MAIN->AgentConfiguration::initialize->AgentConfiguration::loadConfig->AgentConfiguration::loadAdapters: shdr: Adding adapter for m-11: controller 2024-05-17T12:07:07.833274Z (0x0000a540) [info] Connector::connected: Connected with: 127.0.0.1:7879 2024-05-17T12:07:07.833274Z (0x0000a540) [info] Connector::connected: Connected with: 127.0.0.1:7880
Can you capture the adapter output? That would be helpful. - W
On 17 May 2024, at 08:11, Okan Berhoğlu @.***> wrote:
Yes, this happened with different versions. Agent Config File:
Devices = ./Devices.xml SchemaVersion = 2.0 Port = 5000 MonitorConfigFile = true Pretty = true BufferSize = 17 LegacyTimeout = 2000
Files { schemas { Path = ./schemas Location = /schemas/ } }
Adapters { controller { Device = m-10 Port = 7878 Host = 127.0.0.1 } controller { Device = m-12 Port = 7879 Host = 127.0.0.1 } controller { Device = m-11 Port = 7880 Host = 127.0.0.1 } }
logger_config { logger_level = debug }
Agents log:
2024-05-17T12:07:07.807020Z (0x000099d8) [info] MAIN->AgentConfiguration::initialize->AgentConfiguration::loadConfig: Starting agent on port 5000 2024-05-17T12:07:07.817185Z (0x000099d8) [info] MAIN->AgentConfiguration::initialize->AgentConfiguration::loadConfig->Agent::initialize->Agent::loadXMLDeviceFile: MTConnect Schema Version of file: C:\Users\Okan\Desktop\DataCollection\Agent\Devices.xml = 2.0 2024-05-17T12:07:07.817185Z (0x000099d8) [error] MAIN->AgentConfiguration::initialize->AgentConfiguration::loadConfig->Agent::initialize->Agent::loadXMLDeviceFile: Duplicate component id: m-10 for device m-10, skipping 2024-05-17T12:07:07.817185Z (0x000099d8) [error] MAIN->AgentConfiguration::initialize->AgentConfiguration::loadConfig->Agent::initialize->Agent::loadXMLDeviceFile: Duplicate component id: m-12 for device m-12, skipping 2024-05-17T12:07:07.817185Z (0x000099d8) [error] MAIN->AgentConfiguration::initialize->AgentConfiguration::loadConfig->Agent::initialize->Agent::loadXMLDeviceFile: Duplicate component id: m-11 for device m-11, skipping 2024-05-17T12:07:07.827202Z (0x000099d8) [info] MAIN->AgentConfiguration::initialize->AgentConfiguration::loadConfig->AgentConfiguration::loadAdapters: shdr: Adding adapter for m-10: controller 2024-05-17T12:07:07.827202Z (0x000099d8) [info] MAIN->AgentConfiguration::initialize->AgentConfiguration::loadConfig->AgentConfiguration::loadAdapters: shdr: Adding adapter for m-12: controller 2024-05-17T12:07:07.827202Z (0x000099d8) [info] MAIN->AgentConfiguration::initialize->AgentConfiguration::loadConfig->AgentConfiguration::loadAdapters: shdr: Adding adapter for m-11: controller 2024-05-17T12:07:07.833274Z (0x0000a540) [info] Connector::connected: Connected with: 127.0.0.1:7879 2024-05-17T12:07:07.833274Z (0x0000a540) [info] Connector::connected: Connected with: 127.0.0.1:7880
— Reply to this email directly, view it on GitHub https://github.com/mtconnect/cppagent/issues/456#issuecomment-2117458870, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ6BCN6YTK6I7C2WHPQOYTZCXXWBAVCNFSM6AAAAABH37XJZ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJXGQ2TQOBXGA. You are receiving this because you commented.
The adapter is sending shdr data continuously in a infinite loop even if data is not change. Is that a problem for agent?
Shouldn’t be.
To reproduce the issue, I need some more data. Can you capture the output from the adapter? If there is some data that is not correct or is causing the agent to throw an exception I don’t catch.
The more information you give me the better chance I have of fixing.
I am using the DotNetAdapterSDK Nuget package for sending data. I am using the packages' functions. Therefore I can not capture the output.
I used a different cpp agent version and it gave this error:
2024-05-17T14:28:45.349360Z (0x000077c4) [info] Connector::connected: Connected with: 127.0.0.1:7878 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument 2024-05-17T14:28:47.892970Z (0x000077c4) [error] Connector::reader->Connector::parseSocketBuffer->Connector::processLine->ShdrAdapter::processData: Error in processData: invalid stod argument
You can capture the output by connecting to the socket. There are some example in the tools directory. \
This is helpful. There may be an exception that is not being caught. I need to see the data that caused the issue. Can you log the data from your adapter?
- W
I have gone through every usage of stod and nothing throws. I'm trying to reproduce. I really need the adapter output to know what is causing this problem. Without it, I cannot debug.
There is a ruby script called "dump_adapter.rb" in the tools directory. Run on the command line like this:
C:> ruby dump_adapter.rb 127.0.0.1 7878 adapter.log
replace 127.0.0.1 and 7878 with the adapter host and port in the cfg file.
Another option is to set the logging level to trace:
logger_config {
level = trace
}
Thank you very much for your help. I found the data causing this problem and fixed it.
Can you please share what the data was. I'd like to fix it in the agent.
It was the G code data. The Adapter was sending G code line that contains numbers and letters. In my opinion, agent tries to convert this data string to double but it also contains letters so agent throws error and closes itself.
What was the data item?(Sent from mobile)On May 20, 2024, at 14:40, Okan Berhoğlu @.***> wrote: It was the G code data. The Adapter was sending G code line that contains numbers and letters. In my opinion, agent tries to convert this data string to double but it also contains letters so agent throws error and closes itself.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you modified the open/close state.Message ID: @.***>
@okanberhoglu
I would like to see if I can reproduce this issue, please give the info you found to resolve it.
The data is like "G23G7I-9.1 G30G5X23".
Please send the DataItem xml as well. I would like to see what could be going wrong. When I tested it gave me an illegal conversion.
One other thing, what platform are you using? Windows.
Thanks a lot for the help!
Yes, I am using Windows. The DataItem xml is /<DataItem category="EVENT" id="line" type="MESSAGE"//>
Btw. The message is not the right type for this data item. It should be a BLOCK. Regardless, it is also supposed to take 3 values, the data item name, native code, and the value.
This should help narrow down the issue quite a lot. I'll try to reproduce with a message.
Thanks W
Thank you for the help.
I'll close this if it is no longer an issue. Please respond.