Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: segfaults when used with worker_threads #24

Merged
merged 2 commits into from
Dec 28, 2022

Conversation

mariuspod
Copy link
Contributor

This PR makes the lib more robust when used in combination with worker_threads.
We've observed that the usage of the global constructor field is not thread-safe and may lead to segfaults.

Fixes issue: #19

Minimal segfaulting example without this change:

const wt = require('worker_threads');
const foo = require('keccak');

if(wt.isMainThread) {
  for(let i = 0; i < 100; i++) {
    new wt.Worker(__filename);
  }
}

@fanatid
Copy link
Member

fanatid commented Dec 23, 2022

Sorry for the delay! It's great! Can you fix CI? Probably we should bump node.js version? 🤔 (same for secp256k1-node)

…ts in a race condition between worker threads.
@fanatid
Copy link
Member

fanatid commented Dec 28, 2022

macos failed (windows probably too) 😞

@fanatid
Copy link
Member

fanatid commented Dec 28, 2022

adjusted actions policy, hope that will not need to approve CI on each push 🙂

@fanatid
Copy link
Member

fanatid commented Dec 28, 2022

Published as v3.0.3, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants