Description
Versions
- NodeJS: 16.20.2
- mongodb-memory-server-*: 9.0.1
- mongodb(the binary version): 6.0.10
- mongodb(the js package): 5.9.0
- system: MacOS 14.1
package: mongo-memory-server
What is the Problem?
When I'm trun to run test using "[email protected]" in concurrency mode I have an error that port already in use. No always, but pretty often
Starting the MongoMemoryServer Instance failed, enable debug log for more information. Error:
StdoutInstanceError: Port "15490" already in use
Want to notice that there is no error on v8.16.0
Code Example
globalThis.__MONGO_DB__ = await MongoMemoryServer.create();
Debug Output
stderr | unknown test
Starting the MongoMemoryServer Instance failed, enable debug log for more information. Error:
StdoutInstanceError: Port "52929" already in use
at MongoInstance.checkErrorInLine (/.../node_modules/.pnpm/[email protected]/node_modules/mongodb-memory-server-core/src/util/MongoInstance.ts:641:9)
at MongoInstance.stdoutHandler (/.../node_modules/.pnpm/[email protected]/node_modules/mongodb-memory-server-core/src/util/MongoInstance.ts:615:10)
at Socket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
Do you know why it happenes?
Looks like there is a race condition after replacing "get-port" to own implementation