semaphore
semaphore copied to clipboard
Semaphore package leaks handles, prevents node from exiting
Describe the bug
My Mocha unit tests hang unless I specify --exit to kill the test process after each suite.
It looks like this may be because Semaphore leaks some resources.
To Reproduce
Write any test or script that verifies a Semaphore proof. At the end, add:
const foo = (process as any)._getActiveHandles();
console.log(foo);
You'll see that this includes a bunch of mysterious MessagePort handles.
Expected behavior
Should show exactly two handles, corresponding to stdin/stdout.
Technologies (please complete the following information):
- Node.js version 20
- NPM version 9.6.4
- Solidity version N/A
Using @semaphore-protocol/{group,identity,proof} version 3.2.3
Hello @dcposch! It seems to be related to snarkjs which is used in the @semaphore-protocol/proof package to generate and verify a proof.
https://github.com/semaphore-protocol/semaphore/issues/736#issuecomment-2027490466
This issue is related to snarkjs, but Semaphore could provide a function to "terminate" it.