Error on system.util.sendRequest. No response ever received

I am getting an error when trying to make a system.util.sendRequest call to a message handler on my gateway.

the sendRequest call is in a custom method called refreshData defined on a power table. The relevant parts of the function are bellow

def refreshData(self):


    resultData = None
	print 'Make Request'
		resultData = system.util.sendRequest('SPC_Config', 'GetSampleDataReportData', payload) #, timeoutSec = 600)
		print 'Request Failure'
	print 'Request Done'


I am calling this function using an invokeAsynchronous call. See an example of the call bellow

system.util.invokeAsynchronous(event.source.parent.parent.getComponent('Sample Data Table').refreshData)

The message handler on the gateway calls a function in a script file that queries the database and does some tranforms on the data. It is returning a python dict containing pyDataSets. Bellow is the relevant code from the script.

def getReportData():
	chartData = system.db.runPrepQuery(chartQuery, parameterList, "db_name")

	tableData = system.db.runPrepQuery(tableQuery, parameterList, "db_name")

	returnData = {
		'chartData': chartData,
		'tableData': tableData

	return returnData

The code in the gateway message handler that calls the function above and returns the results is bellow

reportData = project.sampleDataReport.getReportData()

return reportData

I can see when viewing log data from my scripts and the debug/trace messages from the MassageHandlerRunnable log that everything is working correctly on the gateway. Bellow are relevant log entries for MessageHandlerRunnable. You can see where it gets the results from the getReportData function which are exopected to be empty. It then converts the data to a java object and appears to attempt to send back the result.

|MessageHandlerRunnable|11Oct2021 11:36:36|Send message to Result Handler with: {‘tableData’: [ ], ‘chartData’: [ ]}|
|MessageHandlerRunnable|11Oct2021 11:36:36|Converting python result to java object|
|MessageHandlerRunnable|11Oct2021 11:36:36|Python function ran. Result: {‘tableData’: [ ], ‘chartData’: [ ]}|
|MessageHandlerRunnable|11Oct2021 11:36:34|Valid runnable Python function found|

However on the client nothing seems to be returned. The client waits for some time and eventually an exception is thrown. The exception is bellow. It appears to show that the call failed and no result was ever reveived.

11:37:34.287 [Thread-73] ERROR client.scripting.SystemUtilities - Error invoking sendRequest from client.
com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Results for asynchronous rpc call were not received within the specified amount of time [60000 ms] for task ‘355707ef-d109-4a0f-bd88-42d7ed64aa01’
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.invoke(
at com.inductiveautomation.ignition.client.script.DesignerSystemUtilities$SendRequestManager.invokeRequest(
at com.inductiveautomation.ignition.client.script.DesignerSystemUtilities.sendRequestInternal(
at com.inductiveautomation.ignition.common.script.builtin.SystemUtilities.sendRequestInternal(
at com.inductiveautomation.ignition.common.script.builtin.SystemUtilities.sendRequest(
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 com.inductiveautomation.ignition.common.script.ScriptManager$
at org.python.pycode.pyx86.refreshData$1(:96)
at org.python.pycode.pyx86.call_function()
at org.python.core.PyMethod.instancemethod___call
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(
at com.inductiveautomation.ignition.client.script.DesignerSystemUtilities.lambda$_invokeAsyncImpl$1(
at java.base/ Source)
Caused by: java.util.concurrent.TimeoutException: Results for asynchronous rpc call were not received within the specified amount of time [60000 ms] for task ‘355707ef-d109-4a0f-bd88-42d7ed64aa01’
at com.inductiveautomation.ignition.client.util.gui.progress.ClientProgressManager$RunningTask.waitForResult(
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(
… 26 common frames omitted

I am wondering if anyone else has seen things like this. Also I see nothing in the docs but are there limitations as to what data can be returned to sendRequest calls?

I would not expect this to work. You can’t safely use components’ properties or methods in background threads. (“Use” == read or write.) That you are losing something is the least bad thing that can happen (up to and including complete client lockup). Also, print is not likely to work in a background thread (though it sometimes does). Use a logger instead.

Review this topic, then report back if you still have problems while following Swing’s rules:

1 Like

Thanks for the info. I changed the call to the component method so that I am no longer doing background processing. I am just calling the bellow function directly.

event.source.parent.parent.getComponent(‘Sample Data Table’).refreshData()

The problem is still happening. I see in exception that it is still referring to “asynchronous rpc call.” As far as I know I have not explicit async calls in the process anymore. Is the sendRequest function intrinsically async and causing the issue still?

Yes. Running queries and reading/writing tags with scripting also involve gateway round trips. You probably need a background thread, but you need to use invokeLater to pass the results back into the UI.