0
這個錯誤發生在我的web服務連續運行8到10個小時後,連續運行永久模塊。我的nodejs web服務正在關閉,出現這些錯誤
{
"date": "Wed Sep 13 2017 21:22:25 GMT+0000 (UTC)",
"process": {
"pid": 24337,
"uid": 1000,
"gid": 1000,
"cwd": "/path/to/my/file/",
"execPath": "/path/to/my/nvm/.nvm/versions/node/v4.4.5/bin/node",
"version": "v4.4.5",
"argv": ["/path/to/my/nvm/.nvm/versions/node/v4.4.5/bin/node", "/path/to/my/file/app.js"],
"memoryUsage": {
"rss": 133083136,
"heapTotal": 83753568,
"heapUsed": 71120576
}
},
"os": {
"loadavg": [0.0029296875, 0.0146484375, 0.04541015625],
"uptime": 397147
},
"trace": [{
"column": 13,
"file": "/path/to/my/file/node_modules/mysql/lib/protocol/Protocol.js",
"function": "Protocol.end",
"line": 109,
"method": "end",
"native": false
}, {
"column": 28,
"file": "/path/to/my/file/node_modules/mysql/lib/Connection.js",
"function": "",
"line": 102,
"method": null,
"native": false
}, {
"column": 20,
"file": "events.js",
"function": "emitNone",
"line": 72,
"method": null,
"native": false
}, {
"column": 7,
"file": "events.js",
"function": "Socket.emit",
"line": 166,
"method": "emit",
"native": false
}, {
"column": 12,
"file": "_stream_readable.js",
"function": "endReadableNT",
"line": 913,
"method": null,
"native": false
}, {
"column": 9,
"file": "node.js",
"function": "nextTickCallbackWith2Args",
"line": 442,
"method": null,
"native": false
}, {
"column": 17,
"file": "node.js",
"function": "process._tickDomainCallback",
"line": 397,
"method": "_tickDomainCallback",
"native": false
}],
"stack": ["Error: Connection lost: The server closed the connection.", " at Protocol.end (/path/to/my/file/node_modules/mysql/lib/protocol/Protocol.js:109:13)", " at Socket.<anonymous> (/path/to/my/file/node_modules/mysql/lib/Connection.js:102:28)", " at emitNone (events.js:72:20)", " at Socket.emit (events.js:166:7)", " at endReadableNT (_stream_readable.js:913:12)", " at nextTickCallbackWith2Args (node.js:442:9)", " at process._tickDomainCallback (node.js:397:17)"],
"level": "error",
"message": "uncaughtException: Connection lost: The server closed the connection.",
"timestamp": "2017-09-13T21:22:25.271Z"
}
無法找出爲什麼會發生這種情況?我也檢查了我的數據庫是否閒置,但我的數據庫是完美的,它不會閒置。那麼還有什麼會殺死我的節點進程?我已經做了幾個研究,哪些是殺死我的API我不知道。然後我開始通過api記錄請求,然後我發現了這個錯誤信息,並且只有在連續處理幾個小時後纔會出現。
我得到上下面的這個錯誤的第二一個 {[錯誤:ER_CON_COUNT_ERROR:連接太多] 代碼: 'ER_CON_COUNT_ERROR', 錯誤號:1040, SQLSTATE:未定義, 致命:真} – Jagadeesh