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.

EasyDAClient.ReadItem not returning

More
20 Jan 2021 09:47 #9345 by DarrenYoung
Morning,

The issue with the possible null exception in the log would be caught by a catch block and logged out, which we are not seeing. This indicates the issue lies with ReadItem not returning.

It's not a separate issue. My 2nd post was providing additional information from the Kepware server diagnostics.

Regardless, we've been meaning to update to UA for a while which we are now in the process of doing. We will retest once that has been completed and I'll raise another issue if the problem persists. We'll add a null reference guard around the logging when conducting this.

Thanks for your time.

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

More
20 Jan 2021 09:12 #9344 by support
Hello.

It was not just a "tip" on value.Value.ToString(). It is a serious issue, which not only explains the behavior you reported (the second log not generated), but also has a potential to break other things. So it needs to be fixed first. I understand it might have been a temporary solution, but you owe me an information whether fixing it has resolved the original issue or not.

Now to the rest of your post. It looks like that you are now discussing an issue different from the one you originally reported. If so, in the future, please create a separate forum thread for it.

And, it is not clear at all what the issue is. Please follow the guidelines for reporting: www.opclabs.com/forum/announcements12/2365-rules-for-forum-posts .

Regards

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

More
19 Jan 2021 19:58 #9343 by DarrenYoung
Hi,

Thanks for the quick response.

We were using a single instance when we first experienced the issue and, thinking this may be the cause, we switched to what you see currently. Thanks for the tip on the logging though this is just temporary code whilst we troubleshoot.

We currently have a lot of other activity reading and writing tags using the same code as my previous post. I've enabled diagnostics in the Kepware server and we see lines such that are included in the OPC Success attachment. When we execute the same code again when retrying to read the problematic tag (which has worked previously) we see lines such as what are in the OPC fail attachment.

Thanks
Attachments:

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

More
19 Jan 2021 19:21 - 19 Jan 2021 19:29 #9342 by support
Hello.
We are not aware of such specific problem in version 5.58.

Before we go further, I'd like you to make one code change: Please do not repeatedly instantiate and then dispose of the EasyDAClient just for one OPC read - although there is formally nothing wrong with it. The EasyDAClient object is relatively heavy-weight for it to be used in this way. I suggest that you rather create an instance of it upfront, and then use it repeatedly. You do not event have to dispose of it then (even though it inherits from IDisposable).

I have some suspicion that this mode of usage may related to the problem, so I want to get it out of the way - and let's see if that helps or not. Even if it does not, it would still be a preferred way of doing things.

And, I think that have found one potentially serious bug in your code, too: In the logging call after the ReadItem, you are always calling value.Value.ToString(). This will crash if value.Value is null - and the value.Value can be null - and it *is* null whenever the quality is Bad, for example. If this throws a NullReferenceException, your logging will not performed.

Best regards
Last edit: 19 Jan 2021 19:29 by support.

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

More
19 Jan 2021 16:29 #9340 by DarrenYoung
Hi,

We're using version 5.58.151.1 and are experiencing a intermittent, but daily, issue.

We're reading the same tag multiple times throughout the day. Often, the call to EasyDAClient.ReadItem does not return.

We have the following code:
using(var client = new EasyDAClient())
{
                    IoC.Resolve<ILog>().Log(this, "Reading tag: " + tagName);
                    var value = client.ReadItem(ComputerName, ServerName, tagName);
                    IoC.Resolve<ILog>().Log(this, "Read tag: " + tagName + " with value " + value.Value.ToString() + " with quality " + value.Quality.ToString());
                    if (!value.Quality.IsGood)
                    {
                        RaiseOperationError("Uncertain or Bad Quality reported on read for tag: " + tagName);
                    }
                    return value.Value;
 }

The majority of the time the ReadItem function returns and we log out the 2nd item. Regularly we never hit that 2nd logging entry which indicates the ReadItem method does not return. We wait for 90 seconds without any response.

The above code is wrapped in a try catch and an exception is not generated.

Is there an issue with this version, which we recently upgraded to, or is there something else we are missing?

Thanks

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

Moderators: support
Time to create page: 0.054 seconds