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.

ReadItemValue Error

More
22 Dec 2020 06:50 #9307 by support
Replied by support on topic ReadItemValue Error
Hello,
I do not see any problem with your code.

I disagree with your reasoning "I am connecting to my custom server, so I tried your VBNET demo application and it found my custom server and it connected to it and I was able to see my tags and read/write without issues, so this tells me my custom server is functioning properly and the problem must be in my client side."

The problem can be on the server side or on the client side, it is not possible to tell yet. The fact that the server and the client are combined in one process, although it is not wrong, can lead to all kinds of problems, for example, with COM threading models, or COM security settings. The two libraries you are using may be in conflict.

Can you please
1. Check that you do not have any messages about exception in the debugger output when this happens.
2. Check that you do not have any suspicious messages in Windows Logs (Event Viewer) around the time when this happens
3. Check that DCOM is not attempting to launch a second instance of your process when this happens, possibly under a different user: Use e.g. Task Manager set to display processes from all users, sorted by name.
4. Obtain the call stacks - see kb.opclabs.com/Troubleshooting_program_hangs . The article refer to "program hangs", but you can use it nevertheless; the stacks can be obtained after you receive the timeout error, or even before that (but after you initiated the connection), because there probably isn't anything during the "long" wait.

Explanation to some parts of your answer:
a. Obtaining an item subscription handle *always* succeeds, so no wonder it had succeeded. It does not do any OCP-related operations synchronously at that moment at all.
b. I am not sure why you are subscribing if you actually doing read. It is not necessary to subscribe in order to make a read.

Best regards

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

More
22 Dec 2020 06:50 #9306 by support
Replied by support on topic ReadItemValue Error
Hello,
I do not see any problem with your code.

I disagree with your reasoning "I am connecting to my custom server, so I tried your VBNET demo application and it found my custom server and it connected to it and I was able to see my tags and read/write without issues, so this tells me my custom server is functioning properly and the problem must be in my client side."

The problem can be on the server side or on the client side, it is not possible to tell yet. The fact that the server and the client are combined in one process, although it is not wrong, can lead to all kinds of problems, for example, with COM threading models, or COM security settings. The two libraries you are using may be in conflict.

Can you please
1. Check that you do not have any messages about exception in the debugger output when this happens.
2. Check that you do not have any suspicious messages in Windows Logs (Event Viewer) around the time when this happens
3. Check that DCOM is not attempting to launch a second instance of your process when this happens, possibly under a different user: Use e.g. Task Manager set to display processes from all users, sorted by name.
4. Obtain the call stacks - see kb.opclabs.com/Troubleshooting_program_hangs . The article refer to "program hangs", but you can use it nevertheless; the stacks can be obtained after you receive the timeout error, or even before that (but after you initiated the connection), because there probably isn't anything during the "long" wait.

Explanation to some parts of your answer:
a. Obtaining an item subscription handle *always* succeeds, so no wonder it had succeeded. It does not do any OCP-related operations synchronously at that moment at all.
b. I am not sure why you are subscribing if you actually doing read. It is not necessary to subscribe in order to make a read.

Best regards

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

More
19 Dec 2020 18:51 #9301 by PythonByte
Replied by PythonByte on topic ReadItemValue Error
Thank for your reply,
This has been consistent, the handle I get back is when I subscribe using the SubscribeItem event which it works fine. I am connecting to my custom server, so I tried your VBNET demo application and it found my custom server and it connected to it and I was able to see my tags and read/write without issues, so this tells me my custom server is functioning properly and the problem must be in my client side.
I also tried to connect to my custom server using Matrikon and I was able to connect and browse so this confirms my client side theory.

I compared your code with mine and its identical. I think the problem is in the EasyDAClient object initialization as I am using it in a service (I don't have a form to drag and drop it on). This is how I have it in my Setup method. Let me know if you see anything fishy (It was working in Framework 3.5 version before upgrading to 5.59 & Framework 4.7.2)

Private WithEvents m_opcClient As EasyDAClient

m_opcClient = New EasyDAClient 'Create OPC client reference
m_opcClient.Isolated = True
m_opcClient.InstanceParameters.Mode.AllowAsynchronousMethod = True ' I also tried to set it to False. It didn't work
m_opcClient.InstanceParameters.Mode.AllowSynchronousMethod = True
m_opcClient.InstanceParameters.Mode.DesiredMethod = Engine.DAReadWriteMethod.Synchronous

'Removed on 2020-Dec-07: newly designed EasyDAClient doesn't have DataSource member anymore. DataSource member can be defined in DAReadItemArguments.
'm_opcClient.ClientMode.DataSource = DataAccess.DADataSource.Device


m_opcClient.InstanceParameters.HoldPeriods.TopicRead = 5000
m_opcClient.InstanceParameters.HoldPeriods.TopicWrite = 5000
m_opcClient.InstanceParameters.HoldPeriods.ItemDetach = 5000
m_opcClient.InstanceParameters.HoldPeriods.ServerDetach = 5000

m_opcClient.InstanceParameters.Timeouts.ReadItem = 10000
m_opcClient.InstanceParameters.Timeouts.WriteItem = 10000
m_opcClient.InstanceParameters.Timeouts.GetProperty = 10000
m_opcClient.InstanceParameters.Timeouts.BrowseAccessPaths = 10000
m_opcClient.InstanceParameters.Timeouts.BrowseNodes = 10000
m_opcClient.InstanceParameters.Timeouts.BrowseProperties = 10000
m_opcClient.InstanceParameters.Timeouts.BrowseServers = 10000

Exception:
An OPC operation failure with error ID 'RawEasyDAClient.HResult=0xC004C001' occurred, originating from '' and with depth of 1. The inner exception contains details about the problem.

inner exception is:
Cannot connect Data Access client (timeout).
+ The client method called was 'ReadMultipleItems'.

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

More
19 Dec 2020 14:27 #9300 by support
Replied by support on topic ReadItemValue Error
Hello,
please clarify:

1. What do you mean by "...and I get a handle". Do you mean the handle you get when calling one of the Subscribe methods on EasyDAClient? If so, that is for subscriptions - so it is not really related to ReadItemValue value that throws exception? And, if you are using subscription on the same tag, do they work?

2. I understand you have both OPC server and OPC client in the same application. With this problem, are you connecting from the OPC client to your "own" OPC server in the same application, or to some other OPC server, that is external to the application (although on the same machine)?

3. Does this happen always, or just sometimes (transient error?)

Thank you

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

More
18 Dec 2020 15:35 - 18 Dec 2020 21:24 #9297 by PythonByte
Guys,
My app has a server (SLIKDA) and a client QuickOPC 5.59. I see my tag registers fine and I get a handle, when I try to read the value I just registered using the following line:
Tag.Value = m_opcClient.ReadItemValue(m_MachineName, m_OPCServerName, Tag.ClientTagname)
I get the attached error, and the inner exception message shows:

Cannot connect Data Access client (timeout).
+ The client method called was 'ReadMultipleItems'.
I am running everything on the same machine (Windows Server 2019)

I can however connect to my server using the demo VB.NET project your provided, and I can also read and write to my tags

Thanks
Attachments:
Last edit: 18 Dec 2020 21:24 by PythonByte.

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

Moderators: support
Time to create page: 0.054 seconds