sidorares / sidorares/node-mysql2
Pooled connections memory leaks upgrading past 3.9.4
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.4k
- Forks
- 680
- Avg merge
- 9h 7m
- Merged PRs (30d)
- 59
Description
Using pooled connections, we upgraded from 3.9.4 to 3.11.3 and instantly saw huge memory leaks in many deployed production enviroments. See screenshots below from google cloud run where the line with the i and dotted lines marks the deployment of the libary 3.11.3. Its very clear that its the changes between 3.9.4 and 3.11.3
Screenshot of container insights in production after deployement
I downgraded to 3.9.7 and still have the memory leaks.
Rolling back to mysql 3.9.4 solves the issue
We are using typeorm but the mysql config parms are just passed down. I will write the relevant ones below;
{
type: xxxx,
username: xxxx,
password: xxxx,
database: xxxx,
entities: dmsDbEntities,
synchronize: false,
pool: {
max: 25,
min: 0,
},
extra = {
socketPath: /xxxx/x
}
}
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
No source file or test is named. Start by reproducing the reported upgrade from 3.9.4 with pooled connections, the shown max/min pool settings, and socketPath configuration, then compare behavior through 3.11.3 and 3.9.7. Done means the memory leak is isolated and a regression test or focused reproduction demonstrates the corrected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, node.js, typescript
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100