rails/rails — Issue #3694: 3.1.1 assets:precompile running out of memory
Author: samlown
Created: 2011-11-19 12:44:52+00:00
State: open

Hi,

`assets:precompile` spawns another process for `assets:precompile:nondigest` before terminating itself. Each instance of the rake task on our setup uses over 150MB of RAM (according to top), so the second run ends up gobbling a total of 300MB. The linux kernel on the 512MB node just ends up telling the rake task its a greedy SOB by killing it. Capistrano then aborts the deploy.

Using two capistrano tasks for `assets:precompile:primary` and `assets:precompile:nondigest` solves the problem. I don't know enough about the precompile process and Sprockets to recommend an proper solution (the whole "if digest, compile nondigest" thing is very confusing [1]) but perhaps a `Kernel.exec` can be used instead to pass control to the new process instead of leaving the old lingering?

Cheers,
sam

[1] https://github.com/rails/rails/pull/3225#issuecomment-2307410