-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
Memory leaks in Jest #300
Comments
any relation with #297? it is probably the result of the |
Yes, I closed that issue thinking that the problem was in Mongoose, but after more investigation realized that Mongoose is alright |
i think this project should get refactored to try and remove this @nodkz what was the intention for having this script? |
@hasezoey MMS was created not only for Jest. And this script was created to kill mongod process when the main process is killed or dies from an internal error. So this script is required for proper cleanups if some unhandled problems occur. But we can avoid it starting if CI or NODE_ENV=test envs are provided. Or maybe disable it for Jest (it also adds some env var). BUT we should keep in mind that in some cases we may get a leak of mongod processes 😈 |
I'm experiencing the same thing. Do you need any more information? The only two processes attached are
|
what is the proper fix for this? I think this only happens when running multiple tests at the same time |
@sibelius It also does it for single tests for me |
@nodkz I think I've found some weird behavior of mongodb-memory-server on CircleCI circleci@abe6b4207204:~$ ps aux | grep mongod
circleci 7281 3.0 0.0 1372764 54228 pts/1 Sl+ 12:32 0:00 /home/circleci/app/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.2.7/mongod --bind_ip 127.0.0.1 --port 42983 --storageEngine ephemeralForTest --dbpath /tmp/mongo-mem-5185ZYHxhK91Udic --noauth
circleci 7300 2.3 0.0 562004 29364 pts/1 Sl+ 12:32 0:00 /usr/local/bin/node /home/circleci/app/node_modules/mongodb-memory-server-core/scripts/mongo_killer.js 5185 7281
circleci 7307 2.0 0.0 1365568 53172 pts/1 Sl+ 12:32 0:00 /home/circleci/app/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.2.7/mongod --bind_ip 127.0.0.1 --port 38677 --storageEngine ephemeralForTest --dbpath /tmp/mongo-mem-6138t8jNj2Gu0E1G --noauth
circleci 7328 2.0 0.0 562036 29092 pts/1 Sl+ 12:32 0:00 /usr/local/bin/node /home/circleci/app/node_modules/mongodb-memory-server-core/scripts/mongo_killer.js 6138 7307
circleci 7335 11.0 0.0 1365568 53300 pts/1 Sl+ 12:32 0:00 /home/circleci/app/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.2.7/mongod --bind_ip 127.0.0.1 --port 41563 --storageEngine ephemeralForTest --dbpath /tmp/mongo-mem-4375ELnIxSOc4Fkp --noauth
circleci 7354 10.0 0.0 562036 29160 pts/1 Sl+ 12:32 0:00 /usr/local/bin/node /home/circleci/app/node_modules/mongodb-memory-server-core/scripts/mongo_killer.js 4375 7335
circleci 7368 0.0 0.0 12864 1024 pts/3 S+ 12:32 0:00 grep mongod Here as you can see neither this happened to us before doing the following upgrades mongodb version 4.0.5 -> 4.2.7 |
check this approach |
Versions
What is your question?
I'm running a simple test using jest with
--detectLeaks
argument and it detects memory leaks. Is it a normal behavior?I experimented with the code below and tried to change uri to a real mongodb instance in this case the test passes without memory leaks errors, so I guess it suggests that the problem might be in mongodb-memory-server package.
The text was updated successfully, but these errors were encountered: