napi-rs / napi-rs/node-rs

xxh32 leaves open handle

Open
#658 1 comment 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.5k
Forks
52
Avg merge
13h 37m
Merged PRs (30d)
19

Description

Hi, xxh32 (not sure if specifically this function or the lib in general) seems to be leaking some resources. When used as part of jest tests, it randomly causes:
"Jest did not exit one second after the test run has completed."
When executed with --detectOpenHandles:

Jest has detected the following 1 open handle potentially keeping Jest from exiting:


    > 1 | import { xxh32 } from '@node-rs/xxhash';
        | ^
      2 | xxh32('foobarbaz');
      3 |

      at Runtime._loadModule (../../node_modules/jest-runtime/build/index.js:1218:29)
      at Object.<anonymous> (../../node_modules/@node-rs/xxhash/index.js:64:29)
      at Object.<anonymous> (test/foo.spec.ts:1:1)

This issue was originally reported as part of @nestjs repo:
https://github.com/nestjs/nest/issues/11072

While at it, hope it's ok if I mention another issue that prevents adoption by the same lib, which deals with cross-platform development: https://github.com/nestjs/nest/issues/11071
Could you perhaps clarify if this is expected behavior? Is the generated lockfile platform specific? Is this workflow possible/supported? What would be the correct/intended way to handle such situation? Thank you.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the import path in index.js at line 64 and reproduce the issue from test/foo.spec.ts using Jest's --detectOpenHandles option. Trace which resource remains open after xxh32('foobarbaz') completes, then confirm that the test process exits without the reported handle.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, rust, typescript
Domain
backend, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.