untu / comedy

Node.js actor framework.
Eclipse Public License 1.0
653 stars 36 forks source link

Sending the message 0 produces undefined for forked and threaded actors. #54

Closed pct-cclausen closed 3 years ago

pct-cclausen commented 3 years ago
// the referenced actor file:
export default class Printer {
    printNumber(n: number) {
        console.log(n);
    }
}

// main file:
    const root = await system.rootActor();

    async function doTest(mode: "in-memory" | "forked" | "threaded") {
        const testActor = await root.createChild("/dist/src/printer", {
            mode
        });
        console.log("Output for: " + mode);
        await testActor.sendAndReceive("printNumber", 0);
        await testActor.destroy();
    }

    await doTest("in-memory");
    await doTest("forked");
    await doTest("threaded");

This prints: Output for: in-memory 0 Output for: forked undefined Output for: threaded undefined

I'd expect it to print 0 for all 3 cases, it seems there must be some sort of if (message) ... in the code somewhere that causes this.

weekens commented 3 years ago

Hi @pct-cclausen ! Thank you so much for your activity and this report! I'm about to start the bug-fixing for this report and the previous one.

weekens commented 3 years ago

Fixing this in #58 .

weekens commented 3 years ago

Fix released in version 2.1.3.