Vision Client Startup Script Error - No session found. You must re-login

Hello,

I have been having an intermittent issue with the startup vision client script I am using in some of my projects.

This error seems to only happen the first time a client is opened on a machine for a while (every few days or so) and seems to always trace back to system.tag (readBlocking) and system.db (runPrepQuery) functions.

Here is an example traceback:

Traceback (most recent call last):
  File "<startup script>", line 1, in <module>
  File "<module:JD_HMI.Startup>", line 36, in Start
  File "<module:JD_HMI.Config>", line 85, in refreshConfig
  File "<module:JD_HMI.Config>", line 58, in getNetwork
java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: No session found. You must re-login. (TagProviderRpc.read)

	caused by ExecutionException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: No session found. You must re-login. (TagProviderRpc.read)
	caused by GatewayException: No session found. You must re-login. (TagProviderRpc.read)

Ignition v8.1.34 (b2023112816)
Java: Azul Systems, Inc. 17.0.8

The traceback references line 58 in getNetwork() which can be found below:

clientGateway = str(system.tag.readBlocking("[System]Gateway/SystemName")[0].value).upper()

This script is part of the vision client startup script that runs immediately after the user logs in, however, I don’t know of a way to make sure a session is started to make sure I don’t get the “No session found.” error.

Does anyone have any suggestions?

Here is another traceback from a system.db function I was able to reproduce:

Traceback (most recent call last):
  File "<startup script>", line 1, in <module>
  File "<module:JD_HMI.Startup>", line 41, in Start
  File "<module:JD_HMI.Startup>", line 41, in Start
  File "<module:JD_HMI.Config>", line 155, in refreshConfig
	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:392)
	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runPrepQuery(AbstractDBUtilities.java:302)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
java.lang.Exception: java.lang.Exception: Error executing system.db.runPrepQuery(SELECT [EXAMPLE_COLUMN] FROM [EXAMPLE_TABLE] WITH (NOLOCK) WHERE [EXAMPLE_COLUMN] = ?, db, [21], )

	at org.python.core.Py.JavaError(Py.java:545)
	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:392)
	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runPrepQuery(AbstractDBUtilities.java:302)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:190)
	at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.__call__(ScriptManager.java:553)
	at org.python.core.PyObject.__call__(PyObject.java:400)
	at org.python.pycode._pyx2.refreshConfig$3(<module:JD_HMI.Config>:171)
	at org.python.pycode._pyx2.call_function(<module:JD_HMI.Config>)
	at org.python.core.PyTableCode.call(PyTableCode.java:173)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:119)
	at org.python.core.PyFunction.__call__(PyFunction.java:406)
	at org.python.pycode._pyx1.Start$1(<module:JD_HMI.Startup>:157)
	at org.python.pycode._pyx1.call_function(<module:JD_HMI.Startup>)
	at org.python.core.PyTableCode.call(PyTableCode.java:173)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:119)
	at org.python.core.PyFunction.__call__(PyFunction.java:406)
	at org.python.pycode._pyx0.f$0(<startup script>:1)
	at org.python.pycode._pyx0.call_function(<startup script>)
	at org.python.core.PyTableCode.call(PyTableCode.java:173)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.Py.runCode(Py.java:1703)
	at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:804)
	at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:773)
	at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:740)
	at com.inductiveautomation.factorypmi.application.FPMIApp.startup(FPMIApp.java:498)
	at com.inductiveautomation.factorypmi.application.runtime.ClientPanel.lambda$startupApp$8(ClientPanel.java:913)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.Exception: Error executing system.db.runPrepQuery(SELECT [EXAMPLE_COLUMN] FROM [EXAMPLE_TABLE] WITH (NOLOCK) WHERE [EXAMPLE_COLUMN] = ?, db, [21], )
	... 42 more
Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: No session found. You must re-login. (RunQuery)
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:360)
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:334)
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:287)
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.runLimitQuery(GatewayInterface.java:893)
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.runQuery(GatewayInterface.java:864)
	at com.inductiveautomation.ignition.client.script.ClientDBUtilities._runPrepQuery(ClientDBUtilities.java:328)
	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runPrepQuery(AbstractDBUtilities.java:294)
	... 40 more

Ignition v8.1.34 (b2023112816)
Java: Azul Systems, Inc. 17.0.8

The errors you're getting are "symptoms" of some other issue - some kind of session management/bookkeeping issue.

How's the networking path from wherever you're running the client/designer to the gateway? Any IT provided nonsense security scanning stuff that might be interrupting comms?

While the client or designer is running, there must be a valid HTTP session attached to it on the gateway. Whatever is happening, the gateway no longer 'knows about' your designer (or the designer is losing its knowledge of the backend session). Which naturally means that everything else in the system that assumes the session exists fails - and thus you get an error indicating you should re-login to create a new session.

I'd try, in this order:
0. Contacting our support department officially :slight_smile: Feel free to do this after any of these steps, as well.

  1. Investigating network conditions - maybe set up a persistent Wireshark capture and see what is happening when the client/designer starts throwing errors.
  2. Upgrading Ignition. I don't remember any relevant bug fixes offhand since 8.1.34, but there may well have been. I'll also note for posterity that the entire functionality here is completely overhauled in 8.3 - new bugs may [1] exist, but whole classes of errors like this will not occur in the same manner.

  1. will ↩︎

1 Like

Thanks for the in-depth reply, Paul!

Our company has an extremely complex network infrastructure with multiple levels of VLANS, subnets, firewalls, etc.. so, I would not be surprised in the slightest if that was a component of this issue. I wish I knew more about the specifics; however, our company does not let people in my role see much of that detail.

This makes sense to me, thank you for the explanation!

@paul-griffith Do you have any ideas as to why this issue seem to center around system.tag and syystem.db functions? I only started getting errors once I added those functions to my startup scripting.

I will certainly follow these steps! Our company is planning to update to 8.1.49 soon anyways and we have plans to rollout 8.3 after some testing.


  1. will ↩︎

Those have to make separate calls to the gateway. If your network is unstable, they might be happening before the session is fully established. This is plausible on high-latency VPNs over WANs or similar.

You will probably have to avoid gateway callouts directly in the startup script.

1 Like

Thanks for the reply!

Is there any way to have the startup script wait for the session to be fully established? In a perfect world, I would love to be able to call some sort of function that returns once the session establishes or if some sort of timeout is reached.

Not sure if that exists.

No such thing.

Consider using a client tag change event script to subscribe to one of the tags of interest. It's first value will be delivered shortly after the session is fully established.

1 Like

Good point, I will keep that in mind as an option!

One additional question,

I mentioned in the original post that this issue only happens roughly once every day or so per computer. I assume the gateway maintains the session details in the background for some amount of time…

Is there a way for me to force the gateway to establish a new session from scratch so I can make the error happen more reliably for debugging purposes?

No idea, other that using a firewall to conditionally break the connection.

1 Like

I know this is kind of a lazy solution; however, it seems like placing my startup script call inside of a system.util.invokeLater() with a 1000ms delay argument has fixed the issue or at least reduced the frequency of occurrence.

Hopefully using the system.util.invokeLater() function inside of the startup event is not a bad thing to do!

Itself, no. But you should not have any import or def statements directly in event scripts. Put any such in your project script library, and call those.

1 Like