错误:Node.js MYSQL模块中的握手不活动超时 [英] Error: Handshake inactivity timeout in Node.js MYSQL module
问题描述
我正在使用node-mysql
和大多数查询.在职的.一些查询不起作用.
我尝试了Node的每个版本(从0.5 ...直到(5.6.0),也尝试了(4.0)和(4.1),没有任何帮助.
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.
我试图进行身体上的改变,但没有成功.我试图将sequence
文件更改为:this._idleTimeout = -1;
,但没有帮助.
I tried to change maually, and didn't work. I tried to change the sequence
file to: this._idleTimeout = -1;
and didn't help.
我阅读了这些问题和GitHub,但没有任何帮助.
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 }
推荐答案
好的,超时来自Protocol.js文件行:162.如果您检出node-mysql,您将看到它是查询的变量超时".如果您将超时设置为远远高于默认值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
});
您还可以在Sequence.js文件(node_modules/mysql/lib/protocol/sequence/Sequence.js)中编辑超时
You can also edit the timeout in the Sequence.js file (node_modules/mysql/lib/protocol/sequence/Sequence.js)
this._timeout = 100000;
这篇关于错误:Node.js MYSQL模块中的握手不活动超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!