sidorares / sidorares/node-mysql2
Error PROTOCOL_CONNECTION_LOST
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.4k
- Forks
- 680
- Avg merge
- 9h 7m
- Merged PRs (30d)
- 59
Description
I am using Connection Pooling with the following options -
const options = {
connectionLimit: config.connection_pool,
host: mysqlHost,
user: mysqlUser,
password: mysqlPassword,
database: mysqlDb,
multipleStatements: true,
Promise: bluebird,
};
The wait_timeout configuration of MySQL on the server is 5 seconds. It used to be 10 seconds before I changed it to 5. Since then, I have been observing query failures all over my logs. All of them throw the same error.
The connection config is a bit confusing since it does not provide any related config.
I came across two related parameters - connectTimeout and acquireTimeout
The default value of connectTimeout is 10 seconds. This creates some confusion in my mind. Has this anything to do with the connections timing out ?
When does a pool truly end a connection? When does the pool get to know that the connection has been closed from the MySQL server's end?
I use pool.query in the program and this creates a problem in using error handlers and solving the issue on a global scale.
Any help would be much appreciated.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the pool.query usage and connection options shown in the issue. Investigate how MySQL wait_timeout relates to connectTimeout, acquireTimeout, and PROTOCOL_CONNECTION_LOST, and document when the pool detects connections closed by the server.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, node.js
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100