jest: The process exits normally, but I get an open handle error.
- Node.js v12.16.2
- Jest v26.0.1
Related issues https://github.com/facebook/jest/issues/6423#issuecomment-620407580
This code terminates the process normally but Jest
gives an open handle error.
import { promises } from 'dns';
//= const { promises } = require('dns');
const { Resolver } = promises;
const resolver = new Resolver();
const servers = resolver.getServers();
console.log(servers);
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 23
- Comments: 15 (3 by maintainers)
Commits related to this issue
- Ignore DNSCHANNEL when using --detectOpenHandles It turns out that Node.js only holds a weak reference on `DNSCHANNEL` async resources, so they won't prevent a process from exiting. This changes `--d... — committed to Mr0grog/jest by Mr0grog 3 years ago
- Migrate to jest (#854) * Migrate to jest * Use --force-exit until dns close handle issue https://github.com/facebook/jest/issues/9982 Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com> — committed to Unleash/unleash by deleted user 3 years ago
@mifi you can use
--forceExit
CLI option, but it’s just a workaround. I hope it will be fixed soon.@joshkel yeah, I think you’re correct about
DNSCHANNEL
— it’s also explicitly marked as a weak reference in the Node.js source (just a couple lines after one of the ones you linked), so Jest probably shouldn’t track it. There’s actually an explicit block of code for this kind of thing (async stuff that shouldn’t prevent the process from exiting or be tracked), butDNSCHANNEL
just isn’t included there and probably should be: https://github.com/facebook/jest/blob/2cb20e945a26b2c9867b30b787e81f6317e59aa1/packages/jest-core/src/collectHandles.ts#L65-L73(I made some improvements to this area of the codebase just before the Jest 27 release, so I’m at least a little familiar with what’s going on there. 🙂)
Yes, it’s probably a false positive one, but I believe it’s interrupting the development process. The logs are too annoying, and it eats too much line from the terminal and leads us to scroll up every time.
I think I’ve faced this issue after upgrading the Jest from v26.6.3 to v27.0.1
Still seeing this issue.
Node 14.15.0 Jest 26.4.2
Same symptoms here w/Jest v.26.0.23 and node v14.15.0. The minimal repro provided by @CatsMiaow (https://github.com/CatsMiaow/jest-issues-9982) seems to validate the issue on my end.
I am also having the same issue please fix this now its been there from long time.