I also made it in an odd way, just to show (to myself) that I can, so this is not for the weak hearted, it has BRACKETS! AND SEMICOLON LINE TERMINATION!
world {
tick_lag = 0.5;
icon_size = 32;
view = 6;
//loop_checks = 0;
}
proc/stackoverflow(n = 1) {
//sleep(0.5);
world << "stackoverflow n=[n]";
. = stackoverflow(n+1);
}
mob {
verb/testsof() {
set name="test stack overflow";
set category="test";
stackoverflow(2); //we are already at stack 1, this verb, so we start the overflow at 2
}
}
(the verbs for the other experiments withheld, but everything used for this one is there)
So, if you run this, it will runtime at 199.
Now, the fun bit, uncomment out loop_checks = 0;
Run it again.
DD will flat out crash at 500. (at least, for me)
If you need to, you can uncomment out the sleep to slow it down and prevent it from crashing DS.
Stay tune for more FUN! as we prevent DD from shutting down the server after too many stack overflows while breaking both shutdown() and world.Reboot()
So I might actually end up (ab)using this in SS13 to prevent byond from being able to shut the world down.
Here is that same project, after i made some changes: (running 508.something3)
So, basically, mass click the test stack overflow verb, just pound on it, normally, if you did this, DD will shut the world down for triggering a recursion runtime too quickly.
How ever! it will not. It also won't restart the world. (use the check stack overflow state verb to confirm the world never restarted)
SUCCESS! no more shutting down the world from too many stack overflows!
BUT WAIT! Wouldn't that break something?
Seems like, I tried this in ss13, even made Reboot() set a global var to prevent the call to Del() after Reboot from causing a loop, and it wouldn't reboot if dd had attempted to shut the world down and this stopped it. In fact, calling shutdown() doesn't do anything either.
Once we (ab)use this bug to prevent a shutdown, shutdowns and world reboots become impossible via normal means.