[BUG-7073] SFC Monitoring just shows "java.lang.reflect.UndeclaredThrowableException" when storing a Qualified Value in a Chart Parameter

I am trying to run a very basic SFC to open a valve, read a pressure sensor, and close the valve again. When I try to run the SFC and monitor it (or debug it and monitor it), I get the following:

I have restarted the designer, the gateway, and finally my computer to no avail. The chart does not crash, I just can't monitor it in any apparent way. The SFC widget shows the same message.

This is the chart

image

open contains

def onStart(chart, step):
	system.tag.writeBlocking(["[36ED13]COIL0-COIL200/COIL0"], [True])

business contains

def onStart(chart, step):
	chart.pressure = system.tag.readBlocking(["[36ED13]HRF0-HRF100/HRF50"])

ending transition

{chart.pressure} >= 2

and looping transition

{chart.pressure} < 2

and finally, close

def onStart(chart, step):
	system.tag.writeBlocking(["[36ED13]COIL0-COIL200/COIL0"], [False])

No idea why this isn't working, but it is fully blocking my path forward in developing more advanced SFCs! Any help would be wonderful.

Thanks,
-Alex

Edit: Here is the console output for a single instance of this error (triggered through the SFC widget):

java.lang.reflect.UndeclaredThrowableException: null
	at com.sun.proxy.$Proxy44.getChartStatus(Unknown Source)
	at com.inductiveautomation.sfc.client.SfcInstanceMonitor$MonitorStart.doInBackground(SfcInstanceMonitor.java:189)
	at com.inductiveautomation.sfc.client.SfcInstanceMonitor$MonitorStart.doInBackground(SfcInstanceMonitor.java:185)
	at java.desktop/javax.swing.SwingWorker$1.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.desktop/javax.swing.SwingWorker.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: null
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:351)
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:325)
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:278)
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.moduleInvokeSafe(GatewayInterface.java:917)
	at com.inductiveautomation.ignition.client.gateway_interface.ModuleRPCFactory$DynamicRPCHandler.invoke(ModuleRPCFactory.java:53)
	... 9 common frames omitted
Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayResponse$GatewayThrowable: 
	at java.lang.Class.getMethods(null)
	at org.json.JSONObject.populateMap(JSONObject.java:846)
	at org.json.JSONObject.<init>(JSONObject.java:259)
	at org.json.JSONObject.wrap(JSONObject.java:1460)
	at org.json.JSONObject.populateMap(JSONObject.java:873)
	at org.json.JSONObject.<init>(JSONObject.java:259)
	at org.json.JSONObject.wrap(JSONObject.java:1460)
	... (identical for hundreds of lines, those three lines 873, 259, 1460) ...
	at org.json.JSONObject.populateMap(JSONObject.java:873)
	at org.json.JSONObject.<init>(JSONObject.java:259)
	at org.json.JSONObject.wrap(JSONObject.java:1460)

I believe the issue is with storing the results of readBlocking in the chart.pressure variable. Currently you’re storing the entire list of qualified values being returned. Can you try just saving the value of the first result by adding [0].value to the end of that line?

def onStart(chart, step):
	chart.pressure = system.tag.readBlocking(["[36ED13]HRF0-HRF100/HRF50"])[0].value
1 Like

There is also an excerpt in the user manual regarding this behavior.

https://docs.inductiveautomation.com/display/DOC81/7.9+to+8.1+Upgrade+Guide#id-7.9to8.1UpgradeGuide-SFCs

chart.pressure = system.tag.readBlocking(["[36ED13]HRF0-HRF100/HRF50"])[0].value

Hi! Thank you, this apparently fixed it. That was a mistake on my part, obviously. Would you happen to have any insight about how I would have debugged this myself? If it had thrown a python error I almost certainly would have been able to debug it, but I didn't seem to get a trace that was helpful.

Thanks,
-Alex

7.9 to 8.1 Upgrade Guide - Ignition User Manual 8.1 - Ignition Documentation

Ah this does cover that -- unfortunately I started from 8.1 and didn't run across the upgrade guide.

You're right, that stacktrace really isn't helpful in troubleshooting this issue. To be honest, I only recognized it because I handled the support ticket that resulted in that section being added to the upgrade guide. The chart was a bit more complex as it had been in use on 7.9 but it took a while to isolate the problem to the qualified value being stored in the SFC Parameter. There is this other forum post that has the same stacktrace where it's mentioned that serializing the quality code in the Qualified Value object is an issue.

I believe we made a change to dataset tags to prevent attempting to serialize quality codes so I'll see if there may be a similar change we can make to the SFC parameters. Or at the very least, see if we can add logging that would point you in the right direction.

Good point. I'll request that this also gets added to one of the 8.1 SFC User Manual pages.

2 Likes

A note has been added to the Chart Scope and Variables page in the user manual.

1 Like

Well I am glad you ID'd it so I could fix it! Seems to be still working fine now -- I see the error every now and then but then I know that it is likely a script error.

Or at the very least, see if we can add logging that would point you in the right direction.

Having a hint as to where the problem is (at least isolating down to the node) would be massively helpful!

Thanks!

I created an internal ticket to take a further look at what we can do for this scenario.

1 Like

Thank you!