OPC UA Method call hangs

Hi all,
I'm trying to call an OPC Method with the system.opcua.callMethod. My network configuration is as follows:

  • PC1 with Ignition Designer and OPC UA Expert Client
  • PC2 with Ignition Gateway
  • PC3 with the OPC UA Server

I can call the OPC UA Method on PC3 from OPC UA Expert Client on PC1, whereas the Ignition Python function where I've programmed the callMethod cannot. The Python function is called by a ValueChanged event on an Ignition Gateway Tag, so that callMethod runs on the Gateway as required by the function scope spec:

def getZ020WS(jsonInput):
	logger.info('>>>>>>> %s' % jsonInput)
	res=system.opcua.callMethod(
			 connectionName="OpcRouter"
			,objectId= "ns=2;s=MyResources"
			,methodId= "ns=2;s=MyResources.getZ020WS"
			,inputs=[jsonInput])
	logger.info('>>>>>>> CALL END %s' % res)

Reading through the wrapper.log I don't find any exception logged. Moreover the first log entry before the callMethod is there, whereas the second one where I try to log the callMethod result is not.
If I run the same function on a PC which is running all the system components (Ignition, OPC Server, Desginer, OPC UA Client), it works perfectly.
Any suggestion? I don't think it's a matter of firewalls, becuase OPC UA Expert Client manages to do the call.

Thanks in davance, regards

Ignition version: 8.1.25 (b2023021409)

How long does it hang? Can you get a thread dump while it's hung? Can you get a Wireshark capture, made on either PC2 or PC3, with security for the connection turned off?

Hi Kevin, thanks for your reply. It hangs indefinitely, i.e. I never see the >>>>>> CALL END log entry.
One more note: If I try to write a value from the tag browser directly into a tag in the OPC UA Address space, that's no problem: the tag new value is written correctly and I see the new value in the OPC UA Expert Client.
I've given a try also to next code, which I took from Ignition help:

result = system.opcua.callMethod(
        "Ignition OPC UA Server",
        "ns=0;i=2253",
        "ns=0;i=11492",
        [1]
    )

but behavior is just the same: the code never arrives at the >>>>> CALL END log entry. I'm sure I'm doing something wrong, but I don't know where.
I will speak with the customer to see if I may capture Ethernet traffic with Wireshark and I will be back to you.
Thanks, regards

callMethod will throw an Exception if the call times out (or in some other error scenarios), which it should after ~60sec or whatever the request timeout on the connection is configured for. You won't see your final logging statement when this happens.

You might also get a little more info in the logs by setting the logger opcua.gateway.scripting.CallMethod to DEBUG level.

I @Kevin.Herron , just set the logger to DEBUG but got no further information. I've installed MS Network Monitor and saw that when OPC UA Expert calls the method, the monitor shows meaningful records (attached)
OPCUaExpertTraffic.cap (7.1 KB)
Whereas nothing interesting appears when the call should come from Ignition, as if the call does not get out of Ignition. Maybe I'm wrong in the OPC UA Server connection configuration - e.g. I had to uncheck the Certificate Validation Enabled property to get the connection UP and running.
If you have further ideas, I thank you.
Regards

Are you sure you've got the correct connection name? Is the status of that connection good/connected?

I think so:
image
On the left you see the name of the OPC Connection as shown in the gateweay configuration and on the right my function call. The OPC Connection shows up as Connected, provided that I uncheck the Certificate Validation option.

I don't know, there's something suspect going on if you can't even get any log entries from that logger.

You are right, but why this piece of code does nothing either:

result = system.opcua.callMethod(
        "Ignition OPC UA Server",
        "ns=0;i=2253",
        "ns=0;i=11492",
        [1]
    )

Not sure, but I think it should work as is, with no further configuration, shouldn't it?

Do you have a logger object created with system.util.getLogger() before you try to use logger.info() on line 7?

Yes of course, and I see it works in the wrapper.log

I put this into a tag event script:

	print "calling method..."
	
	result = system.opcua.callMethod(
        "Ignition OPC UA Server",
        "ns=0;i=2253",
        "ns=0;i=11492",
        [1]
    )
    
	print result

and in my (wrapper) logs I get:

calling method...
((2150105088L, u'Bad_SubscriptionIdInvalid', u'The subscription id is not valid.'), [], [])

You seem to be writing code in a project script module - is that project set as the Gateway Scripting Project?

... just what I'd like to see. As I told you, I put a test PC together, where Ignition and the OPC UA Server were on the same PC: my code worked like a charm and I got the answer you pointed to and the answer from my getZ020WS OPC UA Method too. On the contrary the customer's distributed configuration does not work

Yes, other wise I would get no log at all, neither the very first entry >>>>>>> ....

Try wrapping the whole thing in try/catch and logging any exceptions that get caught.

Also get a thread dump from the gateway after you've made the call, we'll be able to see if it's actually hanging or not.

Tried already: the catch branch with a print e.getCause() doesn't seem to be executed at all.

Also get a thread dump from the gateway

Could you guide me to get the thread dump? Thanks

They can be downloaded from the threads diagnostics page in the gateway.

https://docs.inductiveautomation.com/display/DOC81/Diagnostics+-+Threads#DiagnosticsThreads-IndividualThreads

Oh, another thing I should have caught earlier... callMethod doesn't take keyword-args like you're trying to call it with. You should be seeing a big ol' error in the logs about this...