Preventing potentially infinite loops in T6 Server/Spitting errors in log file
-
Hello! My server keeps crashing everyday or so and i strongly believe that there's an infinte loop in one of my scripts that causes this since it keeps sending heartbeats but i can't see the server unless i restart it. Having said so, is there a way to prevent infinite script loops on a T6 server? (just like the old cod4 did... if there was an infinite loop the server would just crash with a log instead of hanging forever). Do i need to set a dvar in order to show runtime errors/loops on the log?
Thanks in advance!
-
Rex109 no, you need to fix the scripts so they don't contain infinite loops.
-
Dss0 Ofc i have to fix them, but there's no way to get a traceback to the error since the server doesn't spit any runtime errors in the log file... are you 100% sure there's no way to get a traceback?
-
Rex109 yea i'm pretty sure. Does your server stop crashing without custom scripts?
-
Rex109 Infinite loops are pretty easy to find. All you need to do is check every loop in your scripts and make sure the loop can exit when its supposed to.
If for some reason the condition for the for loop or while loop becomes undefined it can cause an infinite loop. Additionally with the current compiler you cannot nest foreachs inside another foreach nor can you use a continue in a for loop or foreach.
https://github.com/xensik/gsc-tool is recommended because it has none of these issues.
-
JezuzLizard First of all thanks for your reply. Yeah you are right, it's not absolutely hard to find one, but i was thinking that on T6 there was something like on IW3 (cod4): a timeout thread that prevented infinite loops by terminating the server with a runtime error instead of hanging it forever. Second of all thanks for the compiler, i wasn't searching for a new one but the one you provided me seems way better than the one on the plutonium guide, so thanks alot! Also i think i've found the error (not 100% sure but it seems it hasn't crashed for a while now), but i wanna point out that i'm not searching for a solution for a problem of mine but rather a way to better debug my scripts and provide better maintainability to my projects.
-
Dss0 Never tried it but i'm sure it does not. I'm absolutely sure that one of my gsc is causing the issue
-
This post is deleted!
-
Update: server is still hanging randomly, sending heartbeats infinitely and saying they were successful when neither IW4Madmin and a client can connect to it. I suppose it's another infinite loop? Plus not my actual client crashes whenever i search a server? Dafuq?
-
Rex109 Try using this plugin in your server:
https://github.com/fedddddd/t6-gsc-utils/releases/tag/v1.9.9
-
JezuzLizard This is EXACTLY what i was looking for. Thank you so much!
Edit: i see it's uploaded yesterday. super duper ultra useful update dude. tysm!