Repository: nestjs/nest

Issue #11071: "perf(core): change sha1 to xxhash" commit broke runtime of Nest.js application on Ubuntu 20.04
Created: 2023-02-07T17:51:12Z
Did you read the migration guide?

 I have read the whole migration guide

Is there an existing issue that is already proposing this?

 I have searched the existing issues

Potential Commit/PR that introduced the regression
7f43821
NestJS version
9.3.2 -> 9.3.5
Describe the regression
So, I've upgraded @nestjs/common and @nestjs/core dependencies from 9.3.2. to 9.3.5. Decided to run them on my PC with Windows 10, runs perfectly, all good. Pushed to my Github and let the Actions complete the build and deployment processes, and this is "docker logs" output of the container that runs my Nest.js application.
Error: Cannot find module '@node-rs/xxhash-linux-x64-gnu'
Require stack:
- /app/node_modules/@node-rs/xxhash/index.js
- /app/node_modules/@nestjs/core/inspector/deterministic-uuid-registry.js
- /app/node_modules/@nestjs/core/inspector/uuid-factory.js
- /app/node_modules/@nestjs/core/injector/instance-wrapper.js
- /app/node_modules/@nestjs/core/injector/injector.js
- /app/node_modules/@nestjs/core/injector/module-ref.js
- /app/node_modules/@nestjs/core/injector/lazy-module-loader/lazy-module-loader.js
- /app/node_modules/@nestjs/core/inspector/serialized-graph.js
- /app/node_modules/@nestjs/core/injector/container.js
- /app/node_modules/@nestjs/core/injector/index.js
- /app/node_modules/@nestjs/core/index.js
- /app/dist/main.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1047:15)
    at Module._load (node:internal/modules/cjs/loader:893:27)
    at Module.require (node:internal/modules/cjs/loader:1113:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/app/node_modules/@node-rs/xxhash/index.js:172:31)
    at Module._compile (node:internal/modules/cjs/loader:1226:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1280:10)
    at Module.load (node:internal/modules/cjs/loader:1089:32)
    at Module._load (node:internal/modules/cjs/loader:930:12)
    at Module.require (node:internal/modules/cjs/loader:1113:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/app/node_modules/@node-rs/xxhash/index.js',
    '/app/node_modules/@nestjs/core/inspector/deterministic-uuid-registry.js',
    '/app/node_modules/@nestjs/core/inspector/uuid-factory.js',
    '/app/node_modules/@nestjs/core/injector/instance-wrapper.js',
    '/app/node_modules/@nestjs/core/injector/injector.js',
    '/app/node_modules/@nestjs/core/injector/module-ref.js',
    '/app/node_modules/@nestjs/core/injector/lazy-module-loader/lazy-module-loader.js',
    '/app/node_modules/@nestjs/core/inspector/serialized-graph.js',
    '/app/node_modules/@nestjs/core/injector/container.js',
    '/app/node_modules/@nestjs/core/injector/index.js',
    '/app/node_modules/@nestjs/core/index.js',
    '/app/dist/main.js'
  ]
}

Minimum reproduction code
No response
Input code

Expected behavior
Application should run normally on Ubuntu 20.04, just like it does on Windows 10.
Other
Runs on Github hosted Ubuntu runners, this is Actions response for a simple unit test stage:

Produces pretty much the same error:
Require stack:
      node_modules/@node-rs/xxhash/index.js
      node_modules/@nestjs/core/inspector/deterministic-uuid-registry.js
      node_modules/@nestjs/core/inspector/uuid-factory.js
      node_modules/@nestjs/core/injector/instance-wrapper.js
      node_modules/@nestjs/core/injector/injector.js
      node_modules/@nestjs/core/injector/module-ref.js
      node_modules/@nestjs/core/injector/lazy-module-loader/lazy-module-loader.js
      node_modules/@nestjs/core/inspector/serialized-graph.js
      node_modules/@nestjs/core/injector/container.js
      node_modules/@nestjs/testing/testing-module.builder.js
      node_modules/@nestjs/testing/test.js
      node_modules/@nestjs/testing/index.js
      src/tests/auth.controller.spec.ts

    > 1 | import { Test, TestingModule } from "@nestjs/testing";
        | ^
      2 | import { I18nContext } from "nestjs-i18n";
      3 | import { getMockReq, getMockRes } from "@jest-mock/express";
      4 | import { UserService } from "@user/services";

      at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
      at Object.<anonymous> (node_modules/@node-rs/xxhash/index.js:[17](https://github.com/Pinehood/ph-s2u-backend/actions/runs/4116536300/jobs/7106703742#step:7:18)2:31)
      at Object.<anonymous> (node_modules/@nestjs/core/inspector/deterministic-uuid-registry.js:4:[18](https://github.com/Pinehood/ph-s2u-backend/actions/runs/4116536300/jobs/7106703742#step:7:19))
      at Object.<anonymous> (node_modules/@nestjs/core/inspector/uuid-factory.js:5:39)
      at Object.<anonymous> (node_modules/@nestjs/core/injector/instance-wrapper.js:11:24)
      at Object.<anonymous> (node_modules/@nestjs/core/injector/injector.js:14:28)
      at Object.<anonymous> (node_modules/@nestjs/core/injector/module-ref.js:8:[20](https://github.com/Pinehood/ph-s2u-backend/actions/runs/4116536300/jobs/7106703742#step:7:21))
      at Object.<anonymous> (node_modules/@nestjs/core/injector/lazy-module-loader/lazy-module-loader.js:5:22)
      at Object.<anonymous> (node_modules/@nestjs/core/inspector/serialized-graph.js:8:30)
      at Object.<anonymous> (node_modules/@nestjs/core/injector/container.js:6:28)
      at Object.<anonymous> (node_modules/@nestjs/testing/testing-module.builder.js:6:[21](https://github.com/Pinehood/ph-s2u-backend/actions/runs/4116536300/jobs/7106703742#step:7:22))
      at Object.<anonymous> (node_modules/@nestjs/testing/test.js:5:34)
      at Object.<anonymous> (node_modules/@nestjs/testing/index.js:11:[22](https://github.com/Pinehood/ph-s2u-backend/actions/runs/4116536300/jobs/7106703742#step:7:23))
      at Object.<anonymous> (src/tests/auth.controller.spec.ts:1:1)

Duplicate issue #11072: Test.createTestingModule leaves open handle due to xxh32
Created: 2023-02-07T18:25:53Z
Did you read the migration guide?

 I have read the whole migration guide

Is there an existing issue that is already proposing this?

 I have searched the existing issues

Potential Commit/PR that introduced the regression
d323edb
NestJS version
9.0.0 -> 9.3.5
Describe the regression
After upgrading from 9.0.0 to 9.3.5, tests are randomly reporting: "Jest did not exit one second after the test run has completed."
After running with --detectOpenHandles
Jest has detected the following 1 open handle potentially keeping Jest from exiting:

  ●  CustomGC

    > 1 | import { Test } from '@nestjs/testing';
        | ^
      2 |
      3 | Test.createTestingModule({});
      4 |

      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> (../../node_modules/@nestjs/core/inspector/deterministic-uuid-registry.js:4:18)
      at Object.<anonymous> (../../node_modules/@nestjs/core/injector/instance-wrapper.js:11:24)
      at Object.<anonymous> (../../node_modules/@nestjs/core/injector/injector.js:14:28)
      at Object.<anonymous> (../../node_modules/@nestjs/core/injector/module-ref.js:8:20)
      at Object.<anonymous> (../../node_modules/@nestjs/core/injector/lazy-module-loader/lazy-module-loader.js:5:22)
      at Object.<anonymous> (../../node_modules/@nestjs/core/inspector/serialized-graph.js:8:30)
      at Object.<anonymous> (../../node_modules/@nestjs/core/injector/container.js:6:28)
      at Object.<anonymous> (../../node_modules/@nestjs/testing/testing-module.builder.js:6:21)
      at Object.<anonymous> (../../node_modules/@nestjs/testing/test.js:5:34)
      at Object.<anonymous> (../../node_modules/@nestjs/testing/index.js:11:22)
      at Object.<anonymous> (test/foo.spec.ts:1:1)

Investigating further, noticed this recent change
d323edb
So I tried to run xxh32 directly:
import { xxh32 } from '@node-rs/xxhash';
xxh32('foobarbaz');
producing similar output
Jest has detected the following 1 open handle potentially keeping Jest from exiting:


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

      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)

So I assume it's due to the uuid -> xxhash change.
Minimum reproduction code
No response
Input code
No response
Expected behavior
Jest exits properly.
Other
No response

Closing comment (2023-02-07T18:29:30Z): duplicate of #11071