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.

Can't run mongodb memory server, instance closed with code "127"

See original GitHub issue

Versions

  • NodeJS: v14.17.0
  • mongodb-memory-server-*: 6.9.6
  • mongodb: 3.6.9
  • system: Ubuntu 20.04.2 aarch64

package: mongo-memory-server

What is your question?

when I write this following code

const mongod = await new MongoMemoryServer() ;
console.log(await mongod.getUri());
await mongod.stop() ;

I get the following error

MongoMS:MongoMemoryServer Called MongoMemoryServer.ensureInstance() method +0ms
  MongoMS:MongoMemoryServer  - no running instance, call `start()` command +2ms
  MongoMS:MongoMemoryServer Called MongoMemoryServer.start() method +1ms
  MongoMS:MongoMemoryServer starting with port 36887, since undefined was locked: 36887 +15ms
  MongoMS:MongoMemoryServer Starting MongoDB instance with following options: {"port":36887,"dbName":"b5e2a186-5445-4fd3-b2ad-47f7f5761932","ip":"127.0.0.1","storageEngine":"ephemeralForTest","dbPath":"/tmp/mongo-mem--6991-2czqRh3CtUpp","tmpDir":{"name":"/tmp/mongo-mem--6991-2czqRh3CtUpp"},"uri":"mongodb://127.0.0.1:36887/b5e2a186-5445-4fd3-b2ad-47f7f5761932?"} +7ms
  MongoMS:MongoBinary MongoBinary options: {
  "downloadDir": "/home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries",
  "platform": "linux",
  "arch": "arm64",
  "version": "4.0.14",
  "checkMD5": false
} +0ms
  MongoMS:MongoBinary MongoBinary: Download lock removed +17ms
  MongoMS:MongoBinary MongoBinary: Mongod binary path: "/home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod" +2ms
  MongoMS:MongoInstance Mongo[36887]: Called MongoInstance._launchKiller(parent: 6991, child: 7002): +0ms
  MongoMS:MongoInstance Mongo[36887]: STDERR: /home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: No such file or directory
  MongoMS:MongoInstance  +33ms
  MongoMS:MongoInstance Mongo[36887]: Mongod instance closed with an non-0 code! +6ms
  MongoMS:MongoInstance Mongo[36887]: CLOSE: 127 +1ms
  MongoMS:MongoInstance Mongo[36887]: MongodbInstance: Instance has failed: Mongod instance closed with code "127" +1ms
(node:6991) UnhandledPromiseRejectionWarning: Mongod instance closed with code "127"
(Use `node --trace-warnings ...` to show where the warning was created)
(node:6991) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:6991) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  MongoMS:MongoInstance Mongo[36887]: [MongoKiller]: exit - [null,"SIGTERM"] +12ms

then I made symlinks for libssl1.1 as libssl.so.1.0.0 and libcrypto.so.1.1 as libcrypto.so.1.0.0, and I got

MongoMS:MongoMemoryServer Called MongoMemoryServer.ensureInstance() method +0ms
  MongoMS:MongoMemoryServer  - no running instance, call `start()` command +2ms
  MongoMS:MongoMemoryServer Called MongoMemoryServer.start() method +1ms
  MongoMS:MongoMemoryServer starting with port 44329, since undefined was locked: 44329 +15ms
  MongoMS:MongoMemoryServer Starting MongoDB instance with following options: {"port":44329,"dbName":"87b2273b-5395-4ce7-96e9-2e308dda8490","ip":"127.0.0.1","storageEngine":"ephemeralForTest","dbPath":"/tmp/mongo-mem--6748-z6u2mT0Nh6K5","tmpDir":{"name":"/tmp/mongo-mem--6748-z6u2mT0Nh6K5"},"uri":"mongodb://127.0.0.1:44329/87b2273b-5395-4ce7-96e9-2e308dda8490?"} +6ms
  MongoMS:MongoBinary MongoBinary options: {
  "downloadDir": "/home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries",
  "platform": "linux",
  "arch": "arm64",
  "version": "4.0.14",
  "checkMD5": false
} +0ms
  MongoMS:MongoBinary MongoBinary: Download lock removed +17ms
  MongoMS:MongoBinary MongoBinary: Mongod binary path: "/home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod" +0ms
  MongoMS:MongoInstance Mongo[44329]: Called MongoInstance._launchKiller(parent: 6748, child: 6759): +0ms
  MongoMS:MongoInstance Mongo[44329]: STDERR: /home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod: /lib/aarch64-linux-gnu/libcrypto.so.1.0.0: version `OPENSSL_1.0.0' not found (required by /home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod)
  MongoMS:MongoInstance /home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod: /lib/aarch64-linux-gnu/libcurl.so.4: version `CURL_OPENSSL_3' not found (required by /home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod)
  MongoMS:MongoInstance /home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod: /lib/aarch64-linux-gnu/libssl.so.1.0.0: version `OPENSSL_1.0.0' not found (required by /home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod)
  MongoMS:MongoInstance /home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod: /lib/aarch64-linux-gnu/libssl.so.1.0.0: version `OPENSSL_1.0.1' not found (required by /home/ubuntu/Projects/Web/CowinTracker/server/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod)
  MongoMS:MongoInstance  +38ms
  MongoMS:MongoInstance Mongo[44329]: Mongod instance closed with an non-0 code! +6ms
  MongoMS:MongoInstance Mongo[44329]: CLOSE: 1 +1ms
  MongoMS:MongoInstance Mongo[44329]: MongodbInstance: Instance has failed: Mongod instance closed with code "1" +0ms
(node:6748) UnhandledPromiseRejectionWarning: Mongod instance closed with code "1"
(Use `node --trace-warnings ...` to show where the warning was created)
(node:6748) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:6748) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  MongoMS:MongoInstance Mongo[44329]: [MongoKiller]: exit - [null,"SIGTERM"] +14ms

how can I overcome these errors ?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:28

github_iconTop GitHub Comments

5reactions
me-nkrcommented, Jun 14, 2021

version 4.2.14 works fine, in the sense a instance starts and I can getUri and instanceInfo, so thanks for the support. I hope pointing this issue helped. Looking forward to contributing more

  • Regards me-nkr
0reactions
hasezoeycommented, Jun 14, 2021

you will need to try an higher version than 4.0 / 4.1, so try (like said earlier in the issue) 4.2.14 or 4.4.5

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mongo Memory Server is not starting at all - Stack Overflow
The code below will create an new instance of "MongoMemoryServer" and automatically start it. const { MongoMemoryServer } = require("mongodb- ...
Read more >
Problem with mongo memory server - Ask Fedora
Hello i am new in fedora 35, i am using mongodb and jest for testing. And i have an error that i cant...
Read more >
Single MongoDB instance crashes with reportOutOfMemoryError
Hi all, I am running a single instance of MongoDB 5.0.5 on a Virtual Machine running CentOS7 with 8Gb of RAM available.
Read more >
Developers - throw custom error on "lib*" missing - - Bountysource
Versions. NodeJS: v12.18.3; mongodb-memory-server-*: 6.9.2; mongodb: 3.2. · What is the Problem? Running jest failed throwing: mongod instance closed with code ...
Read more >
mongodb-memory-server - npm
Start using mongodb-memory-server in your project by running `npm i mongodb-memory-server`. There are 174 other projects in the npm registry ...
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