From 8a8005effaeb7be649541715f3172322061a8dcd Mon Sep 17 00:00:00 2001 From: dapplion Date: Thu, 10 Dec 2020 11:16:55 +0000 Subject: [PATCH] Worker thread error demo --- .github/workflows/ci.yml | 2 ++ bindings/node.js/runnable.js | 2 +- bindings/node.js/worker-threads.js | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 bindings/node.js/worker-threads.js diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 522d400c..39de5717 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,3 +126,5 @@ jobs: ) fi fi + - name: Worker threads error + run: node bindings/node.js/worker-threads.js diff --git a/bindings/node.js/runnable.js b/bindings/node.js/runnable.js index 002ce8dc..138ad739 100644 --- a/bindings/node.js/runnable.js +++ b/bindings/node.js/runnable.js @@ -2,7 +2,7 @@ console.log("testing..."); -const blst = require("blst"); +const blst = require("./blst.node"); var msg = "assertion"; // this what we're signing var DST = "MY-DST"; // domain separation tag diff --git a/bindings/node.js/worker-threads.js b/bindings/node.js/worker-threads.js new file mode 100644 index 00000000..b0e50839 --- /dev/null +++ b/bindings/node.js/worker-threads.js @@ -0,0 +1,8 @@ +const { Worker } = require("worker_threads"); + +// Create two workers so blst.node is imported twice to trigger the error +// blst/bindings/node.js$ node worker-threads.js +// Error: Module did not self-register: 'blst/bindings/node.js/blst.node'. + +const worker1 = new Worker("./runnable.js"); +const worker2 = new Worker("./runnable.js");