mysql icon indicating copy to clipboard operation
mysql copied to clipboard

Connection Lost on amazon ec2

Open waqas1991 opened this issue 12 years ago • 7 comments

For the last few months I am facing an issue, I deployed my application on amazon ec2 server but at least 10 to 30 times a day I get this error.

 1) Error: connect ETIMEDOUT
    at errnoException (net.js:904:11)
    at Object.afterConnect [as oncomplete] (net.js:895:19)

  2) Error: getaddrinfo ENOTFOUND
     at errnoException (dns.js:37:11)
     at Object.onanswer [as oncomplete] (dns.js:124:16)
     --------------------
    at Handshake.Sequence                                            (/var/app/current/node_modules/mysql/lib/protocol/sequences/Sequence.js:15:20)
at new Handshake (/var/app/current/node_modules/mysql/lib/protocol/sequences/Handshake.js:9:12)
at Protocol.handshake (/var/app/current/node_modules/mysql/lib/protocol/Protocol.js:42:50)
at Connection.connect (/var/app/current/node_modules/mysql/lib/Connection.js:72:18)
at module.exports.connect (/var/app/current/node_modules/sequelize/lib/dialects/mysql/connector-manager.js:276:16)
at Object.pool.Pooling.Pool.create (/var/app/current/node_modules/sequelize/lib/dialects/mysql/connector-manager.js:125:19)
at createResource (/var/app/current/node_modules/sequelize/node_modules/generic-pool/lib/generic-pool.js:258:13)
at dispense (/var/app/current/node_modules/sequelize/node_modules/generic-pool/lib/generic-pool.js:250:9)
at Object.me.acquire (/var/app/current/node_modules/sequelize/node_modules/generic-pool/lib/generic-pool.js:316:5)
at module.exports.enqueue (/var/app/current/node_modules/sequelize/lib/dialects/mysql/connector-manager.js:320:19)

    3) TypeError: Uncaught, unspecified "error" event.
at TypeError (<anonymous>)
at EventEmitter.emit (events.js:74:15)
at Handshake._callback (/var/app/current/node_modules/sequelize/lib/dialects/mysql/connector-manager.js:286:19)
at Handshake.Sequence.end (/var/app/current/node_modules/mysql/lib/protocol/sequences/Sequence.js:75:24)
at Protocol.handleNetworkError (/var/app/current/node_modules/mysql/lib/protocol/Protocol.js:238:14)
at Connection._handleNetworkError (/var/app/current/node_modules/mysql/lib/Connection.js:155:18)
at Socket.EventEmitter.emit (events.js:117:20)
at net.js:830:16
at process._tickDomainCallback (node.js:459:13)

Any Idea how to fix this ?

waqas1991 avatar Oct 03 '14 04:10 waqas1991

Hi! What version of this module are you using? Also, are you using createPool or createConnection directly when you are making the connections?

dougwilson avatar Oct 03 '14 14:10 dougwilson

mysql version is 2.0.0 and I am using createConnection.

waqas1991 avatar Oct 04 '14 04:10 waqas1991

Any Idea how to fix this ?

Please use createPool or at least re-implement the reconnecting and error handling it does in your own code.

dougwilson avatar Oct 04 '14 04:10 dougwilson

Also, you should really upgrade to a version much higher than 2.0.0. I recommend you always use the latest version before filing issues, as the issue may be fixed. Please try installing 2.5.1 and switching to use createPool.

dougwilson avatar Oct 04 '14 04:10 dougwilson

Thanks dougwilson I got It. What If am using sequelize ? Should I apply same criteria via sequelize to solve this issue ?

waqas1991 avatar Oct 04 '14 05:10 waqas1991

What If am using sequelize ?

Unfortunately I have no idea about anything regarding sequelize. You may want to ask the sequelize developers if you have questions with sequelize.

dougwilson avatar Oct 04 '14 05:10 dougwilson

Thanks dougwilson :)

waqas1991 avatar Oct 04 '14 05:10 waqas1991