question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Possible EventEmitter memory leak detected

See original GitHub issue

I have a problem when I create multiple images. My application has a timeline, and I convert comments into pictures. When there are several conversions in the tile, then there is a memory leak, and when there are more than 50 of them, the application generally hangs.

error: (node:124106) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 exit listeners added to [process]. Use emitter.setMaxListeners() to increase limit at _addListener (events.js:390:17) at process.addListener [as on] (events.js:406:10) at Function.addEventListener (/home/WebstormProjects/works/doc-exporter/node_modules/puppeteer/lib/helper.js:123:17) at BrowserRunner.start (/home/WebstormProjects/works/doc-exporter/node_modules/puppeteer/lib/Launcher.js:93:35) at ChromeLauncher.launch (/home/WebstormProjects/works/doc-exporter/node_modules/puppeteer/lib/Launcher.js:205:16)

const docx = require("docx");
const {Paragraph, Media} = docx;
const docHelperFormat = require('../docHelperFormat');
const nodeHtmlToImage = require('node-html-to-image');
const sizeOf = require('image-size');

async function init(item, doc) {
    const arr = [];
    var eventText = '';
    arr.push(
        docHelperFormat.createRoleText('')
    )

    if (!item.parent) {

        eventText = `${item.author.fio} оставил(а) комментарий`;

    } else {

        eventText = `${item.author.fio} процитировал(а) комментарий`;

    }

    const puppeteerArgs = { args: [ '--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage', '--disable-accelerated-2d-canvas', '--no-first-run', '--headless', '--no-zygote', '--disable-gpu' ], headless: true, ignoreHTTPSErrors: true };

    arr.push(docHelperFormat.createEventHeader(docHelperFormat.formattedDateFromTS(item.createdAt) + ' ' + eventText));

   const Image = await nodeHtmlToImage({
        html: item.content,
        puppeteerArgs // puppeteerArgs: { args: [ '--no-sandbox', '--disable-setuid-sandbox' ] },
    });

    let dimensions = sizeOf(Image);

    arr.push(
        new Paragraph(
            // docHelperFormat.createRoleText('')
            Media.addImage(doc, Image, dimensions.width, dimensions.height)
        )
    )

    return arr;

}


module.exports = {
    init
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
XIIIcoolcommented, Feb 8, 2021

resolved problem, changed {{to {{{, thanks a lot for great support

1reaction
XIIIcoolcommented, Feb 8, 2021

node v14.15.1 os ubuntu 20.04 Thank you for your prompt reply. Okay, I’ll try to make pictures with one method.

Read more comments on GitHub >

github_iconTop Results From Across the Web

possible EventEmitter memory leak detected - node.js
I found this page because I got this warning and in my case there was a bug in some code I was using...
Read more >
How to fix possible EventEmitter memory leak detected
The warning possible EventEmitter memory leak detected happens when you have more than 10 listeners (read EventEmitter) attached to an event ...
Read more >
Possible EventEmitter memory leak detected. 11 error ...
Describe the bug When using simple cache adapters MaxListenersExceededWarning is emitted. This has previously been investigated in #792 and #1128 but either ...
Read more >
Node.js sends warnings when you add too many listeners ...
This warning helps you to prevent memory leaks. Node.js processes can run for ages and when you have a bug in your code...
Read more >
Possible EventEmitter memory leak detected. 11 scanStop ...
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 scanStop listeners added. Use emitter.setMaxListeners() to increase limit #22.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found