High rebuild memory requirements: April 2025 edition

Ok, next test completed.

I built with the following plugins:

https://github.com/discourse/docker_manager.git
https://github.com/discourse/discourse-data-explorer
https://github.com/communiteq/discourse-legal-compliance
https://github.com/pfaffman/discourse-allow-pm-to-staff
https://github.com/singerscreations/discourse-stopforumspam
https://github.com/discourse/discourse-cakeday

Swap was disabled, so only 4GiB/3.8GB RAM.

Maximum memory usage during build was 3.4GB. Build time was 6m 48s.

4 Likes

On my way the problem is swap file, after increasing from 0 to 2GB, everything is okay for now.

sudo fallocate -l 2G /swapfile        
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

in the your server terminal. After that, rebuild.

2 Likes

I’m hitting a big increase in memory needed to rebuild. I have 8GB memory and even adding an 8GB swapfile it runs out of space on this step: cd /var/www/discourse && sudo -E -u discourse bundle exec rake multisite:migrate

It’s a multisite install with four forums. I haven’t had to add a swapfile before.

edit Now tried with 16G swap and it’s still running out of memory.

This is under Linux, with minimal plugins enabled. The kernel is killing the process.

2 Likes

Hmm… I wonder, should the docs be updated to reflect higher memory requirements? Did Introducing pre-compiled JS assets for self-hosters help to decrease load? I wold have thought with that change, less RAM is needed :thinking: .

It might have been a few months since I did a rebuild but it was fine before with 8GB ram and no swap. I still haven’t solved this and so all four sites are down.

I don’t know if this is related but it wouldn’t build until I set the environment variable HOME: /var/www/discourse - it would try to write to /root otherwise and get permission denied.

Hmm, I’m seeing over a hundred of these processes:

node /usr/bin/pnpm add pnpm@10.28.0 --loglevel=error --allow-build=@pnpm/exe --no-dangerously-allow-all-builds --config.node-linker=hoisted --config.bin=bin

Is it some kind of fork bomb?

1 Like

Definitely add a LOT of swap even if it’s just to get you back up and running. The advantage of using swap here is builds are a temporary spike.

I use the two container setup and memory is even more under pressure during bootstrap as you also have two running containers. :sweat_smile:

I have added 40GB swap now and it’s not enough.

I’m seeing hundreds of these node processes, that seems to be the problem?

I’m starting to think the root cause is the same as my earlier issue where I had to HOME: /var/www/discourse otherwise it would try to write files under /root. I’m not sure what to do about it though.

2 Likes

Ok something is very wrong. I would also consider backing up and recreating from scratch.

1 Like

How would I go about that?

See:

Thanks, I think I’ll revert the whole server to a last-known-good state first and back up from a working system.
Does anyone have ideas about what could have gone wrong?

1 Like

The problem was indeed do with HOME not being correctly set, adding -H to the sudo command for the multisite migrate fixed it, as detailed here:

6 Likes