Gateway Timer Script Limits

Can anyone provide details in terms of maximum script length ? I currently have a Gateway Timer Script that apparently has exceeded some limits. When I select “Apply” I get:

Warning: The script for timer script:
‘EventEngine’ @ 1,000 ms did not compile!
Do you still wan to save it?
Parse Error:
java.lang.ClassFormatError: Invalid method Code length 66354 in class file org/ptyhon/pycode/_pyx129
(followed by about 30 more lines)

I can delete some of the code and it then works fine.

I realize that I can break the code into modules - just want to get the hard facts on code limits first. Is it lines of code ? Do comment lines and blank lines used for readability count ?

Ignition 7.9.9

Thanks In Advance

The JVM has a size limit of 65535 bytes for methods. This doesn’t translate directly to any line count measure, unfortunately. You’ll need to break some functions out into modules as you mentioned.

Consider not putting so much code in gateway events, anyways: legacy scoping rules can eat your lunch. Script modules use modern scoping, no matter how they are called.

Unfortunately the ship has already sailed - the PLCs that are used to monitor the machines provide only the barest on status information and we have to do pretty much all of the timing and counting associated with the application at this level. The system is pure tags and scripts - no transaction groups or similar. Not ideal - but it is what it is.

Any idea whatsoever the timing penalties are associated with moving a block of say 500 lines of mainline timer script code to a callable module ? Will do some testing offline but do you think it will even be noticeable ?

I doubt it.

Thanks Kevin.

I think you misunderstood me. I’m not recommending you avoid gateway event scripts. I’m recommending you put all of their code in project script modules. The actual event script would be a one-liner that calls a function in one of your script modules.

In v8, this has the additional benefit of exposing your code to source code control.

1 Like