Possible EventEmitter memory leak detected
See original GitHub issueI 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:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
resolved problem, changed {{to {{{, thanks a lot for great support
node v14.15.1 os ubuntu 20.04 Thank you for your prompt reply. Okay, I’ll try to make pictures with one method.