If I spawn in World/New() before calling a proc that loops infinitely, profiling will reveal the proc has an apparently real-time of hundreds of millions of seconds. Sometimes negative that amount. It also does this if the spawn is in the loop itself. The problem is, however, that after about a day and a half, the proc crashes. I think the more the loop does, the faster the proc crashes, but it takes too long for the loop to crash for me to experiment with this.
Edit: Just the proc crashes. Not Dream Daemon. There are two loops I use in my actual code: One updates all mobs' "status" variable every two seconds, and one backs up the world every half hour. Both crash eventually, within about an hour of each other, and there is no error output to Dream Daemon when they do crash. I can only tell they've crashed because they stop doing anything. They're separate loops, so it's likely not a problem with my code. I'm pretty sure it has to do with the profile thing described above, and also below.
Numbered Steps to Reproduce Problem:
Compile the code below until the comment into a blank, new environment in Dream Maker, run the world in debug mode, and go to F1->Server->Profile and you'll see what I'm talking about.
Edit: Or look at this picture, if you don't feel like trying it.
Ignore the "Infinite Loop" function in the table. I've removed it from the below code snippet and it does not matter.
Code Snippet (if applicable) to Reproduce Problem:
Here's what I used to test it:
world/New()
spawn() infiniteLoopThatSpawns()
otherInfiniteLoopThatSpawns()
proc/infiniteLoopThatSpawns()
sleep(20)
spawn() infiniteLoopThatSpawns()
proc/otherInfiniteLoopThatSpawns()
sleep(20)
spawn() otherInfiniteLoopThatSpawns()
//Or fine. My actual loop. A little less simple.
world/New()
..()
//Sometimes I spawn before while(1) and sometimes I don't. It crashes eventually either way.
while(1)
sleep(20)
for(var/mob/M in world) if(M.client)
var/bar = winget(M, "MainWindow.input", "text")
if(bar == "" || bar == "Say \"" || bar == "Emote \"") M.status = ""
else if(findtext(bar,"Say",1,4) || findtext(bar,"Emote",1,6) ) M.status = "Typing..."
else M.status = ""
if(M.client.inactivity >= 6000) M.status = "Idle"
Actual Results:
The first one, infiniteLoop(), never returns, so it has a realtime of zero, but the other two in the test I'm running right now have a realtime of negative 700M seconds. This doesn't happen if the proc called isn't an infinite loop, or if there is no spawning involved.
I've tried making an infinite loop without spawning at the end of world/New, like doing
world/New()
while(1)
doStuff()
but it still crashes eventually. It takes about a day and a half for world/New to crash when its infinite loop loops every half hour, so I figure it's probably a realtime issue instead of a stack overflow issue.
Does the problem occur:
Every time? Or how often?
Every time. But changing anything in the code tends to change how many hundreds of millions of seconds of runtime the procs have.
In other games?
Yes, I've reproduced the problem in a test environment
In other user accounts?
Untested
On other computers?
Yes. I've tried it on a Windows XP machine, as well. I've also tried it in version 479. The XP machine has 479, and my laptop did until I upgraded to make sure this wasn't caught and fixed. I test it in Dream Seeker on my laptop and Dream Daemon on the XP machine.
When does the problem NOT occur?
I can't really find a way to make an infinite loop start upon world/New() without it crashing after an hour and a half.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked?
I use infinite loops a lot, especially with games and programs that are hosted for days or weeks at a time, and have never noticed them crashing before. And world/New() the ideal place to call them from. Basically, I noticed my infinite loop in this project was crashing with no error, so I checked profile and noticed, "Hey, wait. My server hasn't been up for 130 million seconds. Only like eight hours. That can't be right."
Workarounds:
I dunno. I haven't tried making a verb call the infinite loop, but that might work. If I do that, it doesn't give them a hundred million runtime seconds, but they might still crash later.