Issue while running script triggered by tag value in the gateway script. Time delay issue in the API request time

I encountered an issue while running my script triggered by the tag value in the gateway script. During script execution, I experienced a time delay issue in the API request time. However, the API running time itself was normal. Before the API call, there were a few conditions to satisfy, such as retrieving values from tags (two different lengths of values). Initially, I concatenated these two tag values to check and validate whether both tags had values. Upon satisfying these conditions, I allowed the script to execute. However, I encountered a time delay of 15 to 20 seconds during the API request, whereas I need the script to execute within 6 seconds, but i don't get this issues frequently , every 8 to 10 minute i got this issues . I would appreciate any suggestions you may have.

This seems to be suspiciously similar to Script execution delay posted under a different name within a few minutes of this one.

What's going on?

could you give any suggestion to solve this issues please

So, is this the same issue? If so, this thread should be locked and any further discussion can be over there.

If not, then you will need to supply us with the code you are running, sanitized as needed.

1 Like

MyGatewayscript.py (25.4 KB)
This is the same issue as my colleague shared. if you see the script the line "BandValdStart = system.date.now()" and " Bandprinted = system.date.format(Bandprinted, "yyyy-MM-dd HH:mm:ss.SSS")" got delay everytime. API is not taking time. but there is not much in between this lines, still why it takes delay to execute?
If i do the script in label also i am facing the same issue. please any one give suggestion

My colleague also shared the same issue and i shared the script also , please give solution for this issue

Relevant portion:

            BandValdStart = system.date.now()
            BandValdStart = system.date.format(BandValdStart, "yyyy-MM-dd HH:mm:ss.SSS")
#           pattern = r'^[A-Z0-9]{18}[+][A-Z0-9]{1}'
#           Res=re.match(pattern,band)
            Res='Pattern Test'
#           if Res is not None:
            if Res :
                Nomac = band[11:20]
#               params={'Band':band}
                Process_Start = system.date.now()
                obj={"UniqueIds": [band],"IsNova": False,"IsBatch": False, "CbsStreamName": "Ignition"}
                Result = system.ws.runWebService('ProcessDetailByLotcode_Assy_Time',obj)
                Result = system.ws.toDict(Result)
                iss= Result["Root"]["IsSuccessful"]
#               Process_Detail =system.db.runNamedQuery('ProcessDetails',params)
#               Process_Detail=system.db.runPrepQuery("select lt.Value,lt.Status,lt.ReasonForClosure,i.ItemCode from inventory.LotTravellers lt with (nolock)left join inventory.Items i on i.ItemId = lt.ManufacturingItemId where lt.Value =? ",[band],"MesCore_Assy")
                Bandprinted = system.date.now()
                Bandprinted = system.date.format(Bandprinted, "yyyy-MM-dd HH:mm:ss.SSS")

system.ws.*, if I recall, are from the Sepasoft modules, so you may get better information there. That said:

Is there anything in the log for the same time frame?
Is there anything suspicious-looking in the performance view in the gateway (memory useage, database connections, pause-the-world events)

We could not find any suspicious logs so far. We will check threads once when we get downtime & post the update here,
Thanks

1 Like

Thread_1.json (1.3 MB)
Got thread from gateway, Can you please help to find if any issue?

Most of us here on the forum are volunteers, not employess of IA.

This forum is not support. I suggest to open a support ticket.
https://support.inductiveautomation.com/hc/en-us

That said, it sounds like you've already narrowed it Sepasoft modules. Their support may be able to help as well.

All said, if it happens at a regular frequency, I'm personally leaning towards a garbage collection happening. I would also think that a long-running thread issue would show on the Performance screen unser Recent Slow Response Events. That's all l've got.

2 Likes