Gateway event script sometimes fails to execute a function

It is not clear in this post if you are really using a Tag Change Script in a project’s Gateway Event scripts, or if you are using a ValueChange or other event directly on a tag. The former are in a project and have access to that project’s script modules (and any inherited scripts in v8). The latter are not in a project and have access only to shared scripts (v7.9) or to the script modules in the Global Scripting Project (v8).

1 Like

About to start testing them again and watching closely to the data this time.

I’m super confused at this point. The only thing that might make sense is the PCs are running different versions of Java…

Try copying the script into the script console, make it a function and then call it at the bottom of the console.
This is an easy way to see any errors that pop up in both the main script and the sub function call.
Something like:

    if not initialChange:
        var_Furnace = '1W'
        tempReached ='somePath').value
        tempReachedAck ='somePath').value

        if tempReachedAck == 1:
            pairID ='somePath).value
            id1 ='somePath').value
            id2 ='somePath').value

            if pairID > 0:
                project.functions.tempReached(var_Furnace, id1, id2) 

                #THIS LINE ALWAYS RUNS
                system.tag.write('somePath', 1)
                return var_Furnace,id1,id2
print testTagCall(0)

No errors popped up. Would this function execute? My Gateway logger doesn’t show that function executing (I use an info logger inside the function).

Return/Print other variables in the call

return PairID,id1,id2

Or you can just print them right inline

if tempReachedAched == 1:
    pairID =;somePath').value
    print pairID


So the attached picture executes and returns what I expect from the function and also updates the tags in the program. However, the function itself doesn’t write anything to the gateway logger.

def soakPointReached1(furnaceName, uid1, uid2):
    dewaxLogger = system.util.getLogger("Dewax")'Executing func soakPointReached1')
    return 3


Sidenote: I figured out why my second picture in this thread wasn’t executing. The function being called was looking at a local directory to delete some CSV file. Obviously this directory doesn’t exist on the gateway (at least I hope it doesnt)

Sidenote2: My original problem I’ve been unable to replicate. We ran 8 furnaces back to back and all performed as expected. So it’s looking more and more like user error on my part.

I’m curious to know if you have the dedicated thread option turned on for this tag change event script?

I’m sure that certain people whom have already posted on this thread have some good insites to offer on the the impact of doing relatively long processes inside tag change scripts (Database Updates/File System Modifications) could have on your system if you are using shared threading.


This is version 7.9 and I don’t see a threading option for gateway tag change scripts.

I haven’t seen this issue since the first time it happened so either it’s a very rare event or it’s not a real problem… will investigate 1 more week and then probably close this thread.

I’m curious to know if you have the dedicated thread option turned on for this tag change event script?

This option is for Timer scripts.