dynamodb-local
dynamodb-local copied to clipboard
Process exit listeners are leaking
Process exit listeners aren't removed properly when the child process exits. This leads to a node warning once you start and stop the offline DynamoDB more than 10 times:
(node:9960) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 exit listeners added. Use emitter.setMaxListeners() to increase limit
The listener seems to be registered here: https://github.com/rynop/dynamodb-local/blob/355365e1d4ba6bcad0948dd57c1d0819270794f4/index.js#L84
Here's code to reproduce:
const db = require('dynamodb-local');
async function test() {
for (let i = 0; i < 11; i++) {
await db.launch(8000, null, ['-inMemory'], true);
db.stop(8000);
}
}
test();