semaphore icon indicating copy to clipboard operation
semaphore copied to clipboard

Semaphore package leaks handles, prevents node from exiting

Open dcposch opened this issue 2 years ago • 3 comments

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

dcposch avatar May 05 '23 12:05 dcposch

Using @semaphore-protocol/{group,identity,proof} version 3.2.3

dcposch avatar May 05 '23 12:05 dcposch

Hello @dcposch! It seems to be related to snarkjs which is used in the @semaphore-protocol/proof package to generate and verify a proof.

vplasencia avatar May 05 '23 15:05 vplasencia

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.

cedoor avatar Mar 29 '24 17:03 cedoor