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.

Error in connector: Error creating a database connection. (Operation timed out (mobc timeout))

See original GitHub issue

Bug description

Sometimes, due to DB connections limit, the client fails with this error:

Error in connector: Error creating a database connection. (Operation timed out (mobc timeout))
    at PrismaClientFetcher.request (/home/nicosampler/develop/loan-system/node_modules/@prisma/client/runtime/index.js:78786:15)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async eval (webpack-internal:///./graphql/migration/resolver.ts:139:17)
(node:106069) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 75)

my DB configuration is like so: DATABASE_URL="mysql://someUser:somePass@host/db?connection_limit=10"

Note: connection_limit

How to reproduce

It happened to me when trying to create/update/delete several entities at the same time, for example:

const res = [largeArray]
res.forEach(async (client) => {
       const createdClient = await context.prisma.client.create({data: {client}})
})

Expected behavior

The client should be able to recover from a timeout connection.

Environment & setup

  • OS: Ubuntu
  • Database: Mysql
  • Node.js version: 14
  • Prisma version: 2.11.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:44 (16 by maintainers)

github_iconTop GitHub Comments

11reactions
pantharshit00commented, Dec 9, 2020

I can reproduce this with a heroku database with connection limit of 10 and this simple script.

image

All timed out calls doesn’t recover. Connections in the heroku reaches max of 11 then it starts to give timeouts.

image

Reproduction: https://github.com/harshit-test-org/prisma-issue-4280

5reactions
JonathanCallewaertcommented, Jan 20, 2021

I am using the latest version of prisma (2.15.0). It’s throwing the new error (https://github.com/prisma/prisma-engines/pull/1515). But the error message doesn’t make sense. I have 150 connections as limit, 10 connections are used but it still fires an error:

Timed out fetching a new connection from the pool. Please consider reducing the number of requests or increasing the `connection_limit` parameter (https://www.prisma.io/docs/concepts/components/prisma-client/connection-management#connection-pool). Current limit: 150, amount of connections currently in use: 10.

The connection limit of my DB (postgres) is 180

Read more comments on GitHub >

github_iconTop Results From Across the Web

When connecting to my database I get a Connection Timed ...
A Connection Timed Out error occurs when the database's firewall won't allow you to connect to the database from your local machine or...
Read more >
Cannot connect to PostgreSQL from client - Error timed out
In my experience, a connection timeout error is typically due to a windows/networking issue, for example a firewall on (or in front of)...
Read more >
azure.core.exceptions.serviceresponseerror - You.com
Error in connector: Error creating a database connection. (Operation timed out (mobc timeout)) at PrismaClientFetcher.request ...
Read more >
How to fix MongoDB connection timeout? - Bobcares
This error happens due to the wrong MongoDB server setting, bad connection parameters and much more.
Read more >
Timeout expired messages when connecting to SQL Server
Before you start troubleshooting, check the prerequisites and go through the checklist. A timeout error means that a certain operation takes ...
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