Intermittently, onRoundStart seems to get called twice in this one experiment.
Expected Behavior
onRoundStart (and all callbacks) should ever only be called once.
Current Behavior
In this experiment, onRoundStart logs, and the same logs appear twice (same game ID, same round index).
Possible Solution
It could be due to a child_process.spawnSync call in this callback. Meteor's Fibers can potentially work against other blocking mechanisms inside node (sodlib sync calls, async/await, futures...)
I suspect wrapping spawn (non-blocking version) in a Fiber's Future might remove the "we have 2 blocking mechanisms coexisting" issue.
Steps to Reproduce (for bugs)
Running a couple of batches in production. It does not seem to happen locally. I think it might happen with enough load when the scheduler starts doing more concurrent things.
Relevant code:
const result = cp.spawnSync("python", [myscript], { input: "hello" });
const data = JSON.parse(result.stdout);
console.log("In game " + game._id + ", round " + (round.index + 1));
Note, the usage of spawn instead of exec might not be required as long as it has the same result.
Intermittently,
onRoundStart
seems to get called twice in this one experiment.Expected Behavior
onRoundStart
(and all callbacks) should ever only be called once.Current Behavior
In this experiment,
onRoundStart
logs, and the same logs appear twice (same game ID, same round index).Possible Solution
It could be due to a child_process.spawnSync call in this callback. Meteor's Fibers can potentially work against other blocking mechanisms inside node (sodlib sync calls, async/await, futures...)
I suspect wrapping
spawn
(non-blocking version) in a Fiber's Future might remove the "we have 2 blocking mechanisms coexisting" issue.Steps to Reproduce (for bugs)
Running a couple of batches in production. It does not seem to happen locally. I think it might happen with enough load when the scheduler starts doing more concurrent things.
Relevant code:
Note, the usage of spawn instead of exec might not be required as long as it has the same result.