node.js - ETIMEDOUT during sequelize.sync() -
so 60% of time when start server, error.
[2014-10-31t00:55:30.763z] error: main/4588 on vagrant-centos65.vagrantup.com: undefined (err.errorno=etimedout, err.code=etimedout, err.syscall=connect, err.fatal=true) error: connect etimedout @ connection._handleconnecttimeout (/vagrant/node_modules/mysql/lib/connection.js:346:13) @ socket.g (events.js:180:16) @ socket.emit (events.js:92:17) @ socket._ontimeout (net.js:326:8) @ timer.unreftimeout [as ontimeout] (timers.js:427:13) @ protocol._enqueue (/vagrant/node_modules/mysql/lib/protocol/protocol.js:135:48) @ protocol.handshake (/vagrant/node_modules/mysql/lib/protocol/protocol.js:52:41) @ connection.connect (/vagrant/node_modules/mysql/lib/connection.js:109:18) @ /vagrant/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:41:16 @ sequelizeresolver (/vagrant/node_modules/sequelize/lib/promise.js:32:12) @ new promise (/vagrant/node_modules/sequelize/node_modules/bluebird/js/main/promise.js:82:37) @ new sequelizepromise (/vagrant/node_modules/sequelize/lib/promise.js:28:17) @ connectionmanager.connect (/vagrant/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:23:10) previous event: @ new promise (/vagrant/node_modules/sequelize/node_modules/bluebird/js/main/promise.js:82:37) @ new sequelizepromise (/vagrant/node_modules/sequelize/lib/promise.js:28:17) @ connectionmanager.connect (/vagrant/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:23:10) @ connectionmanager.$connect (/vagrant/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:200:41) @ object.pool.pooling.pool.create (/vagrant/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:163:14) @ createresource (/vagrant/node_modules/sequelize/node_modules/generic-pool/lib/generic-pool.js:261:13) @ dispense (/vagrant/node_modules/sequelize/node_modules/generic-pool/lib/generic-pool.js:253:9) @ object.me.acquire (/vagrant/node_modules/sequelize/node_modules/generic-pool/lib/generic-pool.js:319:5) previous event: @ new promise (/vagrant/node_modules/sequelize/node_modules/bluebird/js/main/promise.js:82:37) @ new sequelizepromise (/vagrant/node_modules/sequelize/lib/promise.js:28:17) @ connectionmanager.getconnection (/vagrant/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:183:10) @ module.exports.sequelize.query (/vagrant/node_modules/sequelize/lib/sequelize.js:590:85) @ module.exports.queryinterface.createtable (/vagrant/node_modules/sequelize/lib/query-interface.js:151:29) @ /vagrant/node_modules/sequelize/lib/model.js:413:34 previous event: @ module.exports.model.sync (/vagrant/node_modules/sequelize/lib/model.js:408:20) @ /vagrant/node_modules/sequelize/lib/sequelize.js:730:20 perchance unhandled error: undefined @ promise._settlepromiseat (/vagrant/node_modules/sequelize/lib/promise.js:66:18) previous event: @ module.exports.sequelize.sync (/vagrant/node_modules/sequelize/lib/sequelize.js:713:22) @ object.<anonymous> (/vagrant/server.js:111:3) @ module._compile (module.js:456:26) @ object.module._extensions..js (module.js:474:10) @ module.load (module.js:356:32) @ function.module._load (module.js:312:12) @ function.module.runmain (module.js:497:10) @ startup (node.js:119:16)
the other 40% of time goes through no problem. started happening when switched os x, it's running in vagrant shouldn't matter. ideas?
edit: i've narrowed downwards problem is. i'm able reproduce error if busy wait ~10 seconds anywhere in code (even @ beginning!), e.g.
'use strict'; (var = 0; < 1e10; i+=2){} var express = require(...
so seems taking long phone call sequelize.sync() cause error. why?
this looks sequelize isn't managing connect database , timing out.
firstly create sure database running , can connect using same connection parameters vagrant box sequelize application. assuming running mysql can by:
vagrant ssh
then vagrant box
mysql -usteven -pstevenspassword -hhostameofserver.com
this @ to the lowest degree confirm application able connect db.
also if database running on same machine application seek connecting via unix socket rather on network, this:
var sequelize = new sequelize('database', 'username', 'password', { host: '127.0.0.1', port: 3306, logging: false, dialect: 'mysql', dialectoptions: { socketpath: '/var/run/mysql.sock' }, pool: { maxconnections: 5, maxidletime: 30 } });
node.js sequelize.js
No comments:
Post a Comment