New error opening windows?

I recently merged a Vision project with a Perspective project so they can share scripting modules. Now as of tihs morning after making this push, oddly enough the navigation in my Vision project is acting buggy - sometimes the window does open at all ie I get blank grey screen like this

but it doens’t always happen.

Here’s the full error

Traceback (most recent call last):
  File "<event:actionPerformed>", line 16, in swapWindow
	at java.base/java.util.Timer.sched(Unknown Source)
	at java.base/java.util.Timer.schedule(Unknown Source)
	at com.inductiveautomation.ignition.common.expressions.functions.AbstractPollingFunction.startTask(AbstractPollingFunction.java:65)
	at com.inductiveautomation.ignition.common.expressions.functions.AbstractPollingFunction.startup(AbstractPollingFunction.java:52)
	at com.inductiveautomation.ignition.common.expressions.FunctionExpression.startup(FunctionExpression.java:63)
	at com.inductiveautomation.ignition.common.expressions.AbstractExpression.startup(AbstractExpression.java:61)
	at com.inductiveautomation.ignition.common.expressions.FunctionExpression.startup(FunctionExpression.java:62)
	at com.inductiveautomation.ignition.common.expressions.AbstractExpression.startup(AbstractExpression.java:61)
	at com.inductiveautomation.ignition.common.expressions.FunctionExpression.startup(FunctionExpression.java:62)
	at com.inductiveautomation.ignition.common.expressions.AbstractExpression.startup(AbstractExpression.java:61)
	at com.inductiveautomation.ignition.common.expressions.AbstractExpression.startup(AbstractExpression.java:61)
	at com.inductiveautomation.factorypmi.application.binding.ExpressionPropertyAdapter.startup(ExpressionPropertyAdapter.java:110)
	at com.inductiveautomation.factorypmi.application.binding.DefaultInteractionController.startupBindings(DefaultInteractionController.java:355)
	at com.inductiveautomation.factorypmi.application.FPMIWindow.startup(FPMIWindow.java:344)
	at com.inductiveautomation.factorypmi.application.VisionDesktop$RuntimeWindowOpener.openWindow(VisionDesktop.java:554)
	at com.inductiveautomation.factorypmi.application.VisionDesktop.openWindow(VisionDesktop.java:197)
	at com.inductiveautomation.factorypmi.application.script.builtin.NavUtilities.lambda$openWindowImpl$5(NavUtilities.java:393)
	at com.inductiveautomation.factorypmi.application.script.builtin.WindowUtilities.doGUIAction(WindowUtilities.java:815)
	at com.inductiveautomation.factorypmi.application.script.builtin.NavUtilities.openWindowImpl(NavUtilities.java:336)
	at com.inductiveautomation.factorypmi.application.script.builtin.NavUtilities.openWindow(NavUtilities.java:326)
	at com.inductiveautomation.factorypmi.application.script.builtin.NavUtilitiesDispatcher.openWindow(NavUtilitiesDispatcher.java:143)
	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.IllegalStateException: java.lang.IllegalStateException: Timer already cancelled.

	at org.python.core.Py.JavaError(Py.java:552)
	at org.python.core.Py.JavaError(Py.java:543)
	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:190)
	at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.__call__(ScriptManager.java:518)
	at org.python.core.PyObject.__call__(PyObject.java:480)
	at org.python.core.PyObject.__call__(PyObject.java:484)
	at org.python.pycode._pyx116.swapWindow$1(<event:actionPerformed>:16)
	at org.python.pycode._pyx116.call_function(<event:actionPerformed>)
	at org.python.core.PyTableCode.call(PyTableCode.java:171)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:308)
	at org.python.core.PyFunction.function___call__(PyFunction.java:471)
	at org.python.core.PyFunction.__call__(PyFunction.java:466)
	at org.python.core.PyFunction.__call__(PyFunction.java:456)
	at org.python.core.PyFunction.__call__(PyFunction.java:451)
	at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:788)
	at com.inductiveautomation.factorypmi.application.script.builtin.ClientSystemUtilities.lambda$invokeLater$1(ClientSystemUtilities.java:276)
	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(Native Method)
	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.IllegalStateException: Timer already cancelled.
	at java.base/java.util.Timer.sched(Unknown Source)
	at java.base/java.util.Timer.schedule(Unknown Source)
	at com.inductiveautomation.ignition.common.expressions.functions.AbstractPollingFunction.startTask(AbstractPollingFunction.java:65)
	at com.inductiveautomation.ignition.common.expressions.functions.AbstractPollingFunction.startup(AbstractPollingFunction.java:52)
	at com.inductiveautomation.ignition.common.expressions.FunctionExpression.startup(FunctionExpression.java:63)
	at com.inductiveautomation.ignition.common.expressions.AbstractExpression.startup(AbstractExpression.java:61)
	at com.inductiveautomation.ignition.common.expressions.FunctionExpression.startup(FunctionExpression.java:62)
	at com.inductiveautomation.ignition.common.expressions.AbstractExpression.startup(AbstractExpression.java:61)
	at com.inductiveautomation.ignition.common.expressions.FunctionExpression.startup(FunctionExpression.java:62)
	at com.inductiveautomation.ignition.common.expressions.AbstractExpression.startup(AbstractExpression.java:61)
	at com.inductiveautomation.ignition.common.expressions.AbstractExpression.startup(AbstractExpression.java:61)
	at com.inductiveautomation.factorypmi.application.binding.ExpressionPropertyAdapter.startup(ExpressionPropertyAdapter.java:110)
	at com.inductiveautomation.factorypmi.application.binding.DefaultInteractionController.startupBindings(DefaultInteractionController.java:355)
	at com.inductiveautomation.factorypmi.application.FPMIWindow.startup(FPMIWindow.java:344)
	at com.inductiveautomation.factorypmi.application.VisionDesktop$RuntimeWindowOpener.openWindow(VisionDesktop.java:554)
	at com.inductiveautomation.factorypmi.application.VisionDesktop.openWindow(VisionDesktop.java:197)
	at com.inductiveautomation.factorypmi.application.script.builtin.NavUtilities.lambda$openWindowImpl$5(NavUtilities.java:393)
	at com.inductiveautomation.factorypmi.application.script.builtin.WindowUtilities.doGUIAction(WindowUtilities.java:815)
	at com.inductiveautomation.factorypmi.application.script.builtin.NavUtilities.openWindowImpl(NavUtilities.java:336)
	at com.inductiveautomation.factorypmi.application.script.builtin.NavUtilities.openWindow(NavUtilities.java:326)
	at com.inductiveautomation.factorypmi.application.script.builtin.NavUtilitiesDispatcher.openWindow(NavUtilitiesDispatcher.java:143)
	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:188)
	... 26 more

Ignition v8.0.6 (b2019111216)
Java: Azul Systems, Inc. 11.0.4

and here’s the logic on the navigation buttons that never caused an issue before

def swapWindow(event = event):
	import system
	for window in system.gui.getOpenedWindows():
		print window.getPath()
		if window.getPath() == '_Header':
			print 'Header found'
		elif window.getPath() == '_navLeft':
			print 'Found navLeft'
		else:
			system.nav.closeWindow(window.getPath())
	system.nav.openWindow(event.source.outWindowName)

system.tag.write("[Client]PopupLoading", 1)
system.util.invokeLater(swapWindow)

Any idea whats going on?

Hmm, my best guess is there’s a race happening where the window hasn’t properly shut down from the closeWindow call before the openWindow call happens; that shouldn’t be possible, and none of that code should have changed anytime recently, but that’s my best guess. If you, just for testing, put a little delay before the openWindow call (say time.sleep(0.5) or something) do you get the same behavior?

I restored my gateway to how we were at midnight, with my vision and perspective project being separate, and now it’s not happening as much though I did just get a report it happening once more.

I think you’re right in that its some race condition. Overall though all my Vision clients are being very slow now and freezing beyond being usable and I’m not sure why, I think they’re related in that its running slower and now the race condition which use to execute fine is now having issues.

I’m seeing every client is pushing it to the limit with the memory use
image

I’m confused why its out of 256 too as I set the vision project properites to this
image

Should I call in?

Yeah, that’s probably best; I’m not sure what’s happening here.