Node.js and MySQL "Too many connections" error -


i'm using node.js run web-server web application. i'm using node-mysql module interface mysql server persistent database needs.

whenever there critical error within node.js application crashes app's process email sent me. so, keep getting email error saying "too many connections". here's example of error:

error: many connections     @ function.client._packettouserobject (/apps/x/node_modules/mysql/lib/client.js:394:11)     @ client._handlepacket (/apps/x/node_modules/mysql/lib/client.js:307:43)     @ parser.eventemitter.emit (events.js:96:17)     @ parser.write.emitpacket (/apps/x/node_modules/mysql/lib/parser.js:71:14)     @ parser.write (/apps/x/node_modules/mysql/lib/parser.js:576:7)     @ socket.eventemitter.emit (events.js:96:17)     @ tcp.onread (net.js:396:14) 

as can see tells me error coming mysql module, doesn't tell me in application code issue occurring.

my application opens db connection anytime need run 1 or more queries. close connection after queries , data has been collected. so, don't understand how exceeding 151 max_connections limit.

unless there place in code forgot call db.end() close connection, don't see how app leak this. if there such mistake, wouldn't these emails sent dozens. yesterday, received 100 emails same error. how happening? if application had leaked , allocated connections on time, first error occurred app process crash , connections lost, preventing app crash again. since received ~100 emails, means app crashed ~100 times, , within short period of time. mean somewhere in application lot of connections established in short period of time, right?

how avoid problem? discouraging. highly appreciated. thanks

mysql has default max_connections = '100' not 151 unless changed it. also, in truth have max_connections + 1. plus 1 allows root user logon after have maxed out conenctions in order figure out being used. when connections maxed out try logging on root , running following command mysql.

mysql> show full processlist 

post output of command above. once know consuming resources can go fixing it.it code leaving open connections.

you should take @ follwoing documentation: show processlist


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -