{"action":"created","issue":{"url":"https://api.github.com/repos/felixge/node-mysql/issues/1113","labels_url":"https://api.github.com/repos/felixge/node-mysql/issues/1113/labels{/name}","comments_url":"https://api.github.com/repos/felixge/node-mysql/issues/1113/comments","events_url":"https://api.github.com/repos/felixge/node-mysql/issues/1113/events","html_url":"https://github.com/felixge/node-mysql/issues/1113","id":82861224,"number":1113,"title":"Possible Memory Leak when Load Testing Node mysql pool connections.","user":{"login":"venkatsep14","id":799677,"avatar_url":"https://avatars.githubusercontent.com/u/799677?v=3","gravatar_id":"","url":"https://api.github.com/users/venkatsep14","html_url":"https://github.com/venkatsep14","followers_url":"https://api.github.com/users/venkatsep14/followers","following_url":"https://api.github.com/users/venkatsep14/following{/other_user}","gists_url":"https://api.github.com/users/venkatsep14/gists{/gist_id}","starred_url":"https://api.github.com/users/venkatsep14/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/venkatsep14/subscriptions","organizations_url":"https://api.github.com/users/venkatsep14/orgs","repos_url":"https://api.github.com/users/venkatsep14/repos","events_url":"https://api.github.com/users/venkatsep14/events{/privacy}","received_events_url":"https://api.github.com/users/venkatsep14/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/felixge/node-mysql/labels/question","name":"question","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-05-30T16:59:29Z","updated_at":"2015-05-30T17:12:40Z","closed_at":null,"body":"Please find the below error stack and if you would like to send me the code I am testing I can and we are trying to do the load testing and that is when we are running into this only for some connections.\r\n```\r\n(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.\r\nTrace\r\n    at PoolConnection.addListener (events.js:160:15)\r\n    at /Users/venkat/dev/git/nodemysqlpooltest/pool.js:63:20\r\n    at Ping.onPing [as _callback] (/Users/venkat/dev/git/nodemysqlpooltest/node_modules/mysql/lib/Pool.js:94:5)\r\n    at Ping.Sequence.end (/Users/venkat/dev/git/nodemysqlpooltest/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24)\r\n    at Ping.Sequence.OkPacket (/Users/venkat/dev/git/nodemysqlpooltest/node_modules/mysql/lib/protocol/sequences/Sequence.js:105:8)\r\n    at Protocol._parsePacket (/Users/venkat/dev/git/nodemysqlpooltest/node_modules/mysql/lib/protocol/Protocol.js:271:23)\r\n    at Parser.write (/Users/venkat/dev/git/nodemysqlpooltest/node_modules/mysql/lib/protocol/Parser.js:77:12)\r\n    at Protocol.write (/Users/venkat/dev/git/nodemysqlpooltest/node_modules/mysql/lib/protocol/Protocol.js:39:16)\r\n    at Socket.<anonymous> (/Users/venkat/dev/git/nodemysqlpooltest/node_modules/mysql/lib/Connection.js:82:28)\r\n    at Socket.emit (events.js:95:17)\r\n```"},"comment":{"url":"https://api.github.com/repos/felixge/node-mysql/issues/comments/107067151","html_url":"https://github.com/felixge/node-mysql/issues/1113#issuecomment-107067151","issue_url":"https://api.github.com/repos/felixge/node-mysql/issues/1113","id":107067151,"user":{"login":"venkatsep14","id":799677,"avatar_url":"https://avatars.githubusercontent.com/u/799677?v=3","gravatar_id":"","url":"https://api.github.com/users/venkatsep14","html_url":"https://github.com/venkatsep14","followers_url":"https://api.github.com/users/venkatsep14/followers","following_url":"https://api.github.com/users/venkatsep14/following{/other_user}","gists_url":"https://api.github.com/users/venkatsep14/gists{/gist_id}","starred_url":"https://api.github.com/users/venkatsep14/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/venkatsep14/subscriptions","organizations_url":"https://api.github.com/users/venkatsep14/orgs","repos_url":"https://api.github.com/users/venkatsep14/repos","events_url":"https://api.github.com/users/venkatsep14/events{/privacy}","received_events_url":"https://api.github.com/users/venkatsep14/received_events","type":"User","site_admin":false},"created_at":"2015-05-30T17:12:40Z","updated_at":"2015-05-30T17:12:40Z","body":"May be you are right it might be the same issue as 979 where I am trying to have a listener inside the pool.getConnection.\r\n\r\nconnection.on('error', function(err) {\r\n            res.json({\r\n                \"code\": 100,\r\n                \"status\": \"Error in connection database\"\r\n            });\r\n            return;\r\n        });\r\n\r\n`var app = express();\r\n\r\nvar pool = mysql.createPool({\r\n    acquireTimeout:50000,\r\n    connectionLimit: 800, //important\r\n    host: '',\r\n    user: 'root',\r\n    password: '',\r\n    database: '',\r\n    debug: false\r\n});\r\n\r\nfunction handle_database(req, res) {\r\n\r\n    pool.getConnection(function(err, connection) {\r\n        if (err) {\r\n            connection.release();\r\n            res.json({\r\n                \"code\": 100,\r\n                \"status\": \"Error in connection database\"\r\n            });\r\n            return;\r\n        }\r\n\r\n        console.log('connected as id ' + connection.threadId);\r\n\r\n        connection.query(\"select * from user_tbl LIMIT 2\", function(err, rows) {\r\n            connection.release();\r\n            if (!err) {\r\n                res.json(rows);\r\n            }\r\n        });\r\n\r\n        connection.on('error', function(err) {\r\n            res.json({\r\n                \"code\": 100,\r\n                \"status\": \"Error in connection database\"\r\n            });\r\n            return;\r\n        });\r\n    });\r\n}\r\n\r\napp.get(\"/\", function(req, res) {\r\n    -\r\n    handle_database(req, res);\r\n});\r\n\r\napp.listen(10000);`"}}