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.

Gracefully handle database connection unavailable

See original GitHub issue

Describe the bug When the database connection to the backend storage is unavailable (tested with postgres), the server keeps on crashing instead of gracefully reporting database connection issues.

To Reproduce Steps to reproduce the behavior:

  1. Stop your database server (postgres)
  2. Start etherpad
  3. Visit some page that needs the database connection (any pad should do, in my case, also triggered when viewing /admin/plugins
  4. See error

Expected behavior Graceful fallback to display some frontend error message, but keep running despite this lack of database connectivity.

Actual behaviour

[2020-11-12 22:13:05.858] [ERROR] console - error: column "value" is of type jsonb but expression is of type text
    at Parser.parseErrorMessage (/home/etherpad/etherpad-lite/src/node_modules/pg-protocol/dist/parser.js:278:15)
    at Parser.handlePacket (/home/etherpad/etherpad-lite/src/node_modules/pg-protocol/dist/parser.js:126:29)
    at Parser.parse (/home/etherpad/etherpad-lite/src/node_modules/pg-protocol/dist/parser.js:39:38)
    at Socket.stream.on (/home/etherpad/etherpad-lite/src/node_modules/pg-protocol/dist/index.js:8:42)
    at Socket.emit (events.js:198:13)
    at Socket.EventEmitter.emit (domain.js:448:20)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
[2020-11-12 22:13:05.858] [INFO] console - Stopping Etherpad...
[2020-11-12 22:13:05.876] [ERROR] console - TypeError: Cannot read property 'name' of null
    at Client._handleParseComplete (/home/etherpad/etherpad-lite/src/node_modules/pg/lib/client.js:358:26)
    at Connection.emit (events.js:198:13)
    at Connection.EventEmitter.emit (domain.js:448:20)
    at parse (/home/etherpad/etherpad-lite/src/node_modules/pg/lib/connection.js:109:12)
    at Parser.parse (/home/etherpad/etherpad-lite/src/node_modules/pg-protocol/dist/parser.js:40:17)
    at Socket.stream.on (/home/etherpad/etherpad-lite/src/node_modules/pg-protocol/dist/index.js:8:42)
    at Socket.emit (events.js:198:13)
    at Socket.EventEmitter.emit (domain.js:448:20)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)

Additional context

Etherpad version
Version number: 1.8.6
Latest available version: 1.8.6
Git sha: 6a8563e

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
JohnMcLearcommented, Nov 12, 2020

Oh check the reverted commits. There was a bad pg commit a while back that was related I think…

1reaction
BenBEcommented, Nov 13, 2020

After conversion to text everything seems to work:

ALTER TABLE storage ALTER COLUMN value TYPE text USING value::text;
Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I handle an unreachable database server gracefully?
I have an app that is primarily in mysql, but for a few pages needs to connect to another mssql server. I have...
Read more >
Database connection error | OutSystems
With Web Apps the Platform assumes the database is always available. So I don't think it's possible to gracefully catch a situation where...
Read more >
Sync Gateway should gracefully handle TAP being unavailable
It would be good to gracefully handle t. ... FATAL: Error opening database: 502 Unable to connect to Couchbase Server (connection refused).
Read more >
How To Fix The "Error Establishing a Database Connection" in ...
Typically you can resolve this error in under 15 minutes. The most common issue is that your database login credentials are incorrect. Your ......
Read more >
Handling Pessimistic Locking with JPA on Oracle, MySQL ...
H2 in-memory database interrupts the connection and does not allow you to handle the LockTimeoutException gracefully;. Note that if you use ...
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