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.

Investigate why server freezes when a connection to the db ever fails

See original GitHub issue
(node:3870) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 10.0.0.4:5432
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)
(node:3870) 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(). (rejection id: 1)
(node:3870) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Postgres.ts should probably have a try/catch.

Since it doesn’t crash, it doesn’t cause it to restart and it instead gets stuck in a broken state.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
HanabishiReccacommented, Sep 28, 2021

In any case, I think the server should handle unexpected events. At least just restart. Like:

const panic = (e: Error) => {
    console.error(e);
    // Hope for the best
    process.exit(1);
};

process.on('uncaughtException', panic);
process.on('unhandledRejection', panic);

Of course there should be a service/script that watches the process and restarts it.

2reactions
HanabishiReccacommented, Sep 28, 2021

Hard to say what is happening without a more detailed stack trace. Are you sure that the rejection happens exactly here?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understand and resolve SQL Server blocking problems
The article describes blocking in SQL Server and demonstrates how to troubleshoot and resolve blocking. In this article, the term connection ...
Read more >
SQL Server Suddenly Frozen? You Might Be Snapshotting ...
SQL Server freezes databases one at a time, serially, until it's got them all frozen. This can take some time, and while databases...
Read more >
What do These Messages Mean - “I/O is Frozen on Database ...
These messages indicate that SQL Server has frozen the IO so that snapshots can be taken for the volume. This is coordination between...
Read more >
5 Simple Reasons for Server Hangs and Freezes - rackAID
Server hangs or freezes can occur for a number of reasons, ... In most cases, the server is fine, but there is a...
Read more >
Communications to SQL server "freeze", then resume.
I have Confio Ignite 8 and working with their support and don't really see anything other than for these "freezing" times, hardware data...
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