ID:84875
 
BYOND Version:454
Operating System:Windows XP Pro
Web Browser:Firefox 3.5.4
Status: Deferred

This issue may be low priority or very difficult to fix, and has been put on the back burner for the time being.
Descriptive Problem Summary:

Well the problem is pretty self-explanatory... world.Export() "falls asleep" when pinging a Dream Daemon that is frozen/has crashed, in stead of timing out after 1 or 2 seconds as it normally should do.

Numbered Steps to Reproduce Problem:

I have made a demo to... demonstrate this bug:
http://fflegacy.110mb.com/export%20bug.zip

1: run the "export" environment and host it at Trusted
2: click the "startup world" verb to startup the "crash" environment and trigger the proc with world.Export()
3: wait a few seconds to see if it exports successfully
4: connect to the hosted "crash" environment and click the "crash" verb
5: if you switch back to the "crash" environment, you will see that the messages stopped at "Pinging...". You can wait, a minute.. and hour... or even a day, and it will never display the "Failed!" message... untill you kill the Dream Daemon process that is being pinged.

Code Snippet (if applicable) to Reproduce Problem:

"export" environment:
client

New()
src << "First, host this environment on Trusted<br>"
src << "Then use verb 'startup world' to host the 'crash' environment<br>"
src << "Proc 'do_export() will start, let it export a few times to see if it exports successfully'<br>"
src << "Then connect to the hosted 'crash' environment and use the 'crash' verb<br>"
src << "do_export() proc will be stuck at 'Pinging...' and will only display 'Failed!' after you close DD manually."
..()

verb
startup_world()
if(!world.port)
src << "Please host this enviroment on Trusted before using this verb."
return

var/path = input(src,"Specify the path to the .dmb file to run.", "Startup world") as null|text
if(path && fexists(path))
Port = rand(1000,9999)
startup(file(path), Port, "-trusted")
sleep(30)
var/reachable = world.Export("byond://localhost:[Port]?ping")
if(!isnull(reachable))
src << "Started environment [path] on port [Port]"
do_export()
else src << "byond://localhost:[Port] is not reachable. Port may already be in use."

var/Port

proc/do_export()
var/ping
while(1)
sleep(50)
ping = null
world << "Pinging..."
ping = world.Export("byond://localhost:[Port]?ping")
if(!isnull(ping))
world << "Pinged!"
else world << "Failed!"


"crash" environment:
var/oops

proc/Crash()
while(1)
oops++

client/verb/crash() Crash()


Expected Results:

When the pinged Dream Daemon freezes for whatever reason, world.Export() should time out after 1 or 2 seconds and return 0.

Actual Results:

world.Export() just falls asleep and never wakes up.

Does the problem occur:
Every time? Or how often? Every time.
In other games? For any frozen environment.
In other user accounts? Irrelevant.
On other computers? I only have one computer.

When does the problem NOT occur? It always occurs.

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.)

Not that I know of.

Workarounds:

Calling world.Export() in a spawn() and sleep a second after the spawn()