Econnreset 500 - Inactivity Error (selfhosted / beginner)

First of all, I’m a very beginner with GhostCMS and selfhosted vServer Instances. So I’m not very into SSH and Troubleshooting at all. Unfortunately I hired an agency to install Ghost to my own vServer. In fact they couldn’t help a lot I thought it’s better to get into this and try it myself.

After a short period of inactivity an ECONNRESET 500 error occurs

I’ve found the following tutorial and failed setting up a cron job correctly https://codeandops.com/database-error-500-ghost-cms-mysql/
Maybe it’s easier to solve this error on the caprover UI. It’s possible to change NGINX or Database config on CapRover. But I don’t know exactly what to do.

On top I’ve found a lot of github tickets/errors, but there are many possabilities and some steps are hard to understand, so I try to do it on my own (with your help).

  • What version of Ghost are you using?
    Installed on 3.4.0 (after that I updated to 3.41.3)
  • What configuration?
    Installed through a Docker (CapRover)
  • What errors or information do you see in the console?

Error on Website
select sessions.* from sessions where sessions.session_id = ‘_ksklFhzarcWaKa-1yAJFCA3y0AAKnnO’ limit 1 - read ECONNRESET

Caprover App Log (/opt/bitnami/ghost/versions/3.4.0/node_modules/knex/node_modules/bluebird/js/release/async.js:15:14)\n at runCallback (timers.js:705:18)\n at tryOnImmediate (timers.js:676:5)\n at processImmediate (timers.js:658:5)\n at process.topLevelDomainCallback (domain.js:126:23)"},“msg”:“select posts.* from posts where (posts.status = ‘published’ and posts.type = ‘post’) and posts.slug = ‘private’ limit 1 - read ECONNRESET”,“time”:“2021-01-31T20:51:39.247Z”,“v”:0}

  • What steps could someone else take to reproduce the issue you’re having?
    After not being active on the page, this error occurs.

Please ask if you need further information. Thanks for your patience!

Hello! I was struggling with the same thing as well and figured out the solution after looking through the caprover slack channel.

Essentially you have to modify confit.production.jason to disable pooling, as docker-based systems disconnect after a period of inactivity.

I put a note on the solution here as well: Resolving Ghost and Caprover Error 500: ECONNRESET

Hopefully this helps!

I followed this example and it broke my site.

This post is 2.5 years old, and Ghost is two major versions later. If you need help with your site, it’d be helpful to post all the details in a new post.

1 Like

Yeah I know, no thanks.

I found the fix for the new Ghost as of 4 NOV 2023

find config.production.json
find the section that looks like this

"database": {
  "client": ...,
  "connection": { ... },
}

and add this

"database": {
  "client": ...,
  "connection": { ... },
====>  "pool": {
====>    "min": 0
====>  }
}
(don't add those arrows)
If you are using docker as i am then login to your server, use the command 'docker ps' to find your image and use the command 'docker restart _____' (fill the blank with the image number) and no more 500 econnreset after X time.

thank you to myself for finding this fix.