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

eval openHandles in node > 20.15.1 #1350

Open
santicordone opened this issue Aug 1, 2024 · 0 comments
Open

eval openHandles in node > 20.15.1 #1350

santicordone opened this issue Aug 1, 2024 · 0 comments

Comments

@santicordone
Copy link

When running Jest tests that include the eval command, an open handle is left, preventing Jest from exiting cleanly.

this can be easily reproduce using node 20.15.1 or higher and adding a test in the test/integration/commands/eval.js
like so:
(example form the documentation https://www.npmjs.com/package/ioredis-mock#lua-scripting )

    it('test open handle error', async () => {
      redis.set('k1', 5).then(() => {
        redis[command]('return redis.call("GET", "k1") * 10').then(result => {
          expect(result).toBe(5 * 10)
        })
      })
    })

the result when running jest --detectOpenHandles is:

jest --detectOpenHandles test/integration/commands/eval
 PASS  test/integration/commands/eval.js
 PASS  test/integration/commands/evalsha.js

Test Suites: 2 passed, 2 total
Tests:       16 passed, 16 total
Snapshots:   0 total
Time:        0.437 s, estimated 2 s
Ran all test suites matching /test\/integration\/commands\/eval/i.

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

  ●  TTYWRAP

      171 |   // init fengari
      172 |   const L = lauxlib.luaL_newstate()
    > 173 |   lualib.luaL_openlibs(L)
          |          ^
      174 |   interop.luaopen_js(L)
      175 |   return {
      176 |     L,

      at luaopen_io (node_modules/fengari/src/liolib.js:224:30)
      at luaD_precall (node_modules/fengari/src/ldo.js:169:21)
      at luaD_call (node_modules/fengari/src/ldo.js:366:10)
      at Object.luaD_callnoyield (node_modules/fengari/src/ldo.js:685:5)
      at lua_callk (node_modules/fengari/src/lapi.js:968:13)
      at lua_call (node_modules/fengari/src/lapi.js:976:5)
      at luaL_requiref (node_modules/fengari/src/lauxlib.js:637:9)
      at Object.luaL_openlibs (node_modules/fengari/src/linit.js:13:9)
      at luaL_openlibs (src/lua.js:173:10)
      at RedisMock.customCommand2 (src/commands/defineCommand.js:96:20)
      at commandEmulator (src/command.js:116:18)
      at safelyExecuteCommand (src/command.js:150:11)
      at src/command.js:147:7
      at RedisMock.evaluate (src/commands/eval.js:15:4)
      at RedisMock.apply (src/commands/eval.js:19:30)
      at commandEmulator (src/command.js:116:18)
      at safelyExecuteCommand (src/command.js:150:11)
      at RedisMock.evalBuffer (src/command.js:147:7)
      at Object.<anonymous> (test/integration/commands/eval.js:15:42)
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

No branches or pull requests

1 participant