Memory leak in knex v0.13.0
See original GitHub issueHi,
When importing, then destroying, then reset modules a lot of times with jest, I have some warning about memory leak MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGABRT listeners added. Use emitter.setMaxListeners() to increase limit
I think that destroy() leave listener that should be removed.
Here is the (useless) code to reproduce the issue :
//@flow
import k from 'knex';
import path from 'path';
const config = {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, './database.sqlite'),
},
pool: {
min: 1,
max: 1,
},
migrations: {
tableName: 'knex_migrations',
},
useNullAsDefault: true,
timezone: 'UTC',
};
let knex;
describe('pppppppppp', () => {
beforeEach(async () => {
jest.resetModules();
knex = k(config);
});
afterEach(async () => {
await knex.destroy();
});
test('test', () => {});
test('test', () => {});
test('test', () => {});
test('test', () => {});
test('test', () => {});
test('test', () => {});
test('test', () => {});
test('test', () => {});
test('test', () => {});
test('test', () => {});
test('test', () => {});
test('test', () => {});
test('test', () => {});
test('test', () => {});
});
Is it a bad use or a bug ? Thanks in advance.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Knex.js: JavaScript heap out of memory
I'm working on a project which uses knex.js for database migration. I tried to query the data ...
Read more >node-memwatch | Yarn - Package Manager
node-memwatch is here to help you detect and find memory leaks in Node.JS code. It provides: A leak event, emitted when it appears...
Read more >Developers - Memory leak when using transactions -
Using knex transactions in tests causes a memory leak. Likely also in production. Detectable in jest tests using their --detectLeaks ...
Read more >Debugging Memory Leaks in Node.js Applications
js application using restify and put a little source of memory leak within it. All experiments here are made with Node.js v0.12.7, which...
Read more >Understanding Memory Leaks in Nodejs | by Chidume Nnamdi
... and allocating memory without knowing it. How we manage them can make or mar our software. In our effort to understand what...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found


@fl0w nop, it does not fix the issue
From my previous tests this should be fixed by #2208, so closing this for now. If it’s still an issue in upcoming 0.14, feel free to reopen.