MaxListenersExceededWarning caused by Sandbox.js
Created by: zlafil
Bull version: 3.5.2
It seems that sandbox.js never removes the listener for the exit event. This causes the MaxListenersExceededWarning to be shown in Node.
https://github.com/OptimalBits/bull/blob/develop/lib/process/sandbox.js#L36
Example in TypeScript
const queue = new Bull("Queue", { redis: { port: Config.config.redisPort, host: Config.config.redisHost } });
queue.process(1, "pathToWorker.js");
for (let i = 0; i < 12; i++) {
queue.add("");
}
Adding
child.removeListener('exit');
before this line https://github.com/OptimalBits/bull/blob/develop/lib/process/sandbox.js#L41 seems to solve the problem