Possible EventEmitter memory leak detected



  • Hi,
    Where should I increase the limit. I am sending 11 requests to create reports at a time.

    Thanks,
    Rashmi

    2018-09-17T20:37:40.199Z - debug: Compiled template not found in the cache, compiling
    (node:462572) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGINT listeners added. Use emitter.setMaxListeners() to increase limit
    (node:462572) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGTERM listeners added. Use emitter.setMaxListeners() to increase limit
    (node:462572) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGHUP listeners added. Use emitter.setMaxListeners() to increase limit
    

  • administrators

    hi! probably you are using one instance of jsreport per request (maybe a bug in your code), which is not the normal way to do it, you should create one instance and reuse it for all requests



  • Hello bjrmatos, I am using the API.

     request.post({
                headers: {'Content-Type': 'application/json'},
                url: `${jsReportUrl}/api/report`,
                body: JSON.stringify(dataObj)
            }).on('error', (err) => {return resolve(false);}) 
            .pipe(ws);
    

    on tracing, I found that puppeteer helper is throwing the warning.

    node:150756) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 exit listeners added. Use emitter.setMaxListeners() to increase limit
        at _addListener (events.js:280:19)
        at process.addListener (events.js:297:10)
        at Function.addEventListener (C:\ifolder\iroot\bidPck\node_modules\puppeteer\lib\helper.js:189:13)
        at Function.launch (C:\ifolder\iroot\bidPck\node_modules\puppeteer\lib\Launcher.js:139:32)
    
    

  • administrators

    hi!

    in the current state of chrome-pdf there is no way to fix that or to suppress the warning, you will see that warning always when you have like 12 concurrent requests. the details of why this happen are here. the TL;DR is that the chrome API package (puppeteer) listens to process.exit event for each instance created and since right now chrome-pdf starts a new instance per render request then you will see this message when you have like 12 concurrent render requests (12 chrome instances opened). don't worry too much about this message because it is just a warning and it happens when you are processing lot of requests.

    we are currently working in re-using chrome instances for the render requests so in future probably you won't see this message anymore.



  • Thank you bjrmatos. Yes, I am executing 15-17 concurrent render requests.

    Your quick response is much appreciated,
    Rashmi


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.