Gracefully handle database connection unavailable
See original GitHub issueDescribe 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:
- Stop your database server (postgres)
- Start etherpad
- Visit some page that needs the database connection (any pad should do, in my case, also triggered when viewing
/admin/plugins
- 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:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Oh check the reverted commits. There was a bad pg commit a while back that was related I think…
After conversion to text everything seems to work: