[Coldstuff] vm_task bug?

Allen Noe coldstuff@cold.org
Thu, 28 Mar 2002 03:31:44 -0600


I've been testing a few things, trying to find a bug that may be related to
open_connection, and I stumbled on something that may be a bug in the way
vm_task does its driver-method calls.

Core:

object $sys;

public method .startup() {
    arg @args;

    dblog("startup tid=" + toliteral(task_id()));
    open_connection("127.0.0.1", 42);
    suspend();                           
    dblog("done");
    shutdown();   
};

public method .failed() {
    arg @args;

    dblog("failed tid=" + toliteral(task_id()));
    dblog("failed: " + toliteral(args));
    resume(args[1]);
    dblog("out of resume");
};

Output:

[...]
Calling $sys.startup([])...
startup tid=1
failed tid=1
failed: [1, ~refused]
out of resume

And it hangs here until I kill it. I traced genesis with gdb and it looks like
vm_resume is noticing that task_id is the same as the TID it's being asked to
resume, and just returns. The startup task just sits suspended forever.

So I looked around the code a little, and copied the task_id = next_task_id++;
line in vm_task() up to just after the first if, ran it again, and got this
output:

[...]
Calling $sys.startup([])...
startup tid=1
failed tid=3
failed: [1, ~refused]
done
out of resume

This time it shuts down. So is this a bug? If it is, what would the best way to
fix it be?