Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_http_server / TLSSocket : MaxListenersExceededWarning #20352

Closed
radixxko opened this issue Apr 27, 2018 · 6 comments
Closed

_http_server / TLSSocket : MaxListenersExceededWarning #20352

radixxko opened this issue Apr 27, 2018 · 6 comments
Labels
cluster Issues and PRs related to the cluster subsystem. https Issues or PRs related to the https subsystem.

Comments

@radixxko
Copy link

radixxko commented Apr 27, 2018

screen

Hello after using simple https server forked into 2 child processes via node native cluster module we are getting MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added. warning

Minimal code where the issue is present:

const https = require('https'), fs = require('fs'), cluster = require('cluster');

if( cluster.isMaster )
{
    cluster.fork();
    cluster.fork();
}
else
{
    let server = https.createServer(
    {
        ca : fs.readFileSync('chain.pem'),
        cert : fs.readFileSync('server.crt'),
        key : fs.readFileSync('private.key'),
        passphrase  : 'PASS'
    },
    function( req, res ){ res.end('Hello') });

    server.listen( 7443 );
}

The issue is present in v10.0.0 node version as well it is replicable in 9.x version.

Funny thing is that we are getting MaxListenersExceededWarning every few seconds even if there are no clients connecting to server.

Any hints?

@bnoordhuis
Copy link
Member

Can you start node with --trace-warnings and post the trace?

@radixxko
Copy link
Author

Sure thing

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added. Use emitter.setMaxListeners() to increase limit
    at _addListener (events.js:244:19)
    at TLSSocket.addListener (events.js:261:10)
    at TLSSocket.Readable.on (_stream_readable.js:805:35)
    at TLSSocket.socketOnWrap [as on] (_http_server.js:700:37)
    at TLSSocket.socketOnError (_http_server.js:490:8)
    at onParserExecuteCommon (_http_server.js:507:19)
    at onParserExecute (_http_server.js:481:3)

@lpinca
Copy link
Member

lpinca commented May 1, 2018

@radixxko not sure if it's a problem but the screenshot above seems to expose a password.

@radixxko
Copy link
Author

radixxko commented May 1, 2018

Thanks for the warning @lpinca, credentials are used just for the testing purposes so no issue there

@lpinca
Copy link
Member

lpinca commented May 1, 2018

I can't reproduce, this is my test case with a self signed certificate.

const cluster = require('cluster');
const fs = require('fs');
const https = require('https');

if (cluster.isMaster) {
  cluster.fork();
  cluster.fork();
} else {
  const server = https.createServer({
    cert: fs.readFileSync('certificate.pem'),
    key: fs.readFileSync('key.pem')
  });

  server.on('request', function (req, res) {
    res.end('Hello');
  });

  server.listen(8080);
}

@bnoordhuis
Copy link
Member

Seeing there's been no reproduction, I'm going to close this out. Thanks anyway for the report.

@bnoordhuis bnoordhuis added https Issues or PRs related to the https subsystem. cluster Issues and PRs related to the cluster subsystem. labels Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cluster Issues and PRs related to the cluster subsystem. https Issues or PRs related to the https subsystem.
Projects
None yet
Development

No branches or pull requests

3 participants