title: Application does not terminate with MySQL pool
body: <p>I am writing a nodejs application and want to use connection pooling. </p>
  
  <p>However, the following application does not terminate - although I would expect it to terminate after the call to <code>connection.end()</code> </p>
  
  <p>Application works just fine, if I use one connection instead of the pool. Do I need to terminate the pool in some way?</p>
  
  <p><strong>Library used</strong>: <a href="https://github.com/felixge/node-mysql" rel="nofollow">https://github.com/felixge/node-mysql</a><br>
  <strong>node.js version</strong>: 0.10.4 on Ubuntu </p>
  
  <pre><code>var mysql      = require('mysql');
  var pool = mysql.createPool({
      host     : 'example.org',
      user     : 'myuser',
      password : 'youbet',
      database : 'notrevealingdetails',
      insecureAuth: true
  });
  
  function getCampaignData(callback)
  {
      pool.getConnection(function(err, connection) {
          if(err) throw err;
  
          connection.query(
              'SELECT cam.id, cam.name AS campaign_name, cam.subdomain, usr.email, usr.display_name AS user_displayname ' +
              'FROM campaigns AS cam INNER JOIN users AS usr ON usr.id = cam.user_id ' +
              'WHERE cam.state=2',
              function(err, rows) {
                  callback(err, rows,connection);
                  //console.log('called end()');
          }); // callback function for connection.query
      }); // end pool.GetConnection
  }
  
  getCampaignData(function(err, rows, connection) {
      if (err) throw err;
  
  
      connection.end();
      console.log("I expect my app to terminate");
  });
  </code></pre>