Assets:precompile fatal error, out of memory

Updating from 2.7.4 to 2.8.4 everything seemed to go well, but I got stuck here:

RAILS_ENV=production bundle exec rails assets:precompile
yarn install v1.12.3
[1/6] Validating package.json...
[2/6] Resolving packages...
success Already up-to-date.
Done in 1.40s.
Compilation failed:

# Fatal error in , line 0
# API fatal error handler returned after process out of memory

After starting and reloading Mastodon, the service seems to be up & running correctly for logged in users (posting, timelines). However, the pages for visitors seem to be half broken…

… or completely broken.

Any suggestions to go through the precompilation successfully?

Thanks to a hint / encouragement from Tobi, I checked what was going on with htop. The 2GB memory of the server was being eaten by the process, and turns out that this server (a humble yet sufficient DigitalOcean droplet) didn’t have any swap memory assigned.

Following these instructions, I created a temporary swap file with 2GB. Then I re-run the process and this time it went through. The links above now load and look just fine.

Problem solved!

1 Like

Just Stop all the mastodon services and then recompile. it will help complie much faster you dont run into issues.

1 Like