Issue with not closing DB connections
See original GitHub issueBug description
I have a heroku free tier DB and it looks like Prisma is not ending connections after making calls to the hosted DB on heroku.
I am only using my app in basic development, and have never experienced any problems with too many connections, however, now I experience this error every few errors, and it persists even after killing all connections manually.
"[GraphQL] Invalid invocation: Error querying the database: db error: FATAL: too many connections for role
How to reproduce
Steps to reproduce the behavior:
- Create Heroku free tier postgresql DB
- Make some queries involving joins across a few tables
- See error of max connections being reached
Expected behavior
DB connections should be killed after requests are complete
Prisma information
Environment & setup
- OS: MacOs
- Database: PostgreSQL
- Node.js version: v12.10.0
- Prisma versions: @prisma/cli : 2.11.0 @prisma/client : 2.11.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:29 (10 by maintainers)
Top Results From Across the Web
Common Reasons Why Connections Stay Open for a Long ...
Applications Not Properly Closing Connections; Long Database Queries; Shared Connections with Local Transaction Containment; Embedded getConnection Requests.
Read more >Database connections are not closing - MuleSoft Help Center
Database connection to IBM db is using Generic database connector and it is not closing after the operation and creating multiple open connections...
Read more >database connections not closing.... - MSDN - Microsoft
I'm having some problems with connections to an SQL database not closing after being opened, which is maxxing out the pool and causing...
Read more >What will happen if we do not close the connection object in ...
Not closing connection object in jdbc causes memory leak even through user logs till system is shut down. Another case in which if...
Read more >Database connection not closed inspite of close statements
I am facing a problem in closing database connections. I am getting the below error:
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We now have a dedicated section in the docs for this situation: https://www.prisma.io/docs/concepts/components/prisma-client/working-with-prismaclient/instantiate-prisma-client#prevent-hot-reloading-from-creating-new-instances-of-prismaclient
Please let me know, if that doesn’t solve it for you, then we can reopen this issue.
Check the issue I linked I think this relevant for use case with next