Wednesday, August 8, 2018

Error: Handshake inactivity timeout in Node.js MYSQL module

Leave a Comment

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 }   

1 Answers

Answers 1

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,     aquireTimeout   : 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 Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment