Lua: exceeded time limit

Hi there,

I got a problem with Lua scripts that I can’t quite narrow down. I’m basically running the UART_log script from the examples, with a slight change: num_terms = 4 and max_length = 4.
I need to log information at a high refresh rate, ideally 50 Hz, but I’d settle for at least 10 Hz.

The problem is that it always ends up crashing after a while, with the error Lua: exceeded time limit. As I understood from the documentation, although the scripts are not guaranteed to run constantly, they should be restarted in case of crash, but that is not happening in my case.

Moreover, if when I start the controller, my sensor is already sending data, the script fails instantly after writing just a few entries in the log. But if I plug the sensor in a few seconds after startup, it works for an indeterminate amount of time. Sometimes it has stopped logging after 5 minutes without showing any errors; other times it has worked until I turned off the controller.
I have no idea how to debug this or what the problem is due to, so any hints would be appreciated.

I’m running it on a CubeBlack with ArduPlane V4.1.6 (eddf0367).

And is there even a way to log data at a high bitrate with Lua scripts?
If I send data at ~1 Hz, it never seems to fail. But at higher bitrate I can’t get it to work.