title: NodeJS memory leak
body: <p>I'm making a game with <code>socket.io</code> and <code>mysql</code>, and at every client connect, I check if the user is banned by IP with <strong>my custom MySQL  function</strong>:</p>
  
  <pre><code>MySQL.Query('SELECT * FROM bans WHERE user = ?', username, function(rows) {
      // do something
  })
  </code></pre>
  
  <p><br> but when I connect <strong>> 5</strong> clients, I have this error on the server console:</p>
  
  <pre><code>(node) warning: possible EventEmitter memory leak detected. 11 error listeners added. Use emitter.setMaxListeners() to increase limit.
  Trace
      at PoolConnection.addListener (events.js:239:17)
      at C:\Users\user\Documents\_server\mysql\mysql.js:26:21
      at Ping.onOperationComplete [as _callback] (C:\Users\user\node_modules\mysql\lib\Pool.js:99:5)
      at Ping.Sequence.end (C:\Users\user\node_modules\mysql\lib\protocol\sequences\Sequence.js:96:24)
      at Ping.Sequence.OkPacket (C:\Users\user\node_modules\mysql\lib\protocol\sequences\Sequence.js:105:8)
      at Protocol._parsePacket (C:\Users\user\node_modules\mysql\lib\protocol\Protocol.js:280:23)
      at Parser.write (C:\Users\user\node_modules\mysql\lib\protocol\Parser.js:73:12)
      at Protocol.write (C:\Users\user\node_modules\mysql\lib\protocol\Protocol.js:39:16)
      at Socket.&lt;anonymous&gt; (C:\Users\user\node_modules\mysql\lib\Connection.js:96:28)
      at emitOne (events.js:77:13)
  </code></pre>
  
  <p><strong>Here's mysql.js file</strong> :</p>
  
  <pre><code>var config = require('../config.js');
  var mysql = require('mysql');
  var pool = mysql.createPool({
      connectionLimit : 100,
      host     : config.sqlhost,
      user     : config.sqluser,
      password : config.sqlpass,
      database : config.sqlbase,
      debug    :  false
  });
  var MySQL = {
      Query: function(req, reqvars, callback) {
          pool.getConnection(function(err,connection){
              if (err) {
                connection.release();
                console.log('[MySQL] Error while connecting to the database');
              }   
              connection.query(req, reqvars, function(err,rows){
                  connection.release();
                  if (typeof callback == 'function') callback(rows);
              });
              connection.on('error', function(err) {      
                  console.log('[MySQL] Error while attempting query');   
              });
          });
      }, 
  }
  module.exports = MySQL;
  </code></pre>
  
  <p><em>Where's the problem?</em></p>