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.

Failure Timeout browsing nodes.

More
06 Apr 2022 16:27 #10789 by support
Hello.

I must say that I do not quite understand what precisely you are doing with all these changes. Also, I do not understand what you mean by saying that the timeout error does not come from BrowseNodes method - because, it it does not, it would not be our problem. But the error message is "ours". So you must be confusing something in this respect.

Would it be possible that you put together a "minimalistic" project that shows the problem, and send it to me? I suppose I can get the demo of the server and run it in some simulation mode too?

Regards

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

More
06 Apr 2022 13:44 #10788 by FreegE
Hi i did a modification and added a readalues in the browsing function, i also decreaced tre read item timeout to 500 ms even i i dont get the value in that time. The intrersting thing is, i dont get the timeout for browsing nodes, even if the timing looks different now, it takes 320 sec to browse thru and try to read all values (with a timeot of 500 ms), bewlow is part of my log file.

Start of browsing:
2022-04-06 15:35:39 RecursiveWithRead Browsing and reading values... with filer E1,CNT
2022-04-06 15:35:39 BrowseAndReadFromNode Börjar scanna pID Timestamp 4
2022-04-06 15:35:39 BrowseAndReadFromNode Browsat OPC pID Timestamp 706
2022-04-06 15:35:39 BrowseAndReadFromNode Börjar scanna pID 1713_04 Timestamp 707
2022-04-06 15:35:39 BrowseAndReadFromNode Browsat OPC pID 1713_04 Timestamp 710

.....

2022-04-06 15:40:59 BrowseAndReadFromNode Börjar scanna pID 6974_01.C_AS1_ELM1 Timestamp 320193
2022-04-06 15:40:59 BrowseAndReadFromNode Browsat OPC pID 6974_01.C_AS1_ELM1 Timestamp 320195
2022-04-06 15:40:59 BrowseAndReadFromNode Prenumererar på 6974_01.C_AS1_ELM1.E1 Stopwatch 320198 Antal 2
2022-04-06 15:40:59 BrowseAndReadFromNode Börjar scanna pID 6974_01.D_5201_VM2 Timestamp 320199
2022-04-06 15:40:59 BrowseAndReadFromNode Browsat OPC pID 6974_01.D_5201_VM2 Timestamp 320200
2022-04-06 15:40:59 BrowseAndReadFromNode Prenumererar på 6974_01.D_5201_VM2.CNT Stopwatch 320695 Antal 2
2022-04-06 15:40:59 BrowseAndReadFromNode Börjar scanna pID 6974_01.D_5201_VM3 Timestamp 320696
2022-04-06 15:40:59 BrowseAndReadFromNode Browsat OPC pID 6974_01.D_5201_VM3 Timestamp 320698


Hris is the part where i added the readitemvalue function...



Dim newSymbol As DataRow = DataCashe.Tables("tblPiigabData").NewRow()
newSymbol("sNode") = nodeElement.ItemId

Try
newSymbol("rValue") = Client.ReadItemValue("", ServerClass, nodeElement.ItemId).ToString.Replace(",", ".")
newSymbol("iStatus") = 1
Catch ex As Exception
newSymbol("rValue") = 0
newSymbol("iStatus") = -1
End Try


DataCashe.Tables("tblPiigabdata").Rows.Add(newSymbol)
iCount += 1
Client.SubscribeItem("", ServerClass, nodeElement.ItemId, 180000)
WriteLogFile("BrowseAndReadFromNode Prenumererar på " & nodeElement.ItemId & " Stopwatch " & Stopwatch.ElapsedMilliseconds & " Antal " & iCount.ToString)

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

More
06 Apr 2022 07:41 #10787 by FreegE
Hi,

Yes it appears so But the thing is the error happens in the calling function not in the browsing function "BrowseAndReadFromNode" where the Browse method is called. But the timing is still not near any timeout values urrently set at 120000 ms butit stops at 1700 ms, but the timeout varies from time to time, i tried now and it timedout at 600ms...

This is the calling function where the error happens:

Sub RecursiveWithRead(Optional ByVal sFilter As String = "")

Stopwatch.Start()

WriteLogFile("RecursiveWithRead Browsing and reading values... with filer " & sFilter)
' Set timeout to only wait 1 second - default would be 1 minute to wait for good quality that may never come.
Client.InstanceParameters.Timeouts.ReadItem = 120000
Client.InstanceParameters.Timeouts.BrowseNodes = 120000
Dim eventHandler = New EasyDAItemChangedEventHandler(AddressOf client_ItemChanged)
AddHandler Client.ItemChanged, eventHandler


' Do the actual browsing and reading, starting from root of OPC address space (denoted by empty string for itemId)
Try
BrowseAndReadFromNode("", sFilter)
Catch opcException As OpcException
WriteLogFile("RecursiveWithRead Failure " & opcException.GetBaseException().Message)

End Try

Stopwatch.Stop()

End Sub


And this is the browsing function with my modifications, the function puts all found nodes in a internal dataset and starts a subscrition on it, then the canged event updates the values in the table when it changes :

Private Sub BrowseAndReadFromNode(parentItemId As String, sFilter As String)


WriteLogFile("BrowseAndReadFromNode Börjar scanna pID " & parentItemId & " Timestamp " & Stopwatch.ElapsedMilliseconds)

Dim bReadValue As Boolean = False
Dim sFilterArr() As String
sFilterArr = sFilter.Split(",")
Dim iCount As Integer = 1



' Obtain all node elements under parentItemId
Dim browseParameters = New DABrowseParameters() ' no filtering whatsoever
Dim nodeElementCollection As DANodeElementCollection = Client.BrowseNodes("", ServerClass, parentItemId, browseParameters)
' Remark: that BrowseNodes(...) may also throw OpcException; a production code should contain handling for it, here
' omitted for brevity.

WriteLogFile("BrowseAndReadFromNode Browsat OPC pID " & parentItemId & " Timestamp " & Stopwatch.ElapsedMilliseconds)


For Each nodeElement As DANodeElement In nodeElementCollection
'Debug.Assert(nodeElement IsNot Nothing)

' If the node is a leaf, it might be possible to read from it
If nodeElement.IsLeaf Then


' Determine what the display - either the value read, or exception message in case of failure.

For i = 0 To sFilterArr.Count - 1
If nodeElement.ItemId.EndsWith(sFilterArr(i)) Then
bReadValue = True

End If

Next
If bReadValue = True Then
Try

'Dim value As Object = Client.ReadItemValue("", ServerClass, nodeElement.ItemId)
'Client.SubscribeItem("", ServerClass, nodeElement.ItemId, 1000)
'Form1.ListBox1.Items.Add(nodeElement.ItemId)
'sNodes.Add(nodeElement.ItemId)

Dim newSymbol As DataRow = DataCashe.Tables("tblPiigabData").NewRow()
newSymbol("sNode") = nodeElement.ItemId
newSymbol("rValue") = 0
newSymbol("iStatus") = -1
DataCashe.Tables("tblPiigabdata").Rows.Add(newSymbol)
iCount += 1
Client.SubscribeItem("", ServerClass, nodeElement.ItemId, 180000)
WriteLogFile("BrowseAndReadFromNode Prenumererar på " & nodeElement.ItemId & " Stopwatch " & Stopwatch.ElapsedMilliseconds & " Antal " & iCount.ToString)



Catch exception As OpcException
WriteLogFile("BrowseAndReadFromNode error " & nodeElement.ItemId)
End Try

bReadValue = False

End If


' If the node is not a leaf, just display its itemId
Else

End If

' If the node is a branch, browse recursively into it.
If nodeElement.IsBranch AndAlso (nodeElement.ItemId <> "SimulateEvents") Then ' this branch is too big for the purpose of this example
BrowseAndReadFromNode(nodeElement.ItemId, sFilter)
End If
Next nodeElement

End Sub

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

More
06 Apr 2022 04:47 #10786 by support
Hello,
thank you for the details.

Do I understand it correctly, that - from the following two entries - you can actually get timeout error with a method that does not really seem to "wait" and returns almost immediately?:
2022-04-05 15:07:34 BrowseAndReadFromNode Börjar scanna pID 1695_A_AS3.A_5201_VM1 Timestamp 1421 Start browsing new parent
2022-04-05 15:07:34 RecursiveWithRead Failure Timeout browsing nodes. Error
+ The client method called (or event/callback invoked) was 'BrowseNodes'.
Regards

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

More
05 Apr 2022 13:21 #10783 by FreegE
Hi, thanks for your reply!

1. Its the same type of setup for browsing the opcserver, ive used the example browse/read values but instead of reading values i add a subscription.
2. Its the Piigab M-Bus OPC server (latest version)
3. The OPC server has about 1000 nodes ith about 2200 subnodes and on them there are 18000 items, but i use a filter and try to browse about 4400 items (values). So there are some branches to scan trough but its only 2 nodes that needs to be returned.
4. When ' Obtain all node elements under parentItemId
Dim browseParameters = New DABrowseParameters() ' no filtering whatsoever
Dim nodeElementCollection As DANodeElementCollection = Client.BrowseNodes("", ServerClass, parentItemId, browseParameters) is executed, it takes maximum 10 ms complete. the whole timeframe for one example from first brovse is executed looks like:

Start of browsing...
2022-04-05 15:07:33 RecursiveWithRead Browsing and reading values... with filer E1,CNT
2022-04-05 15:07:33 BrowseAndReadFromNode Börjar scanna pID Timestamp 3
2022-04-05 15:07:34 BrowseAndReadFromNode Browsat OPC pID Timestamp 707 Finished first scan top node

....

2022-04-05 15:07:34 BrowseAndReadFromNode Börjar scanna pID 1695_A_AS3.A_AS3_ELM1Timestamp 1419 Begin scan new node
2022-04-05 15:07:34 BrowseAndReadFromNode Browsat OPC pID 1695_A_AS3.A_AS3_ELM1 Timestamp 1420 Begin scan browse completed
2022-04-05 15:07:34 BrowseAndReadFromNode Prenumererar på 1695_A_AS3.A_AS3_ELM1.E1 Stopwatch 1421 Antal 2 Found 2 nodes, added for subscription
2022-04-05 15:07:34 BrowseAndReadFromNode Börjar scanna pID 1695_A_AS3.A_5201_VM1 Timestamp 1421 Start browsing new parent
2022-04-05 15:07:34 RecursiveWithRead Failure Timeout browsing nodes. Error
+ The client method called (or event/callback invoked) was 'BrowseNodes'.

5. Currently .Net 4.8 and VS 2022 ,NET VB.

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

More
05 Apr 2022 12:40 #10782 by support
Hello.

I have some questions:

1. When you say "pretty much with the method described i the documentation", do you mean that it also happens with our simulation server (as in the example), or do you mean that the example is almost identical, but the server is changed to yours?

2. Which OPC server are you connecting to, if not the simulation server delivered with QuickOPC?

3. Are there many nodes in the server? What I mean is the number of nodes under each particular branch, *not* a "total" i nthe server. I.e. the number of nodes that needs to be returned from one Browse call. How many, roughly? 10, 100, 1000, ... per branch?

4. When you wrote "...the actual brovsingtimes and its not near the timeouts set?", what are the observed timeouts? Are they longer or shorter than the timeout set?

5. Which .NET runtime are you running in? Is it .NET Framework 4.7.x/4.8, .NET Core, or .NET 5/6?

Thank you

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

More
05 Apr 2022 09:33 #10781 by FreegE
Hi, when i try to browse nodes with EasyDAClient() pretty much with the method described i the documentation examples i get the error:
2022-04-05 11:17:54 RecursiveWithRead Failure Timeout browsing nodes.
+ The client method called (or event/callback invoked) was 'BrowseNodes'.

Ive tried to increase the timeouts, but it dosent seem to help much.
Client.InstanceParameters.Timeouts.ReadItem = 60000
Client.InstanceParameters.Timeouts.BrowseNodes = 60000

The strange thing is that the number of succeeded browses differ from time to time without any other factors that i can see would affect this. Also ive put some stopwatches to see the actual brovsingtimes and its not near the timeouts set? What affects this error and how could i work around it? Currently i run version 2022.1.

//Fredric

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

Moderators: support
Time to create page: 0.065 seconds