MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 job ttl exceeded listeners added. Use emitter.setMaxListeners() to increase limit
See original GitHub issueI’m getting (node:38) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 job ttl exceeded listeners added. Use emitter.setMaxListeners() to increase limit
my Kue implementation:
const kue = require('kue')
const $raven = require('./Raven')
const $jobs = require('../config/jobs')
const queue = kue.createQueue({
// supress job level events
jobEvents: false,
// config redis connection
redis: {
host: process.env.REDIS_HOST || '127.0.0.1',
port: process.env.REDIS_PORT || 6379
}
})
queue.on('error', function (err) {
console.log('Kue error \n', err)
$raven.captureException(err)
})
// register jobs
Object.keys($jobs).forEach(name => {
queue.process(name, $jobs[name])
})
module.exports = queue
a job declaration example
'supplier-notify-created': async function (job, done) {
try {
console.log('notifying supplier was created...')
let { message } = job.data
await $axios({
method: 'POST',
url: $api.crmSupplierWebhook(),
data: {
message
}
})
console.log('successfully notified supplier was created')
done()
} catch (err) {
console.log('error notifying supplier created', err)
$raven.captureException(err)
done(err)
}
}
job registration
const supplierNotifyUpdated = function (req, res) {
let { message, user, supplierUuid } = req.body
if (!message || !user || !supplierUuid) {
throw new BadRequestError('Missing Parameters')
}
$kue.create('supplier-notify-updated', { message, user, supplierUuid })
.priority('critical')
.attempts(3)
.removeOnComplete(true)
.save()
console.log('created supplier update notification job')
res.json('ok')
}
whole project here: https://github.com/AddToEvent/JobProcessor
Kue version: 0.11.6
I’m using docker images to launch my app
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
Possible EventEmitter memory leak detected. 11 message lis ...
11 message lis teners added. Use emitter.setMaxListeners() to increase limit. My codebase is huge and I facing this error sometimes I don't know ......
Read more >Node.js sends warnings when you add too many listeners to ...
11 event listeners added. Use emitter.setMaxListeners() to increase limit. Interesting, Node.js sends a warning to stderr when you add more ...
Read more >Understanding memory leaks in node.js part 2 - alxolr
(node:10031) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. Eleven event listeners added. Use emitter.setMaxListeners() to ...
Read more >Possible EventEmitter memory leak detected. 11 done ...
(node:89210) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 done listeners added. Use emitter.setMaxListeners() ...
Read more >OptimalBits/bull - Gitter
"(node:7608) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 21 error listeners added to [Redis]. Use emitter.setMaxListeners() to ...
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 FreeTop 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
Top GitHub Comments
Instead of blindly setting Max Listeners to 1000, you can do :
whenever you add a processor to the queue.
If you are using Concurrency, Just add the concurrency value you are using instead of 1.
In your case, you can just do:
before the loop.