Using a sleep() with a delay at or exceeding 858999999 causes other sleeps or spawns to seemingly never be scheduled to wake up.
This does not occur if the above sleep delay is not in a while(1), or is 858989999; which can be seen in the test case verbs.
In the test case, this can be seen by using halt() then test_sleep().
Apparently, this does not occur for me when world.fps is set to 24 or lower, but 25 or higher causes it.
What I assume is happening is that the integer is overflowing into a negative delay value, but I'm unsure.
Numbered Steps to Reproduce Problem:
1. Use a sleep at or exceeding a delay of 858999999 within a while().
2. Attempt to use a sleep elsewhere.
Code Snippet (if applicable) to Reproduce Problem:
Test Case zip: https://cdn.discordapp.com/attachments/329518903078420480/ 1299537413399379988/sleepbug.zip?ex=671d9007&is=671c3e87&hm= fe75d5170374f5c5a4143f3b0b3eb3010443c529ffa29aa6ce3aca074a31 d391&
world
fps = 25
mob/verb/wont_halt()
while(1)
sleep(858989999)
mob/verb/wont_halt_2()
sleep(858999999)
mob/verb/halt()
while(1)
sleep(858999999)
mob/verb/test_sleep()
world<<"1"
sleep(1)
world<<"2"
mob/verb/test_spawn()
world<<"1"
spawn(1)
world<<"2"
Expected Results:
After using halt, the spawns / sleeps occur as normal, and 2 is outputted when using test_sleep() or test_spawn()
Actual Results:
After using halt, 2 is never outputted when using test_sleep() or test_spawn()
Does the problem occur:
Every time? Or how often? Only when using a while() with a sleep at or exceeding 858999999
In other games? yes
In other user accounts? yes
On other computers? Sometimes, this appears to sometimes not happen and possibly require a larger sleep delay to trigger; presumably there's some sort of integer overflow causing the sleep to become negative.
When does the problem NOT occur?
When sleep is 858989999, or the sleep is not within a while(), which you can see by using wont_halt & wont_halt_2 in the test case and then trying to use the test verbs.
Apparently, this does not occur for me when world.fps is set to 24 or lower, but 25 or higher causes it.
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.
Workarounds:
dont use a while(1) sleep() exceeding a certain delay I guess?