It seems that sometime the connection to MYSQL not closed succeed. I am using nodejs and node-mysql library.
client = mysql.createClient({ user: 'root', password: 'pass' });
client.query('USE db');
client.query( 'SELECT a FROM b ORDER BY c ASC', function selectCb(err, results, fields) {
client.end();
if (err) throw err;
....
});
Hope that helps!
client.end(function(err) {
// do what you want after the connection if closed :)
});
Also you can check this link : https://github.com/felixge/node-mysql#pooling-connections`