question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with not closing DB connections

See original GitHub issue

Bug 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:

  1. Create Heroku free tier postgresql DB
  2. Make some queries involving joins across a few tables
  3. See error of max connections being reached

Expected behavior

DB connections should be killed after requests are complete

Prisma information

Environment & setup


Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:29 (10 by maintainers)

github_iconTop GitHub Comments

4reactions
timsuchanekcommented, Feb 18, 2021

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.

4reactions
Syttencommented, Dec 2, 2020

Check the issue I linked I think this relevant for use case with next

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found