MatteoGioioso / MatteoGioioso/serverless-pg
Clean function does not handle "idle in transaction" and "idle in transaction (aborted)" connections states
@MatteoGioioso is already working on this.
Since Jul 14, 2023.
- Dominant language
- JavaScript
- Stars
- 324
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
Currently, the clean function in our application does not properly handle connections in the "idle in transaction" and "idle in transaction (aborted)" states, leading to potential issues and resource leaks. This problem occurs when connections are left open but not actively executing any queries, resulting in a waste of system resources and potential conflicts.
To address this problem, we need to update the clean function to properly handle these connection states. The function should be able to identify and close connections that are stuck in either "idle in transaction" or "idle in transaction (aborted)" states, ensuring that our application maintains a healthy and efficient connection pool.
We are solving this issue right now by creating a patch for the NPM with the following changes in the code -
in 3 occurrences in src/index.js -
AND state = 'idle'
Changed to -
AND state in ('idle', 'idle in transaction', 'idle in transaction (aborted)', 'disabled')
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.
Assessment
This issue has not been assessed yet.