Search code examples
javascriptnode.jsemscriptenasm.js

Why might something execute in node but not in the REPL?


I have the following script:

const lib = require('./lib.js');
const fs = require('fs');

const graph = fs.readFileSync('../js-working-dir/add_graph.pb', 'utf8');
const sess = new lib.Session(graph);
const results = sess.run({"a": 5, "b": 6}, ["o"]);
console.log(results[0]);

(For context lib.js is a compiled emscripten module; it is fairly big, approximately 40MB, otherwise I would upload it.)

When I execute this script in node, it works fine. However when I execute it in the REPL (same working directory and everything) my code hangs on const sess = new lib.Session(graph);.

Any ideas of why this might be the case? Does Emscripten treat the REPL and node execution differently? Is there a way I can debug where it is getting stuck?

Screenshot

Thanks so much,


Solution

  • Problem found, appears to be a bug in urandom...

    https://github.com/kripken/emscripten/issues/4905