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.

Unable to establish a connection once database recovers

See original GitHub issue

Bug description

If the initial request is sent while database connection cannot be established, all subsequent request will result in failures.

Steps reproduction

  1. Take down database
  2. Initiate request prisma.$queryRaw (FAILS)
  3. Bring up database
  4. Initiate request prisma.$queryRaw (FAILS)

Both requests fail with

Can't reach database server at xxxx:xxx
  prisma:client:libraryEngine sending request, this.libraryStarted: false +5s
  prisma:client:libraryEngine library starting +0ms
  prisma:info Starting a postgresql pool with 21 connections.
  prisma:client:libraryEngine sending request, this.libraryStarted: false +7s
  prisma:client:libraryEngine library already starting, this.libraryStarted: false +0ms

Expected Behavior

  1. Take down database
  2. Initiate request prisma.$queryRaw (FAILS)
  3. Bring up database
  4. Initiate request prisma.$queryRaw (PASSES)

See PR https://github.com/prisma/prisma/pull/12066

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
janpiocommented, Mar 15, 2022

We know that this is not related to the recent connection pool load issue, but generally could have been caused by the same code (connection pool). The PR makes it look like a different, TS Library Engine implementation problem. This has still to be understood and confirmed.

1reaction
Jolg42commented, Mar 15, 2022

Note: See PR and the comments there https://github.com/prisma/prisma/pull/12066

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Fix The Error Establishing A Database Connection In ...
Open MySQL Databases: Go to your cPanel and scroll down to your database section. Click MySQL Database. Initiate Database Repair: Scroll to the ......
Read more >
Recover from a CLOUD-0005 - Oracle Help Center
Using the Oracle Database Cloud Service Adapter with Oracle Integration Generation 2 ... Recover from a CLOUD-0005: Unable to Establish Connection Error.
Read more >
Failing to connect to Database due to database in recovery
If so, whilst the Secondary server is being restored you will be unable to establish connections to the database.
Read more >
The connection is broken and recovery is not possible - MSDN
According to the error message, probably the remote server is shut down, or SQL Server Database Engine service is down, or a new...
Read more >
[Error Solved] SQL Database Restore failed, database in use
When attempting to restore SQL Server db, make sure there are no active connections. If someone is using the database, the restore operation ......
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