question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The process exits normally, but I get an open handle error.

See original GitHub issue
  • 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);

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:23
  • Comments:15 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
5tarlxrdcommented, Jan 11, 2021

@mifi you can use --forceExit CLI option, but it’s just a workaround. I hope it will be fixed soon.

5reactions
Mr0grogcommented, May 28, 2021

@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), but DNSCHANNEL 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. 🙂)

Read more comments on GitHub >

github_iconTop Results From Across the Web

is it a good practice to close file descriptors on exit
When a process terminates, all of its open files are closed automatically by the kernel. Many programs take advantage of this fact and...
Read more >
Open handle keeps Jest from exiting ( TCPSERVERWRAP)
Error: Jest has detected the following 1 open handle potentially keeping Jest from exiting: ○ TCPSERVERWRAP Env: Node 10 Supertest 3.3.0 ...
Read more >
Let It Crash: Best Practices for Handling Node.js Errors on ...
The most common one is the process. exit. You can pass an exit code, the zero if it's a success exit or higher...
Read more >
Chapter 5. Concurrent error-handling and fault tolerance with ...
In this chapter, you'll first learn about links, monitors, trapping exits, and processes, and how they come together as the fundamental building blocks...
Read more >
C++ Tutorial: Handling Exceptions - 2020
A program may have division by zero, or page fault, or may request more memory than is available, or it may try to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found