Memory error on upgrade from v1.5.0.beta14

(blaumeer) #1

I am on a 2GB RAM VPS (from Hetzner) with a typical Discourse setup. Trying to upgrade from the latest 1.5 beta14 via web /admin/upgrade I get a memory error: Errno::ENOMEM: Cannot allocate memory

My memory situation seems ok:

root@elio /var/discourse # free -hm
             total       used       free     shared    buffers     cached
Mem:          2.0G       1.7G       276M       251M        20M       417M
-/+ buffers/cache:       1.3G       714M
Swap:           0B         0B         0B

The tail of the error log is:

Compressing Javascript and Generating Source Maps rake aborted! Errno::ENOMEM: Cannot allocate 
memory - gzip -f -c -7 /var/www/discourse/public/assets/docker-manager-app-fc45ae9f5dc46a536ad03487a4ce173f.js > /var/www/discourse/public/assets/docker-manager-app-fc45ae9f5dc46a536ad03487a4ce173f.js.gz /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/core_ext/kernel/agnostics.rb:7:in ``' /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/core_ext/kernel/agnostics.rb:7:in ``' /var/www/discourse/lib/tasks/assets.rake:138:in `gzip' /var/www/discourse/lib/tasks/assets.rake:179:in `block (2 levels) in '
/var/www/discourse/lib/tasks/assets.rake:160:in `each'
/var/www/discourse/lib/tasks/assets.rake:160:in `block in '
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

After aborting this upgrade, D. shows me that I am on v1.6.0.beta1 +14 (b0f4c9e). It’s strange.

The last recommended upgrade (somewhere in the later 1.5 beta) it happened the same, and I did the upgrade from terminal successfully:

cd /var/discourse
git pull
./launcher rebuild app

I can rebuild the app again in this way, I don’t care, but perhaps this issue has some interest for Discourse developers. Should I dig deeper?

(Jeff Atwood) #2

We do have some reports of this on 2GB instances, but the fix is the same as always – make sure you have some swap configured.

(blaumeer) #3

(Thank you for formatting the code.)
I have added swap and we’ll see next time an upgrade is due.

(blaumeer) #4

Just for the record, today’s upgrade from 1.6.0.beta1 to 1.6.0.beta2 via the web interface failed. It stuck midway and I had to abort/reset it.

Pulling and rebuilding from CLI worked.

I was monitoring RAM and swap, memory was well under 2GB and almost no swap.

(Stefano Costa) #5

Same here, I assumed it was the server having some hiccups. I’ll check the swap settings.

(Jeff Atwood) #6

This is the same issue I covered elsewhere, something is eating CPU and causing the JS transpiler to time out. Docker 1.10 upgrade caused this in many cases with an expensive one time re-checksum of all docker images on the host that eats about 50 percent of one CPU. I increased the transpiler timeouts to 10 seconds 3 weeks ago and I just increased them again to 15 seconds.

(Alexunder) #7

My vps has 1Gb ram, I built the discourse successfully several days ago, and my discourse always ran normally.

But after one time upgrading(It did work just after updating), my site became the blank page. Therefore I want re-build the containerized discourse, it always failed, and showed error log like:

Errno::ENOMEM: Cannot allocate memory

I wonder that from now on the discourse in docker can’t be deployed on 1GB ram vps ?

(Jeff Atwood) #8

Do you have swap? Swap is REQUIRED. Particularly on 1GB RAM. Please refer to the official install docs.

(Alexunder) #9

the size of swap image of my vps is 256Mb. It really did worked before. It means that my current vps can’t deploy the containerized discourse in the future?

(Jeff Atwood) #10

1GB RAM with 256mb swap is below the recommended limits, so that should never have worked. The absolute minimum is 1GB RAM with 2GB swap…