rails: assets:precompile freezes after 10 minutes
I have a problem with assets:precompile. It freezes after 10 minutes of precompiling assets. Process ends but it still waits for something and no response given.
INFO [2fc05e34] Running ~/.rvm/bin/rvm 2.0.0-p247@apptamers do bundle exec rake assets:precompile on x12s2.staging.apptamers.com
DEBUG [2fc05e34] Command: cd /home/webservice/project/20140129075713 && ( RAILS_ENV=production ~/.rvm/bin/rvm 2.0.0-p247@apptamers do bundle exec rake assets:precompile )
DEBUG [2fc05e34] /home/webservice/.rvm/rubies/ruby-2.0.0-p247/bin/ruby /home/webservice/project/shared/bundle/ruby/2.0.0/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
CPU is 100% usage but it’s normal when I precompile assets on this server.
I have set up ssh_config entries to make sure that it’s not a ssh problem. So it’s not a timeout problem.
$ cat ~/.ssh/config
Host *
ServerAliveInterval 15
I wonder if it’s not a sshkit problem and maybe someone has the same issue.
capistrano-rails 1.1.0
capistrano 3.0.1
sshkit 1.3.0
When I do CTR+C after 1h, i get:
/home/user/.rvm/gems/ruby-2.0.0-p247@apptamers/gems/sshkit-1.3.0/lib/sshkit/runners/parallel.rb:15:in `join'
/home/user/.rvm/gems/ruby-2.0.0-p247@apptamers/gems/sshkit-1.3.0/lib/sshkit/runners/parallel.rb:15:in `map'
/home/user/.rvm/gems/ruby-2.0.0-p247@apptamers/gems/sshkit-1.3.0/lib/sshkit/runners/parallel.rb:15:in `execute'
/home/user/.rvm/gems/ruby-2.0.0-p247@apptamers/gems/sshkit-1.3.0/lib/sshkit/coordinator.rb:21:in `each'
/home/user/.rvm/gems/ruby-2.0.0-p247@apptamers/gems/sshkit-1.3.0/lib/sshkit/dsl.rb:8:in `on'
/home/user/.rvm/gems/ruby-2.0.0-p247@apptamers/gems/capistrano-rails-1.1.0/lib/capistrano/tasks/assets.rake:60:in `block (3 levels) in <top (required)>'
...
This runners/parallel.rb looks interesting, maybe this is a sshkit runner problem?
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 32 (10 by maintainers)
Adding
keepalive: truetossh_optionsfixed my problem.@lukaszsliwa - Thanks - your solution of adding
config.assets.logger = Logger.new $stdoutto production.rb worked for me!Problem solved by adding
to
/etc/ssh/sshd_configon the server. It seems thesshkitgem used by Capistrano responds to these SSH probes, which makes it work. I chose every 30 seconds, because one of the network equipment, between our collaborator in Spain and the servers in France, seems to be quite aggressive to cut apparent inactive connections.I have added:
and now it responses, shows assets precompilation log and capistrano successfully finishes a deploy. It doesn’t freeze like before.
In general, it doesn’t solve a problem (what if someone doesn’t want to see the log?) but it works.
Hi @yourivdlans. I ran the test you requested and got these results:
@imported by all 500 stylesheets)As expected, if a change affects all stylesheets, they all need to recompiled. If a change is local to a small number of stylesheets, the sprockets cache is used and compilation is fast.
(To ensure the sprockets cache works, you need
tmp/cachein your capistrano:linked_dirsso that the cache is reused between deploys.)This is an argument for avoiding global variables and mixins when structuring your Sass projects, and using
@importsparingly, as I’ve written about here: http://blog.55minutes.com/2013/01/lightning-fast-sass-reloading-in-rails-32/Have you tried enabling net-ssh keepalive? Something like this might work: