Automated backups not being triggered because cannot allocate memory

Manual backups (local and to S3) work great, but automated backups don’t seem to work. Any ideas why?

Settings

Errors ~ 6 minutes after trigger

Job exception: Cannot allocate memory - fork(2)

/var/www/discourse/lib/backup_restore/backup_restore.rb:160:in `fork'
/var/www/discourse/lib/backup_restore/backup_restore.rb:160:in `start!'
/var/www/discourse/lib/backup_restore/backup_restore.rb:15:in `backup!'
/var/www/discourse/app/jobs/regular/create_backup.rb:8:in `execute'
/var/www/discourse/app/jobs/base.rb:154:in `block (2 levels) in perform'

Ram

root@discourse-app:/var/www/discourse# free -mh
              total        used        free      shared  buff/cache   available
Mem:           992M        664M         72M        137M        255M         50M
Swap:          2.0G        1.0G        1.0G

If you are constantly swapping 1GB, you need more memory on this server.

3 Likes

you probably are big enough that more memory is needed…1GB is enough.

1 Like

If it’s a RAM issue, why do manual backups work then?

I’m not entirely sure but that error is due to insufficient memory available.

I upgraded from 1 GB to 2 GB box and backups seem to be working now.

              total        used        free      shared  buff/cache   available
Mem:           2.0G        1.2G        276M        141M        544M        498M
Swap:          2.0G         28M        2.0G

If anyone else has this problem, I’d try a reboot first because the Ubuntu box had also recently had kernel upgrades, so maybe that was the issue.

2 Likes

If you run discourse-setup it will tweak the memory settings to take advantage of the additional memory.

Interesting - I didn’t realise that running discourse-setup could be done on an install which was already up and running.

1 Like

Hmm. Running the setup again sounds dangerous to my existing app.yml. Any idea what the tweaks are?

I answered my own question :joy:. According to https://github.com/discourse/discourse_docker/blob/master/discourse-setup, the tweaks to app.yml are:

# db_shared_buffers: 128MB for 1GB, 256MB for 2GB, or 256MB * GB, max 4096MB
# UNICORN_WORKERS: 2 * GB for 2GB or less, or 2 * CPU, max 8 
2 Likes

This topic was automatically closed after 2555 days. New replies are no longer allowed.