BDub reported that their Discourse instance, running on a 2GB/1CPU DigitalOcean droplet, crashes with an out-of-memory error when opening topics after resizing from a more expensive plan. Although the site loads initially, accessing topics triggers crashes. Logs showed a deadlock; recursive locking error linked here. ssvenn suggested checking for memory over-allocation, verifying swap configuration, and tailing the Rails production log for verbose errors. BDub confirmed the droplet had no swap and observed memory usage climbing rapidly after reboot — from 756MB to 1938MB within seconds — despite low site traffic. ssvenn recommended tuning unicorn workers and database cache size, referencing potential high resource usage after upgrades. Falco advised configuring swap using the official Discourse Docker script. BDub confirmed that adding 2GB of swap resolved the issue, stabilizing the instance with memory usage now under control and swap unused.
I have the latest version of discourse running on a 2GB / 1CPU / 40GB SSD Ubuntu 14.04.5 DigitalOcean droplet. It has been fine for the longest time, and I recently resized the old plan that was the same specs from $20/mo. to this one that is $10/mo. After resizing everything it was running and very snappy (better than before I’d say), but now it will load the main site but if I click on any topics it won’t load and ends up crashing the instance.
Any advice on where to go digging for the right logs?
“failed to allocate memory” sounds like maybe the database is tuned to use too much ram from the previous plan, my empty test instance uses about 1gb on a 4gb centos vm
[root@discocent discourse]# free
total used free shared buff/cache available
Mem: 3881412 912764 413192 33168 2555456 2401820
Swap: 2097148 1544 2095604
Does the droplet have any swap configured? Have you tried rebuilding the app container?
Check for out-of-memory errors in dmesg or /var/log/syslog too
Try to tail -f /var/discourse/shared/standalone/log/rails/production.log when opening a topic and look for error messages there maybe, that log is pretty verbose.
Yes I tried rebuilding which finishes fine and loads the site.
Memory available should be the same as before, 2GB.
It does appear something is consuming up all of the memory… and there are lots of threads on here that say discourse can run on the smallest droplet. My site is basically a ghost town as well.. so nothing should be consuming so much RAM.
Oh here we go…
this is just after rebooting the disc, running free -m every second.
Important Note: Expect high CPU usage for a few hours after this upgrade due to image re-optimization. Sites with large numbers of images may see high CPU usage for a longer period of time.
It could be that you need to tune the number of unicorn workers and reduce the cache size for the database for that initial optimization to work.