Policy extension quits with terminating execution, function exceeded time limit

93 views Asked by At

I'm trying to write a policy extension in lua for Citrix Netscaler that calculates the base64 of a string and add it to a header. Most of the time the function works just fine, but more than a few times I see in the ns.log that its execution was terminated with the following message -

terminating execution, function exceeded time limit.

Nowhere in the docs could I find what exactly is this time limit (from what I saw it's about 1ms, which makes no sense to me) or how to configure it.

So my question is: is this property configurable and if so how?

2

There are 2 answers

0
KaiT On

Why do you need to go 'lua' ? with policy expressions you can do text.b64encode or text.b64decode . I am not answering your Q but you might not be aware of the builtin encoders/decoders in Netscaler.

0
virgula24 On

Although I don't have any official document I believe that the max execution time is 10ms for any policy. This is also somehwat confirmed by the counters. Execute the following command on the shell:

nsconmsg -K /var/nslog/newnslog -d stats -g 10ms -g timeout

You will see all counters with these names. While your script is executing you can run

nsconmsg -d current-g 10ms -g timeout

This will let you see the counters in real time. When it fails you will see the value incrementing.

I would say that you can print the time on the ns.log while your script runs to confirm this. I don't know exactly what you are doing but keep in mind that netscaler policies are supposed to do very brief executions, after all you are working on a packet and the scale for packets is in the order of nanoseconds.