Online Forums
Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.
Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.
Do not use the Contact page for technical issues.
- Forum
- Discussions
- QuickOPC-Classic in COM
- Reading, Writing, Subscriptions, Property Access
- Can Develop OPC XML DA C++ client in Visual Studio 2015?
Can Develop OPC XML DA C++ client in Visual Studio 2015?
In the current ReadMultipleItems implementation, there is at least one timeout that is set to 100 seconds and cannot be changed. This implies that before these 100 seconds elapse, one cannot decide whether the method has (incorrectly) blocked or not.
Please Log in or Create an account to join the conversation.
Does that mean ReadMultipleItems function should return in 100 secs? if 100 secs are elapsed than it wont return?
Thanks
Please Log in or Create an account to join the conversation.
There is a SOAP timeout that equals to 100 seconds and cannot be changed currently. This means that any "hang" detection should only deal with execution times longer than 100 seconds.
Please Log in or Create an account to join the conversation.
There is also a slight chance that it would also help if you can get the issue reproduced with the sample application we have provided AND you would send us the call stacks, but you have earlier written that you cannot do that.
Please Log in or Create an account to join the conversation.
I do not understand why you are not getting my point. I said clearly this TerminateThread is introduced to resolve hang issue only. Please look at my below commented code, Whatever call stack I sent you thats before introducing TerminateThread logic.
I really do not have time and I am not blaming anybody. I wanted to have a solution/workaround to address this issue. From my side I have tried lot of workaround/solution but nothing is helped till now, unless I get source code of SDK's I can't fix this issue.
Please let me know if its solvable or not, because I cant hold the issue for long time.
Thanks for understanding.
try
{
hThread = CreateThread(NULL, 0, threadAysncOpcXmlDa, &(ptrAsyncSetOpcXmlDa1), 0, &dwThreadId);
WaitForSingleObject(hThread, 40000);
//TerminateThread(hThread, 0);
GetExitCodeThread(hThread, &dwThreadId1);
ExitThread(dwThreadId1);
CloseHandle(hThread);
}
catch(...)
{
CString strFormat;
strFormat.Format("DACSystemThreadGenerator: threadSecScanTagDataOpcXmlDa: Thread Generation/Termination failed.");
DACLogger::Functions::Log(strFormat);
strFormat.Empty();
}
//printf("group %s is ended\n", strGroupName);
//BOOL readFailedStatus = ptrOpcXmlDaClient->readOpcXmlDaTagData(ptrScansetOpcXmlDa->strUrlString, ptrScansetOpcXmlDa->itemNamesCol, strGroupName, &client);
//if (!readFailedStatus)
//{
// DACSystemThreadGenerator::Functions::setThreadOPCXMLDAStopEvent();
// //printf("inside stop : %d", readFailedStatus);
//}
Please Log in or Create an account to join the conversation.
So, remove the TerminateThread from your program. Then, run the test again, and if/when it blocks, capture the call stacks. Those that we have so far are unusable because of your use of TerminateThread in the program.
Please Log in or Create an account to join the conversation.
Its possible to give some time interval for ReadMultipleItems function or callback ?
Something like below,
ReadMultipleItems(&pArgumentsArray, dwMilliseconds), If possible for you to share the source code?
We can do our required changes? Please let us know ur input.
Please Log in or Create an account to join the conversation.
Therefore, For disposing I am gonna use below lines,
ClientPtr->UnsubscribeAllItems();
ClientPtr->Release();
I do understand about TerminateThread but I don't not have any other option. Initially I was not using TerminateThread function. After the hung issue I was forced to used that, as you know the control is not returning at all from ReadMultipleItems function. FYI, TerminateThread function is used after hung issue only.
If required I can remove TerminateThread function if ReadMultipleItems function does not hung. Please let me know if you have any other solution to avoid this hung issue.
Thanks
Please Log in or Create an account to join the conversation.
I have received your source code.
Unfortunately, the code contains a call to TerminateThread. This is bad. See msdn.microsoft.com/en-us/library/windows/desktop/ms686717(v=vs.85).aspx . There are many problems with it, but here specifically, (quote from the Microsoft doc):
•If the target thread owns a critical section, the critical section will not be released.
This means that if you terminate a thread that is doing something and has acquired some locks, from that moment on nothing else in the program will be able too get pass that lock - and it will hang too. This can explain why in the call stack we have received from you, there is a thread that appears to be waiting on some lock for no reason (no other thread is running that owns the lock).
You must not call TerminateThread. Remove all its usages from your program.
Please Log in or Create an account to join the conversation.
Hope you have received my source code and Please let me know if you need more info.
Thanks
Please Log in or Create an account to join the conversation.
- Forum
- Discussions
- QuickOPC-Classic in COM
- Reading, Writing, Subscriptions, Property Access
- Can Develop OPC XML DA C++ client in Visual Studio 2015?