db-migrate / db-migrate/node-db-migrate
EventEmitter memory leaks
- Dominant language
- JavaScript
- Stars
- 2.3k
- Forks
- 361
- PR merge metrics
- No merged PRs in 30d
Description
When using `db-migrate` programmatically for multiple databases, warnings are generated for EventEmitter leaks: `Warning: Possible EventEmitter memory leak detected. 11 unhandledRejection listeners added.`
Adding a `unregisterEvents` function to `api.js` should enable programmatic users to get around this. Such a function may also be used more generally to do proper cleanup.
Where `registerEvent()` is called:
https://github.com/db-migrate/node-db-migrate/blob/master/api.js#L136-L147
Where `registerEvents()` is defined:
https://github.com/db-migrate/node-db-migrate/blob/master/api.js#L136-L147
##
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/38131674-eventemitter-memory-leaks?utm_campaign=plugin&utm_content=tracker%2F73887&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F73887&utm_medium=issues&utm_source=github).
Contributor guide
Research direction
Start in api.js at the linked registerEvent() and registerEvents() code, then reproduce programmatic use across multiple databases to observe the unhandledRejection listener warnings. Define unregisterEvents() cleanup there and verify that repeated use no longer accumulates listeners or emits leak warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100