I'm using node-mysql
and most of the queries. Working. some queries not working.
I tried every version of Node (from 0.5...) until (5.6.0), I also tried (4.0) and (4.1), Nothing helps.
I tried to change maually, and didn't work. I tried to change the sequence
file to: this._idleTimeout = -1;
and didn't help.
I read the issues and GitHub, and nothing helped.
I can try to fix it by myself, but I need more information. Where is the timeout, why? when? what is this type of message? Where is the timeout came from?
MYSQL_ERROR { [Error: Handshake inactivity timeout]
code: 'PROTOCOL_SEQUENCE_TIMEOUT', fatal: true,
timeout: 10000 }
Ok, the timeout comes from the Protocol.js file line:162. If you checkout node-mysql you'll see that it is a variable "timeout" for queries. If you set the timeout to something a lot higher than 10000, the default, then the error should go away. An example is
pool = require('mysql').createPool({
connectionLimit : 1000,
connectTimeout : 60 * 60 * 1000,
acquireTimeout : 60 * 60 * 1000,
timeout : 60 * 60 * 1000,
host : process.env.DB_HOST,
user : process.env.DB_USERNAME,
password : process.env.DB_PASSWORD,
database : process.env.DB_DATABASE
});
You can also edit the timeout in the Sequence.js file (node_modules/mysql/lib/protocol/sequence/Sequence.js)
this._timeout = 100000;
If you are using Amazon's services, I was able to resolve this by changing the allowed IP Addresses in the security settings or by changing the open connections ports.
来源:https://stackoverflow.com/questions/35553432/error-handshake-inactivity-timeout-in-node-js-mysql-module