You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MemoryLeak due to long await in CertificateService issue method of @energyweb/origin-247-certificate package's causing, when trying to issue around 50 certificates
#3368
Open
Ahmed-Suhail opened this issue
Nov 28, 2022
· 2 comments
When using issue method of CertificateService of @energyweb/origin-247-certificate package, we are triggering this method to issue certificates in our system. This warning doesnt comes when we issue 2-5 certificates especially we try to issue more certificates like 50 we get the below warning
Warning in Console
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 global:completed listeners added to [Queue]. Use emitter.setMaxListeners() to increase limit
at _addListener (events.js:475:17)
at Queue.addListener (events.js:497:10)
at Queue.on (/var/deployment/common/temp/node_modules/.pnpm/[email protected]/node_modules/bull/lib/queue.js:326:14)
at /var/deployment/common/temp/node_modules/.pnpm/[email protected]/node_modules/bull/lib/job.js:504:18
at new Promise ()
at Job.finished (/var/deployment/common/temp/node_modules/.pnpm/[email protected]/node_modules/bull/lib/job.js:480:12)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async CertificateService.waitForJobResult (/var/deployment/common/temp/node_modules/.pnpm/@energyweb[email protected]_a1b67e60083a0f64adab87445ef00c80/node_modules/@energyweb/origin-247-certificate/dist/js/src/certificate.service.js:111:20)
at async CertificateService.issue (/var/deployment/common/temp/node_modules/.pnpm/@energyweb[email protected]_a1b67e60083a0f64adab87445ef00c80/node_modules/@energyweb/origin-247-certificate/dist/js/src/certificate.service.js:48:24)
(node:1) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 global:failed listeners added to [Queue]. Use emitter.setMaxListeners() to increase limit
Alernate Solution
We can have alternate method which doesnt awaits for the job to complete but just puts the job on queue and returns.
Due to long await waitForJobResult we are getting MemoryLeak
This is snippet in issue method of CertificateService of @energyweb/origin-247-certificate
const job = await this.blockchainActionsQueue.add({
payload: command,
type: types_1.BlockchainActionType.Issuance
}, jobOptions);
const result = await this.waitForJobResult(job);
The text was updated successfully, but these errors were encountered:
I havent tried that but we have different reservations for different devices coming up at different times and they all get queued one after another as of now our system is using issue method.
Description
When using issue method of CertificateService of @energyweb/origin-247-certificate package, we are triggering this method to issue certificates in our system. This warning doesnt comes when we issue 2-5 certificates especially we try to issue more certificates like 50 we get the below warning
Warning in Console
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 global:completed listeners added to [Queue]. Use emitter.setMaxListeners() to increase limit
at _addListener (events.js:475:17)
at Queue.addListener (events.js:497:10)
at Queue.on (/var/deployment/common/temp/node_modules/.pnpm/[email protected]/node_modules/bull/lib/queue.js:326:14)
at /var/deployment/common/temp/node_modules/.pnpm/[email protected]/node_modules/bull/lib/job.js:504:18
at new Promise ()
at Job.finished (/var/deployment/common/temp/node_modules/.pnpm/[email protected]/node_modules/bull/lib/job.js:480:12)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async CertificateService.waitForJobResult (/var/deployment/common/temp/node_modules/.pnpm/@energyweb[email protected]_a1b67e60083a0f64adab87445ef00c80/node_modules/@energyweb/origin-247-certificate/dist/js/src/certificate.service.js:111:20)
at async CertificateService.issue (/var/deployment/common/temp/node_modules/.pnpm/@energyweb[email protected]_a1b67e60083a0f64adab87445ef00c80/node_modules/@energyweb/origin-247-certificate/dist/js/src/certificate.service.js:48:24)
(node:1) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 global:failed listeners added to [Queue]. Use emitter.setMaxListeners() to increase limit
Alernate Solution
We can have alternate method which doesnt awaits for the job to complete but just puts the job on queue and returns.
Due to long await waitForJobResult we are getting MemoryLeak
This is snippet in issue method of CertificateService of @energyweb/origin-247-certificate
const job = await this.blockchainActionsQueue.add({
payload: command,
type: types_1.BlockchainActionType.Issuance
}, jobOptions);
const result = await this.waitForJobResult(job);
The text was updated successfully, but these errors were encountered: