After running a loop a few times it eventually comes to a halt.
Numbered Steps to Reproduce Problem:
From what I have deduced, running shell() a numerous amount of times creates a wide range of issues. This being one of them.
Code Snippet (if applicable) to Reproduce Problem:
proc/displayServers()
if((!worldrestoring)&&(!worldSaving)&&(!GettingCPUUsage))
world << "DEBUG: 1"
GettingCPUUsage=1
// authIDs=new/list
for(var/S in serverList)
world << "DEBUG: 2 [S]"
var/list/SL=serverList[S]
if(!istype(SL,/list))
continue
if(SL.len<1)
continue
// var/serverChild/T = SL[SL[1]]
// if(T)
for(var/F in serverList[S])
world << "DEBUG: 3 [F]"
var/serverChild/U = serverList[S][F]
if((istype(U,/serverChild))&&(U.PID))
world << "DEBUG: 4 [F] & [U.PID]" //FREEZES UP HERE
if(shell("kill -0 [U.PID]") == 1) //POSSIBLE CAUSE
world << "DEBUG: 4.1 [F] & [U.PID]"
text2file("Key:[U.Key]| Name: [U.Name]| Folder: [U.Folder] | Time: [time2text(world.realtime,"MMM DD, YYYY")] [timeOfDay]","Crash.txt")
del(U)
else
world << "DEBUG: 4.2 [F] & [U.CPU]"
U.CPU="[getCPU_Usage(U.PID)]%"
U.name = "[U.Name] - CPU: [U.CPU]"
world << "DEBUG: 5 [F] && [U.CPU]"
sleep(1)
GettingCPUUsage=0
Expected Results:
What's expected is that the for loop completes and it hits GettingCPUUsage=0, allowing displayServers() to be ran again.
Actual Results:
It never reaches GettingCPUUsage=0 because it never reaches DEBUG: 5, let alone 4.1 or 4.2. Thus, the displayServers() proc can no longer be used because GettingCPUUsage will always = 1 until I reboot, yet again.
My guess is that as soon as it performs shell("kill -0...") that it freezes up from being ran so many times.
This also goes to say that my game itself freezes as well. It uses shell() quite a lot for some of its procs to handle things related to PIDs.
Does the problem occur:
Every time? Or how often? It seems to happen when displayServers() is ran a lot (takes about 30 seconds to 2 minutes of running the loop).
In other games? N/A
In other user accounts? Yes. I've had multiple people initiate the loop for displayServers() and it produces the same results.
On other computers? Yes.
When does the problem NOT occur?
When displayServers() is not being ran.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.) No. This has been an issue for a long time now. Since v501.1207 (Stable).
Workarounds:
N/A
I have proof that shell() has some issues. Considering the fact that after I stopped using displayServers() as a whole (and now players can't see when their game has crashed or if their CPU is high), the main Shell Server Utility seems to no longer crash randomly.
I was wondering if this could be looked in to. I also have a core dump and a buggy.rsc.. But I don't know what buggy is for or how that one got there.