Skip to content
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

mongodb-runner doesn't kill all instances #483

Open
mtrezza opened this issue Oct 22, 2024 · 1 comment
Open

mongodb-runner doesn't kill all instances #483

mtrezza opened this issue Oct 22, 2024 · 1 comment

Comments

@mtrezza
Copy link

mtrezza commented Oct 22, 2024

Bug Report

Current Behavior

When running mongodb-runner stop --all, the following error is thrown and the MongoDB instance is not stopped:

/node_modules/mongodb-runner/dist/cli.js:170
        throw err;
        ^

Error: kill ESRCH
    at process.kill (node:internal/process/per_thread:233:13)
    at MongoServer.close (/node_modules/mongodb-runner/dist/mongoserver.js:201:21)
    at /node_modules/mongodb-runner/dist/mongocluster.js:162:88
    at Array.map (<anonymous>)
    at MongoCluster.close (/node_modules/mongodb-runner/dist/mongocluster.js:162:61)
    at /node_modules/mongodb-runner/dist/runner-helpers.js:87:75
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 2)
    at async Object.stop (/node_modules/mongodb-runner/dist/runner-helpers.js:86:5)
    at async stop (/node_modules/mongodb-runner/dist/cli.js:121:9) {
  errno: -3,
  code: 'ESRCH',
  syscall: 'kill'
}

Node.js v18.18.2

Code/Gist

Expected Behavior/Code

MongoDB instance should be stopped, no error thrown.

Environment

  • node.js / npm versions: 18.18.2
  • OS: macos 14.5 (23F79)
@Moumouls
Copy link

Moumouls commented Oct 26, 2024

It seems that there is an issue with mongo stop all

here a server created

> mongodb-runner start -t standalone

Server started and running at mongodb://127.0.0.1:54879/
Run the following command to stop the instance:
mongodb-runner stop --id=1ef1f912-597f-4e2e-9f2c-c63d4ed99801

Then an error on mongo stop all

> mongodb-runner stop --all

/Users/antoinecormouls/Desktop/Repos/parse/parse-server/node_modules/mongodb-runner/dist/cli.js:170
        throw err;
        ^

MongoServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
    at Topology.selectServer (/Users/antoinecormouls/Desktop/Repos/parse/parse-server/node_modules/mongodb/lib/sdam/topology.js:303:38)
    at async Topology._connect (/Users/antoinecormouls/Desktop/Repos/parse/parse-server/node_modules/mongodb/lib/sdam/topology.js:196:28)
    at async Topology.connect (/Users/antoinecormouls/Desktop/Repos/parse/parse-server/node_modules/mongodb/lib/sdam/topology.js:158:13)
    at async topologyConnect (/Users/antoinecormouls/Desktop/Repos/parse/parse-server/node_modules/mongodb/lib/mongo_client.js:223:17)
    at async MongoClient._connect (/Users/antoinecormouls/Desktop/Repos/parse/parse-server/node_modules/mongodb/lib/mongo_client.js:236:13)
    at async MongoClient.connect (/Users/antoinecormouls/Desktop/Repos/parse/parse-server/node_modules/mongodb/lib/mongo_client.js:161:13)
    at async MongoClient.connect (/Users/antoinecormouls/Desktop/Repos/parse/parse-server/node_modules/mongodb/lib/mongo_client.js:322:16)
    at async MongoServer.withClient (/Users/antoinecormouls/Desktop/Repos/parse/parse-server/node_modules/mongodb-runner/dist/mongoserver.js:221:24)

The stop system seems to try to connect to a 27017 port but there is no instances on this port


Edit

I found that Mongo instances are referenced or stored globally, such as under: /Users/antoinecormouls/.mongodb/runner2. There are some ghost references, causing the system to try to connect to and close already-closed runners.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants