retry on PROTOCOL_CONNECTION_LOST error does not work with RDS
Opened this issue · 0 comments
We are having this intermittent connection issue when AWS lambda tries to make queries on Amazon RDS. There is already another issue with same error listed on github and is marked as resolved ( https://github.com/jeremydaly/serverless-mysql/pull/68/files ) and this does not resolves the connection issue that we are having with RDS. I have added the stacktrace for reference. Also this stacktrace only appears once which makes me think that retry is actually not working properly for some reason since lambda does not fetch results and fails.
I have already checked max connections which are set to 200 for RDS and from the RDS monitoring console max connections reached only 150 which is why I am inclined towards ruling out max parallel connections reached issue.
2020-11-27T10:45:33.009Z 1e955f8d-171e-456f-ab0a-1cae27f4d8e2 ERROR Error: Connection lost: The server closed the connection.
at Protocol.end (/var/task/node_modules/mysql/lib/protocol/Protocol.js:112:13)
at Socket.<anonymous> (/var/task/node_modules/mysql/lib/Connection.js:94:28)
at Socket.<anonymous> (/var/task/node_modules/mysql/lib/Connection.js:526:10)
at Socket.emit (events.js:326:22)
at Socket.EventEmitter.emit (domain.js:483:12)
at endReadableNT (_stream_readable.js:1223:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
--------------------
at Protocol._enqueue (/var/task/node_modules/mysql/lib/protocol/Protocol.js:144:48)
at Connection.query (/var/task/node_modules/mysql/lib/Connection.js:198:25)
at /var/task/node_modules/serverless-mysql/index.js:189:25
at new Promise (<anonymous>)
at Object.query (/var/task/node_modules/serverless-mysql/index.js:185:12) {
fatal: true,
code: 'PROTOCOL_CONNECTION_LOST'
}