-
Notifications
You must be signed in to change notification settings - Fork 296
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
dd-trace
leaks handles in jest
test suite, resulting in incomplete CI test tracing
#2134
Comments
hi @jmichel17, thanks for reporting this issue. Since you're using github actions, would it be possible for you to use the agentless mode? https://docs.datadoghq.com/continuous_integration/setup_tests/javascript/?tab=cloudciprovideragentless This should make the setup easier and hopefully fix the flush issue. As for the leak, they seem to be from requests to the agent, so this change should improve that as well. |
@juan-fernandez Thank you for the response. Unfortunately, I have been unable to resolve this for my team as of yet. I tried utilizing agentless mode to ensure full flushing. In addition I tried all of the following but with still incomplete reporting up to the DD CI dashboard:
|
I should also add... I also tried upgrading to Node v16 in case that mattered, but unfortunately got the same result. |
hi @jmichel17 , thanks for the information. There seems to be an error before the flush. Did you try to run your tests with |
Hi, I am experiencing the very same on my side. In our case, we have a test suite of 218 test cases and what we see it's being reported is actually a random number of tests that can go from 90 to 160, just by rerunning the same job. Just tried with the options you commented @juan-fernandez and I did see something "interesting"
I also saw other traces like the following
or like this
|
a
|
Oh ok good to know. The versions I am using are I run it with this command where I use react-scripts test for this repo
where test:dd is the following:
Worth mentioning that in other repo, I run it with jest (without any react-scripts on top of it) and I do not have any issues. I've just run it using the options
Will check the application key thing just in case |
thanks, that's helpful. Don't worry about the application key, it's not mandatory. This error message What jest testRunner are you using? jest@27 has |
It's |
We encountered the same issue. All tests were executed in a Github action job, but none of them were reported in the datadog CI test dashboard. We resolved this issue by upgrading Jest from version v27 to v29. Although we have yet to determine the root cause, the test report is now displaying normally in the datadog CI test dashboard. |
closing due to lack of activity. Feel free to reopen if you encounter this issue again. |
Expected behaviour
Instrumenting
jest
tests withdd-trace
should not leak any handles.Actual behaviour
My
jest
test suite contains 76 tests in it. When executing all of these tests in a Github actions job, only ~32 were actually getting reported to the Datadog CI test dashboard. Adding an arbitrarily selected 10 second wait after the jest tests completed resulted in 75 of the 76 getting reported up to the dashboard. Presumably, the difference in tracing coverage was due to the fact that thedd-trace
library was not flushing its traces.I've yet to see all 76 tests reported. On the runs where 75 were reported with the help of a wait, the following error was logged:
In combination with jest's
--detectOpenHandles
and--runInBand
options plus theleaked-handles
npm package (https://github.com/Raynos/leaked-handles), I discovered there is evidencedd-trace
is the culprit leaking handles and potentially causing the forced exit. And in turn probably also the cause of the 76th test not getting reported.The pertinent logs produced by
leaked-handles
are as follows:and...
Steps to reproduce
The trouble in reproducing this is we aren't doing anything exotic in our
jest
test suite. We run our tests with thejest-environment-jsdom
test environment and include thedd-trace
library per your documentation:Environment
Operation system:
https://hub.docker.com/layers/node/library/node/14.19-buster-slim/images/sha256-a3b69090a0643dc06e80783ed3414c7e5decf8f4768c79124c379a7717fffe4c?context=explore
Node.js version:
v14.19
Tracer version:
v2.9.1
Agent version:
Relevant library versions:
v2.9.1
The text was updated successfully, but these errors were encountered: