-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[Bug]: Regression in detectOpenHandles for DNSCHANNEL #14788
Comments
* fix: Bump deps. * Use jest-matchers-object lookup. * Bump Jest for prettier v3/mjs support. * Use toThrow. * Fix outputDirectory. * Add comment. * Disable detectOpenHandles due to false positive. jestjs/jest#14788 * Re-format.
https://github.com/jestjs/jest/pull/13417/files#r991756357 Some people use By the way, if you remove the reference to import { promises } from "dns";
const { Resolver } = promises;
const resolver = new Resolver();
let servers = resolver.getServers();
console.log(servers);
servers = null;
describe("foo", () => {
it("works", () => {});
}); |
Oh, yeah, this seems surprising to me, too. That said, I like what that change did to surface multiple open handles from from the same stack trace! While working on #11470 I made a note suggesting something similar, but never had time to get around to it: https://github.com/jestjs/jest/pull/11470/files#r641328430
Yeah… I guess I think of its purpose as being specifically about the latter and not about the former, which is why I made the changes in #11470. The
One of the comments on #13417 suggest the same thing : https://github.com/jestjs/jest/pull/13417/files#r991756357
@liuxingbaoyu This is probably not only about GC. In #11429 I added an You shortened that sleep from 100 ms to two sleeps (first 0 ms, then 30 ms). I saw a lot of cases where 0 was not enough (see this change where I realized that: 0fab1e4), but I don’t remember what timings I was typically seeing in my experiments. 30 might be fine, or it might be a bit too short. (It’s also possible I am remembering something wrong here; this was a long time ago!) |
Thank you for your extremely detailed explanation!
Yes! I forgot about it, some nodejs internal objects need to go through some event loop before they are destroyed. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Version
v30.0.0-alpha.2
Steps to reproduce
I'm using knex in a project that gets false positives for open handles, but it can be reproduced with this test:
Expected behavior
I expected
jest --detectOpenHandles
to not report anything, because the above code doesn't hang jest, it does actually exit cleanly.Actual behavior
Jest does exit cleanly, but shows an error about an open handle:
Additional context
It looks like the
DNSCHANNEL
false positive was originally fixed here:https://github.com/jestjs/jest/pull/11470/files
But then a refactor of
detectOpenHandles
(to dedupe stack traces) regressed the behavior (by removing the check as a potentially speculative clean up separate from deduping the stack traces?):https://github.com/jestjs/jest/pull/13417/files
My reproduction is really just a copy/paste of #11470 's reproduction from #9982.
From the conversation in https://github.com/jestjs/jest/pull/13417/files#r990874803 , it kinda seems like maybe @liuxingbaoyu didn't understand why these types were being ignored, and more than just
DNSCHANNEL
needs to be added back to the "if type then early return" check?Also cc @Mr0grog who fixed the original
DNSCHANNEL
false positive.Environment
The text was updated successfully, but these errors were encountered: