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 #193

Closed
wants to merge 2 commits into from

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: #172

Minimal segfaulting example without this change:

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

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

@fanatid
Copy link
Member

fanatid commented Dec 28, 2022

@mariuspod can you update it as keccak? cryptocoinjs/keccak#24

@fanatid
Copy link
Member

fanatid commented Dec 31, 2022

@mariuspod thank you! I finished PR in #195 and published as v5.0.0

@fanatid fanatid closed this Dec 31, 2022
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