Professional OPC
Development Tools

logos

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.

Can Develop OPC XML DA C++ client in Visual Studio 2015?

More
18 Jan 2017 09:21 - 18 Jan 2017 09:23 #4785 by Vasanth
Hi,

Sorry for the late reply, Between I tried to make workaround solution but again I am not succeed.
Now, I have modified my design itself due this hang issue. I am not running server connection checking threads now, the other 3 secs based threads itself will take care of connection. And I am getting one issue which is probably EasyDAClient pointer is not released properly. There are multiple API's for this which one I have to use for proper deallocation of this object. Please clarify. And also attached event viewer log took from actual production machine.

ClientPtr->UnsubscribeAllItems();
//ClientPtr->Release();
//ClientPtr.Release();
ClientPtr.Detach();







Here is my reply,

Questions:

Q1. Please confirm that so far, you were not able to reproduce the hang in ReadMultipleItems with our recent sample (the one that does *repeated* reads) when connecting to our demo XML-DA server. This is just to make sure we understand it right.

Answer: Yes


Q2. Does the hang within ReadMultipleItems occur in your normal production even when there are not apparent problems with the network or the server, OR is it always related to network or server problems (either real or simulated ones)?

Answer: I have 3 OpcXmlDa server, In that one server doesn't have any issue it runs properly, In fact its running past 1 month and no issues. I do have problems with other 2 servers where these servers goes down frequently and I am facing these hang issue. And all are real servers.

Q3. Which operating system are you using (on the client side)?

Answer: On client side I use Windows 7 OS

Q4. Please clarify what you mean by "I have moved all my ... threads are into asynchronous execution, so threads are running always irrespective ReadMultipleItems function is hung or not by creating and terminating threads.". Which functions do you use to create the threads, and how do you terminate them?

Answer: I have followed synchronous way of creating threads previously, Since hang issue I have modified my thread generation into Asynchronous way so that whenever it hung for particular time interval the thread will be terminated and new threads will be generated.

hThread = CreateThread(NULL, 0, threadAysncOpcXmlDa, &(ptrAsyncSetOpcXmlDa1), 0, 0);
WaitForSingleObject(hThread, 40000);
TerminateThread(hThread, 0);



Actions:

A1. If possible, please send us your source code. If you do not want to expose it on the forums, it can be done via email, to support09 (at) opclabs.com .

Answer: Yes I will send you the code in separate mail to above mentioned id .


A2. Because you have written that it was possible to reproduce the issue with our sample code earlier, and the server has not changed, please continue trying, because it should be still possible. Capture the call stacks then. (this should be with the recent sample, the one that does *repeated* reads).

Answer: For this already I have shared callstacks, with latest sample code (*repeated* reads) i am not able to reproduce the issue for quickOPC demo xml server

A3. Can you please modify our sample code (again, the one that does *repeated* reads) so that it connects to your XML-DA server (and uses some items in your server), and attempt to reproduce the issue? If it hangs in ReadMultipleItems, capture the call stacks in that state.

Answer: I have executed our latest sample code (the one that does *repeated* reads) in my problematic server and hang issue is reproduced since its client machine does not have visual studio and unable to take call stacks.
Last edit: 18 Jan 2017 09:23 by Vasanth. Reason: attchement missing

Please Log in or Create an account to join the conversation.

More
12 Jan 2017 12:11 #4748 by support
Hello.


Information:

I1. There was no change to the XML-DA demo server during the period it was not accessible.

I2. There is no "artifical" limit on how many EasyDAClient objects you can create. But creating more and more EasyDAClient objects without having a way to properly dispose of existing ones (which is impossible if calls to them is hung) is not a solution. Each EasyDAClient consumes resources (memory, threads, possibly other), so at some point it is guaranteed to fail. You have not given details of the "crash", so it's not possible to tell exactly what has happened, but it is not really important anyway. In addition, the EasyDAClient objects share a common execution engine underneath, and if calls in preceding EasyDAClient-s are hung, the calls on new EasyDAClient objects will hang as well. This is not the way to go.


Questions:

Q1. Please confirm that so far, you were not able to reproduce the hang in ReadMultipleItems with our recent sample (the one that does *repeated* reads) when connecting to our demo XML-DA server. This is just to make sure we understand it right.

Q2. Does the hang within ReadMultipleItems occur in your normal production even when there are not apparent problems with the network or the server, OR is it always related to network or server problems (either real or simulated ones)?

Q3. Which operating system are you using (on the client side)?

Q4. Please clarify what you mean by "I have moved all my ... threads are into asynchronous execution, so threads are running always irrespective ReadMultipleItems function is hung or not by creating and terminating threads.". Which functions do you use to create the threads, and how do you terminate them?


Actions:

A1. If possible, please send us your source code. If you do not want to expose it on the forums, it can be done via email, to support09 (at) opclabs.com .

A2. Because you have written that it was possible to reproduce the issue with our sample code earlier, and the server has not changed, please continue trying, because it should be still possible. Capture the call stacks then. (this should be with the recent sample, the one that does *repeated* reads).

A3. Can you please modify our sample code (again, the one that does *repeated* reads) so that it connects to your XML-DA server (and uses some items in your server), and attempt to reproduce the issue? If it hangs in ReadMultipleItems, capture the call stacks in that state.


Thank you

Please Log in or Create an account to join the conversation.

More
11 Jan 2017 05:51 - 11 Jan 2017 12:12 #4746 by Vasanth
Hi,

The issue is not reproduced in the sample code which you shared, But still issue is reproduced in production. Please check the attached log files, it hangs after ReadmultipleItems function executed that means in log it is "Before ReadMultipleItems." It hung there almost 8 hours and I restarted it again.

hung time: 2017-1-10T19:3:48Z
restarted time: 2017-1-11T04:53:22Z


I am creating 4 threads

1. for 1 secs scan interval
2. for 5 secs scan interval
3. for 15 secs scan interval
4. for Check server status continuously

All these threads are sharing global com initialization (CoInitializeEx(NULL, COINIT_MULTITHREADED) )and each thread is having its own client ptr created (_EasyDAClientPtr ClientPtr(__uuidof(EasyDAClient));) and other logic's are same as in sample code only.

This hang issue was reproduced before with sample code and its not now. Is there any change in server? Because yesterday server went down for couple of hours?

I am trying asynchronous way of calling all threads but somehow its failing now. I request you guys please share us any workaround/solution to address this issue. its nightmare for us now.

If you want I can share my implementation logic also.

I am adding some more observation,

As I mentioned above I have moved all my secs (3 threads) based threads are into asynchronous execution, so threads are running always irrespective ReadMultipleItems function is hung or not by creating and terminating threads. In that case these threads are keep creating ClientPtr (_EasyDAClientPtr ClientPtr(__uuidof(EasyDAClient))) and continuing execution where server connection itself lost.

Parallelly I am running one more while loop continuously to check the server connection which follows synchronous execution, here ReadMultipleItems functions gets hung and stays there only. meantime my secs based threads are crashing on ClientPtr (_EasyDAClientPtr ClientPtr(__uuidof(EasyDAClient))

Therefore, My doubt now is how many ClientPtr should be created? is there any limitations on this?
Because of this reason only you guys are not able to reproduce the issue I guess.

Please let me know your input.


Thanks







File Attachment:

File Name: OpcXmlDaDa..._log.txt
File Size:728 KB
Attachments:
Last edit: 11 Jan 2017 12:12 by Vasanth. Reason: some more observation

Please Log in or Create an account to join the conversation.

More
10 Jan 2017 11:17 #4743 by support

Please Log in or Create an account to join the conversation.

More
10 Jan 2017 08:13 #4742 by Vasanth
Hi,

Looks like OpcXmlDa server is down,

opcxml.demo-this.com/XmlDaSampleServer/Service.asmx

Please check.

Please Log in or Create an account to join the conversation.

More
09 Jan 2017 20:07 - 09 Jan 2017 20:08 #4741 by support
Unfortunately the call stack provided has not allowed the developer to figure out the reason.

He therefore continued to attempt to reproduce the issue on our side, but still was not successful with that. He was using a modified C++ application which calls ReadsMultipleItems, but does so repeatedly, with some delay in between, and was simulating networking and other problems during the test.

There is a suspicion that the issue may be related to something else that happens elsewhere in your application.

We would therefore like to ask you whether you can try to reproduce the issue (the indefinite "block" in ReadMultipleItems) on your side, with the code attached to this post (instead of your own app code) - either unmodified, or just targeted to your server and items, but otherwise the same (and, if the problem appears with his code, capture the call stacks again).



File Attachment:

File Name: ReadMultip...sXml.zip
File Size:1 KB




Also, can you please indicate (roughly) how long have you waited before you claim the ReadMultipleItems be "hung"? Was it e.g. 10 seconds, 1 minute, 10 minutes ? This is quite important. Please use at least 2 minutes in this test.

Thank you, and best regards
Attachments:
Last edit: 09 Jan 2017 20:08 by support.

Please Log in or Create an account to join the conversation.

More
06 Jan 2017 09:23 #4740 by Vasanth
Hi,

I just verified keep-alive connection, refer attached image. Therefore QuickOPC supports keep-alive connection.

But, Still I have hang issue to be solved. Please let me know any solution/fix to run my production continuously. Its really critical for us now. Please help.

Thanks
Attachments:

Please Log in or Create an account to join the conversation.

More
05 Jan 2017 19:04 #4739 by support
With some simplification, inside one process, and assuming that you do not explicitly set the .Isolated property on EasyDAClient to 'true', QuickOPC will use at maximum one connection to any given server URL.

When we close the OPC connection, the system can probably actually keep the TCP connection open for some time. This is a system behavior over which we have little or no influence, and which would affect any OPC XML client, no matter how written. But the "closed" connection will only remain open for some time, so even if this delay caused multiple connections temporarily, the extra ones will be closed anyway a bit later. An OPC server must generally be written to accept multiple connections anyway.

Note: The issue with a control not returning from ReadMultipleItems is still "at works" with the developer. I will let you know when I have more info.
The following user(s) said Thank You: Vasanth

Please Log in or Create an account to join the conversation.

More
05 Jan 2017 12:35 - 05 Jan 2017 12:55 #4738 by Vasanth
Hi,

Do you have any update for me? I have attached production log at that time of hanging and before.
And I also put logs for ReadMultipleItems before and after execution, I am calling this function in two threads one is to check server connection continuously and other one is actual tags execution.

Finally it hangs while checking Connection Status ReadMultipleItems, check the log file please it might help you guys to locate the issue.

2017-1-5T10:11:37Z COPCXMLDAClient: checkServerConStatus: ReadMultipleItems call check

This is a log before calling ReadMultipleItems and after this no logs since it got hanged.

Thanks.

File Attachment:

File Name: ProductionLog.txt
File Size:5 KB
Attachments:
Last edit: 05 Jan 2017 12:55 by Vasanth. Reason: missed a point

Please Log in or Create an account to join the conversation.

More
03 Jan 2017 11:20 #4737 by Vasanth
Okay, Thankyou. Please let us know the update ASAP.

Regarding .Net Application, Its (.NET) -> Demo Application (OPC XML-enabled) only, while typing I missed "-this", Check the attached image.

I have one more query, While connecting OpcXmlDa server from QuickOPC SDK's, it does follow keep-alive mechanism? As I already reported an error which you said login is reattempted, its due to server is exhausted with multiple connection and that why its reattempting? Every time I connect (ex: each 5 secs) to OpcXmlDa server, new connection is established?

Please confirm.
Attachments:

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.085 seconds