Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeepAliveThread Stopped! #377

Open
mustafa-erduran opened this issue Nov 13, 2020 · 1 comment
Open

KeepAliveThread Stopped! #377

mustafa-erduran opened this issue Nov 13, 2020 · 1 comment

Comments

@mustafa-erduran
Copy link

Hello everyone,
`int main(int argc, char** argv)
{

    int a = 0;
    OpcUa::UaClient* client = new OpcUa::UaClient();
   
    client->Connect("opc.tcp://127.0.0.1:49320");

    OpcTransaction Transaction(client,
        std::string("ns=2;s=Channel2.Device1.Global.AAA_Trigger"),
        std::string("ns=2;s=Channel2.Device1.Global.AAA_Ack"));

    Transaction.TransactionTags.push_back(TransactionTag(std::string("ns=2;s=Channel2.Device1.Global.AAA_DINT"), 1));
    Transaction.TransactionTags.push_back(TransactionTag(std::string("ns=2;s=Channel2.Device1.Global.AAA_BOOL"), 2));
    Transaction.TransactionTags.push_back(TransactionTag(std::string("ns=2;s=Channel2.Device1.Global.AAA_REAL"), 3));

    OpcTransactionHandler THandler(&Transaction);

    THandler.start();

    OpcTransaction Transaction1(client,
        std::string("ns=2;s=Channel2.Device1.Global.BBB_Trigger"),
        std::string("ns=2;s=Channel2.Device1.Global.BBB_Ack"));

    Transaction1.TransactionTags.push_back(TransactionTag(std::string("ns=2;s=Channel2.Device1.Global.BBB_DINT"), 1));
    Transaction1.TransactionTags.push_back(TransactionTag(std::string("ns=2;s=Channel2.Device1.Global.BBB_BOOL"), 2));
    Transaction1.TransactionTags.push_back(TransactionTag(std::string("ns=2;s=Channel2.Device1.Global.BBB_REAL"), 3));

    OpcTransactionHandler THandler1(&Transaction1);

    THandler1.start();
    
   // std::this_thread::sleep_for(std::chrono::seconds(600));
    
    for (int i = 0;i < 200;i++) {

        
        std::this_thread::sleep_for(std::chrono::seconds(10));
        Node aa = client->GetNode("ns=2;s=Channel2.Device1.Prgm_AOI_TEST.ByteDataBuffer_index");
        CheckStatusCode(aa.GetAttribute(AttributeId::Value).Status);
        std::cout << aa.GetDataValue().Value.ToString() <<"\t"<< aa.GetAttribute(AttributeId::Value).Status << std::endl;

    }

    std::cout << "exiting" << std::endl;
    THandler.stop();
    client->Disconnect();

}`
This is my client code. When i run my program, "KeepAliveThread stopped" after 2-3 minutes. I don't understand why am i get this error. Can anyone help me for issue.
Thank you.

@ltaurines
Copy link

Hi,
I think your problem is the bug I describded issue #410 Race condition between "send request" and "receive response" threads.

The fix I proposed works for me.

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants