system.opc.browseSimple time out error

Hi, I’m encountering a weird error when using system.opc.browseSimple. Only on one particular PLC I have this issue. It’s a 1768-L45 with an ENBT card and 40 connected messages. I’ve
attempted to up the timeout settings in the OPC Devices page on the gateway with no benefit. The code runs fine (on a button press) with other L45 PLCs as well as other model AB processors.
I’m currently running Ignition 7.7.4 and as far as latency is concerned I’m on a gigabit LAN connection and running designer locally on my laptop with the gateway. Also using the built in
OPC browser I have no issues seeing all of the tags.

opcServer = "Ignition OPC-UA Server"
device = "CC_Number"
folderPath = "*"
opcItemPath = "*.DestinationNode"
headers = ["Value"]
mydata = [ [ "" for c in range(1) ] for r in range(50) ]
pointer = 0
tags = system.opc.browseSimple(opcServer, device, folderPath, opcItemPath)
for x in range (len(tags)):
     split_list = str(tags[x].getOpcItemPath()).split(".")
     tagname = split_list[1]
     mydata[pointer][0] = split_list[1]
     pointer += 1
print mydata

event.source.parent.getComponent('Table').data = system.dataset.toDataSet(headers, mydata)

Traceback (most recent call last):

File “event:mouseClicked”, line 9, in

com.inductiveautomation.ignition.client.gateway_interface.GatewayException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Read timed out

caused by GatewayException: Read timed out
caused by SocketTimeoutException: Read timed out

Ignition v7.7.4 (b2015033012)
Java: Oracle Corporation 1.8.0


WARN [GatewayConnectionManager-AWT-EventQueue-2] Connection to Gateway lost, due to exception.
com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Read timed out
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:328)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.getResponse(GatewayInterface.java:487)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:264)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:259)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.invoke(GatewayInterface.java:800)
at com.inductiveautomation.factorypmi.application.script.builtin.ialabs.IALabsOPCFunctions.doBrowseSimple(IALabsOPCFunctions.java:23)
at com.inductiveautomation.ignition.common.script.builtin.ialabs.AbstractIALabsOPCFunctions.browseSimple(AbstractIALabsOPCFunctions.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.call(PyReflectedFunction.java:186)
at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.call(ScriptManager.java:428)
at org.python.core.PyObject.call(PyObject.java:441)
at org.python.core.PyObject.call(PyObject.java:447)
at org.python.pycode._pyx48.f$0(event:mouseClicked:17)
at org.python.pycode._pyx48.call_function(event:mouseClicked)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1275)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:624)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:168)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:265)
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:55)
at com.sun.proxy.$Proxy21.mouseClicked(Unknown Source)
at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$400(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.getResponse(GatewayInterface.java:407)
… 55 more
INFO [msg_paths-AWT-EventQueue-2] Pausing scripts…
INFO [GatewayConnectionManager-AWT-EventQueue-2] Starting reconnect thread.
ERROR [ActionAdapter-AWT-EventQueue-2] Error executing script for event: mouseClicked
on component: Button.
Traceback (most recent call last):
File “event:mouseClicked”, line 9, in
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:328)

at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.getResponse(GatewayInterface.java:487)

at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:264)

at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:259)

at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.invoke(GatewayInterface.java:800)

at com.inductiveautomation.factorypmi.application.script.builtin.ialabs.IALabsOPCFunctions.doBrowseSimple(IALabsOPCFunctions.java:23)

at com.inductiveautomation.ignition.common.script.builtin.ialabs.AbstractIALabsOPCFunctions.browseSimple(AbstractIALabsOPCFunctions.java:33)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

com.inductiveautomation.ignition.client.gateway_interface.GatewayException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Read timed out

at org.python.core.Py.JavaError(Py.java:495)
at org.python.core.Py.JavaError(Py.java:488)
at org.python.core.PyReflectedFunction.call(PyReflectedFunction.java:188)
at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.call(ScriptManager.java:428)
at org.python.core.PyObject.call(PyObject.java:441)
at org.python.core.PyObject.call(PyObject.java:447)
at org.python.pycode._pyx48.f$0(event:mouseClicked:17)
at org.python.pycode._pyx48.call_function(event:mouseClicked)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1275)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:624)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:168)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:265)
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:55)
at com.sun.proxy.$Proxy21.mouseClicked(Unknown Source)
at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$400(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Read timed out
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:328)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.getResponse(GatewayInterface.java:487)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:264)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:259)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.invoke(GatewayInterface.java:800)
at com.inductiveautomation.factorypmi.application.script.builtin.ialabs.IALabsOPCFunctions.doBrowseSimple(IALabsOPCFunctions.java:23)
at com.inductiveautomation.ignition.common.script.builtin.ialabs.AbstractIALabsOPCFunctions.browseSimple(AbstractIALabsOPCFunctions.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.call(PyReflectedFunction.java:186)
… 45 more
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.getResponse(GatewayInterface.java:407)
… 55 more
INFO [msg_paths-GatewayConnection-thread-1] Resuming scripts…
INFO [GatewayConnectionManager-GatewayConnection-thread-1] Stopping reconnect thread.

Does anyone have an ideas on this?

Yeah, unfortunately you’re going to have to use the much more complicated system.opc.browseServer() function for this.

The problem is that browse and browseSimple do a fully recursive browse starting at whatever node you point it at, and in PLCs with too many tags the amount of time it takes to do this recursive browse exceeds the amount of time the client and designer will wait for a response from the gateway.

The browseServer function returns only the nodes directly underneath the starting node, and if you want to continue to recurse downwards you have to do so yourself by making additional browseServer calls.

I’ve tried to use system.opc.browseServer() today, and I’m running into an issue. My original code was intended to find all MESSAGE tags in an AB PLC by looking at *.DestinationNode, which is an element that is specific only to the MESSAGE datatype. With system.opc.browseServer() I can get a list of tag “Folders” but I cannot seem to figure out how to make it recursive by calling it again. The PyOPCTags list is empty if I put anything other than “[node_name]Global” in the nodeId field. Am I missing something which would allow me to “go deeper” into the folder structure using browseServer()? The code below just returns a list of tag names from the processor.

import system
opcServer = "Ignition OPC-UA Server"
nodeId = "[CC_Number]Global"
deviceName = "CC_Number"
pointer = 0

something = system.opc.browseServer(opcServer,nodeId)

mydata = [ [ "" for c in range(1) ] for r in range(len(something)) ]

for x in something:
	myValue1 = x.getServerNodeId()
        #I also tried x.getDisplayName()
	mydata[pointer][0] = str(myValue1)
	pointer += 1

Here’s some code you can use as a springboard for playing with system.opc.browseServer and figuring out how it works. Be careful when increasing the maxDepth parameter, especially if you’re starting at or near the root, there’s no way to stop the browse once it starts!

import system
from functools import partial

maxDepth = 1
serverName = 'Ignition OPC-UA Server'

def browse(nodeId, depth = 0):
	children = system.opc.browseServer(serverName, nodeId)
	
	for child in children:
		elementType = str(child.getElementType())
		childNodeId = child.getServerNodeId().getNodeId()
		
		print '%s%s' % (depth*'    ', childNodeId)
		
		# this is where you might check to see if child is one of the
		# tags you're looking for. you might also use additional criteria
		# to determine if you should continue browsing underneath 
		# this child in addition to elementType and maxDepth...
		
		if (elementType == 'FOLDER' and depth < maxDepth):
			browse(childNodeId, depth + 1)
			
root = '[logix57]'

system.util.invokeAsynchronous(partial(browse, root))
1 Like

Thanks for the quick reply Kevin! I’ll try this out when I’m back on site tomorrow and post the results!

Thanks Kevin! I don’t think I would have figured out how to recursively call system.opc.browseServer() on my own, that was a little tricky but it works perfectly!