-
Notifications
You must be signed in to change notification settings - Fork 654
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Jest detects open handle from bindAsync #2581
Comments
In my current version of |
Same issue I have since updated @grpc/grpc-js from 1.9.2 to 1.9.3. Nothing else changed. Again it worked before version 1.9.3 Here is the error: ● HTTP2SESSION
` |
You said that it started when upgrading from 1.9.2 to 1.9.3, so it seems unlikely that it was caused by changes between 1.9.1 and 1.9.2. The most local item in the reported call stack is On the other hand, the change from 1.9.2 to 1.9.3 did actually touch code in close proximity to that line, but the primary change was actually to stop running timers that were sometimes left running due to a bug, so if anything it should have eliminated some open handles. |
I just published grpc-js version 1.9.4 with a fix for one bug that was keeping a handle reffed incorrectly. Please try it out and see if it fixes the issue in jest. |
Hi @murgatroid99, In my example reproduction of the problem, I do shutdown the server when I am done with it https://github.com/christopher-watanabe-snkeos/jest-open-handle-bindAsync/blob/27b05ad0ccd6b15cbe2a6920de5043daa3aa00da/test.js#L11. This I do once all my jest tests are finished. Updating to 1.9.4 continues to show the issue. |
Your test isn't waiting for the server to start before running the rest of the test. I think you're running into a race condition where you call |
@murgatroid99: You are absolutely right. I wasn't aware of this jest convention with the done callback, but it solves my problem. Thank you very much! @alenon: I don't know if this will also correct your issue, but I'll leave this issue open for the time being and defer the closing of the issue to @murgatroid99 or yourself. |
@murgatroid99, @alenon : Interestingly, following the pattern that I followed for my test project in another project with more extensive testing, I'm now getting the same HTTP2SESSION error that @alenon is experiencing. |
I think I will need to see a full test that produces that error to understand what might be happening. With the fix I mentioned in 1.9.4, my own tests terminate immediately after completing. |
I published a change in version 1.9.5 to automatically handle that race between |
@murgatroid99 : Thanks for the change! I've been out for a few weeks, but I will have a look at whether the update fixes my issue. |
@murgatroid99 : I can confirm that updating the package to 1.9.5 solves the issue of the binding and shutdown. However, updating to 1.9.6 and above reintroduces the problem. |
There were no changes from 1.9.5 to 1.9.6 that I can identify as affecting any behavior related to asynchronous operations. Can you please share the text of the error you are seeing in the most recent versions of the library? |
Thanks for the reply. The message from jest is the following after running my tests:
Interestingly, I'm seeing the following behavior for the following versions:
|
OK, that makes more sense. Updating to 1.9.6 didn't introduce any problem, as I expected. There was a bug introduced in 1.9.7 that was fixed in 1.9.9, so I expect that bug was also the cause of the open handle you were seeing. It looks like the problem has been resolved, so I'll close this issue. |
Problem description
My jest tests complain that an open handle is generated by the call to bindAsync on a Grpc Server I use during the tests.
Reproduction steps
I've made a simple example that creates starts a grpc server before all tests in this repo https://github.com/christopher-watanabe-snkeos/jest-open-handle-bindAsync.
To reproduce the error:
jest --detectOpenHandles
Environment
Additional context
I can avoid this with the
--forceExit
option of Jest, but I would like to understand why / how this open handle is generated.The text was updated successfully, but these errors were encountered: