Run time error 5

Hi rapidM2M Community!

I receive some run time error messages after sending my compiled script to the device:

rte

Strangely, a connection to the server is established afterwards and according to the log, no script is available. Is this a standard issue? Why is the script executed three times? Where can I look these error messages up?

Thanks

Hi MaFi_mte19,

The rapidM2M Runtime monitors the memory access from the script. In case it detects a not allowed memory access the script execution is aborted. This can happen mostly when working with arrays and using wrong size/length or index parameters with it.

The Runtime will restart the script several times, and if the error persists, deletes the broken script and connects to the server to notify it about the situation.

You can look up these errors in the rapidM2M documentation for your device.

Hi @gregor.bader,

thank you for the quick reply. I am using the function sprintf(), declared in string.inc. I figured out that the second parameter must be sizeof(sString) instead of 256:

new sString{256};

wrong:
sprintf(sString, 256, "Received string: %s\r\n", sRx);

correct:
sprintf(sString, sizeof(sString), "Received string: %s\r\n", sRx);

PAWN normally uses cells of 32 bit to store data in. In this case, a byte array with 256 elements has been defined. Therefore 4 elements are as big as one 32 bit cell. So 64 would be the correct value for the second parameter.

Best regards,
MaFi_mte19