Community discussions

MikroTik App
 
Tal
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 57
Joined: Wed Jun 17, 2015 2:17 am

Script Size Limit

Thu Dec 17, 2015 4:27 am

I'm using RouterOS 6.27, and I'm running into a bit of a problem.

I have a .rsc file that creates a very large script using:
/system script
add name=LARGE_SCRIPT policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive source="

VERY LARGE SCRIPT
"
The script is close to 1500 lines long.
Whenever I import it with /import FILE.rsc, it struggles trying to create the script and errors out with:
action timed out - try again, if error continues contact MikroTik support and send a supout file (13)
I tried randomly deleting parts of the script, and at a certain point, the script imports fine, but if I add an extra line that says
/put "hi"
it fails to import with the above error. This occurs when my script is exactly 1475 lines long - if it's 1475 lines, it imports fine - if it's 1476, it fails.

At first I figured there must be some undocumented 1475 line limit for a single script, but I tried making a script that just writes:
/put "hi"
2000 times, and it imported fine. It seems to be more of an issue of how long my script takes to import than how many lines it has. My script has a lot of logic that probably takes RouterOS a while to do syntax checking on, whereas 2000 "/put "hi"" lines are relatively easy to do syntax checking on.

Can anyone confirm that this is indeed some sort of limitation? Can anything be done about it?
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: Script Size Limit

Thu Dec 17, 2015 1:07 pm

It's about the number of bytes really, AFAIK.

It was 4096 (4k) last I heard, but I haven't tested this ever.

You can work around this limit by keeping the script as an ".rsc" file, and from the script, just "/import" it.
 
Tal
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 57
Joined: Wed Jun 17, 2015 2:17 am

Re: Script Size Limit

Thu Dec 17, 2015 7:24 pm

It's about the number of bytes really, AFAIK.

It was 4096 (4k) last I heard, but I haven't tested this ever.

You can work around this limit by keeping the script as an ".rsc" file, and from the script, just "/import" it.
My large script used to be 49K, and worked great.
The additions I made that caused it to fail to import were fairly recent.
Maybe the limit has been increased to 50K, and my additional code made it larger than that?

Keeping the script as a separate .rsc file would requre a main .rsc, and a secondary .rsc, both of which would need to be copied together all the time. This is a bit of a deal-breaker.

I've made some changes to decrease the size of the script and work around the problem, but at some point, I may need to increase the size of the script again when I think of new functionality to add to it, so it would still be nice to know why this is happening.