{"action":"opened","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/21481","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/21481/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/21481/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/21481/events","html_url":"https://github.com/nodejs/node/issues/21481","id":335075318,"node_id":"MDU6SXNzdWUzMzUwNzUzMTg=","number":21481,"title":"requiring C++ addon modules occurs 'Error: Module did not self-register.' with Worker Threads","user":{"login":"ledsun","id":1079508,"node_id":"MDQ6VXNlcjEwNzk1MDg=","avatar_url":"https://avatars3.githubusercontent.com/u/1079508?v=4","gravatar_id":"","url":"https://api.github.com/users/ledsun","html_url":"https://github.com/ledsun","followers_url":"https://api.github.com/users/ledsun/followers","following_url":"https://api.github.com/users/ledsun/following{/other_user}","gists_url":"https://api.github.com/users/ledsun/gists{/gist_id}","starred_url":"https://api.github.com/users/ledsun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ledsun/subscriptions","organizations_url":"https://api.github.com/users/ledsun/orgs","repos_url":"https://api.github.com/users/ledsun/repos","events_url":"https://api.github.com/users/ledsun/events{/privacy}","received_events_url":"https://api.github.com/users/ledsun/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-23T06:54:18Z","updated_at":"2018-06-23T06:54:18Z","closed_at":null,"author_association":"NONE","body":"<!--\r\nThank you for reporting an issue.\r\n\r\nThis issue tracker is for bugs and issues found within Node.js core.\r\nIf you require more general support please file an issue on our help\r\nrepo. https://github.com/nodejs/help\r\n\r\n\r\nPlease fill in as much of the template below as you're able.\r\n\r\nVersion: output of `node -v`\r\nPlatform: output of `uname -a` (UNIX), or version and 32 or 64-bit (Windows)\r\nSubsystem: if known, please specify affected core module name\r\n\r\nIf possible, please provide code that demonstrates the problem, keeping it as\r\nsimple and free of external dependencies as you are able.\r\n-->\r\n\r\n* **Version**: v10.5.0\r\n* **Platform**: Darwin nakajimashigeru-no-MacBook-Pro.local 16.7.0 Darwin Kernel Version 16.7.0: Fri Apr 27 17:59:46 PDT 2018; root:xnu-3789.73.13~1/RELEASE_X86_64 x86_64\r\n* **Subsystem**: worker\r\n\r\n<!-- Enter your issue details below this comment. -->\r\n\r\nWhen C++ addon was loaded twice with worker threads, error below occurs:\r\n\r\n```\r\nevents.js:167\r\n      throw er; // Unhandled 'error' event\r\n      ^\r\nError: Module did not self-register.\r\n    at Object.Module._extensions..node (internal/modules/cjs/loader.js:731:18)\r\n    at Module.load (internal/modules/cjs/loader.js:612:32)\r\n    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)\r\n    at Function.Module._load (internal/modules/cjs/loader.js:543:3)\r\n    at Module.require (internal/modules/cjs/loader.js:650:17)\r\n    at require (internal/modules/cjs/helpers.js:20:18)\r\n    at bindings (/Users/shigerunakajima/worker_thread_test/node_modules/bindings/bindings.js:81:44)\r\n    at Object.<anonymous> (/Users/shigerunakajima/worker_thread_test/node_modules/libxmljs/lib/bindings.js:1:99)\r\n    at Module._compile (internal/modules/cjs/loader.js:702:30)\r\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)\r\nEmitted 'error' event at:\r\n    at Worker.[kOnErrorMessage] (internal/worker.js:281:10)\r\n    at Worker.[kOnMessage] (internal/worker.js:291:37)\r\n    at MessagePort.Worker.(anonymous function).on (internal/worker.js:228:57)\r\n    at MessagePort.emit (events.js:182:13)\r\n    at MessagePort.onmessage (internal/worker.js:57:8)\r\n```\r\n\r\nTo reproduce, run code below with --experimental-worker flag:\r\n\r\n```js\r\nconst libxmljs = require('libxmljs')\r\nconst {\r\n  Worker\r\n} = require('worker_threads')\r\n\r\nnew Worker(__filename)\r\n```\r\n\r\nWhen I try to require the [sharp](https://github.com/lovell/sharp), same error occurs.\r\n"}}
{"actor":{"display_login":"ledsun"}}