I am starting a Node server connecting to MySQL through the node -mysql module. However, connecting to and querying MySQL is very good, but there are no errors; however, the first query after exiting the Node server for several hours leads to an error. The error is the familiar read ECONNRESET , coming from the depths of the node-mysql module.
Stack Trace (note that the three trace entries relate to my application error report):
Error at exports.Error.utils.createClass.init (D:\home\site\wwwroot\errors.js:180:16) at new newclass (D:\home\site\wwwroot\utils.js:68:14) at Query._callback (D:\home\site\wwwroot\db.js:281:21) at Query.Sequence.end (D:\home\site\wwwroot\node_modules\mysql\lib\protocol\sequences\Sequence.js:78:24) at Protocol.handleNetworkError (D:\home\site\wwwroot\node_modules\mysql\lib\protocol\Protocol.js:271:14) at PoolConnection.Connection._handleNetworkError (D:\home\site\wwwroot\node_modules\mysql\lib\Connection.js:269:18) at Socket.EventEmitter.emit (events.js:95:17) at net.js:441:14 at process._tickCallback (node.js:415:13)
This error occurs both on my Node cloud server and on the MySQL server, as well as on the local configuration of both.
My questions:
Is this a problem disconnecting the Node connection to my MySQL server, possibly due to a limited connection life?
When using connection pools, node-mysql should gracefully handle disconnections and trim them from the pool. Is it not known about disconnecting until I make a request, making the mistake inevitable?
Given that I often see the "read ECONNRESET" error in other StackOverflow posts, should I look elsewhere from MySQL to diagnose the problem?
Update:. After looking more, I think my problem is a duplicate of this . It seems that his connection is also disconnected, but no one suggested how to keep the connection alive or how to fix the error outside the failure on the first request.
source share