16

i have very strange error when deploy my rails app with capistrano. sometimes it's deploy and sometimes not. for example i add something to css (just one string) e.g. .my_some_class{width:10px} and after that deployment fails. before i add this - it's deploy ok. i am sure what nothing else changed cause i make experimental commit which contain only one string of css. my config:

rails 4.1.0
ruby 2.1.1p76

gem 'capistrano-rails', group: :development
gem 'capistrano-rvm', group: :development
gem 'capistrano-bundler', group: :development

end of deploy log:

Tasks: TOP => deploy:assets:precompile
(See full trace by running task with --trace)
The deploy has failed with an error: #<SSHKit::Command::Failed: rake exit status: 137
rake stdout: Nothing written
rake stderr: SafeYAML Warning
  ----------------

  You appear to have an outdated version of libyaml (0.1.4) installed on your system.

  Prior to 0.1.6, libyaml is vulnerable to a heap overflow exploit from malicious YAML payloads.

  For more info, see:
  https://www.ruby-lang.org/en/news/2014/03/29/heap-overflow-in-yaml-uri-escape-parsing-cve-2014-2525/

  The easiest thing to do right now is probably to update Psych to the latest version and enable
  the 'bundled-libyaml' option, which will install a vendored libyaml with the vulnerability patched:

  gem install psych -- --enable-bundled-libyaml



I, [2014-04-30T09:42:41.121037 #12193]  INFO -- : Writing /var/www/default/releases/20140430134522/public/assets/Thumbs-82e32ea0cc1ce375db2805ceadd707ef.db
I, [2014-04-30T09:42:41.123108 #12193]  INFO -- : Writing /var/www/default/releases/20140430134522/public/assets/agency_no_logo-a8544e60b8a38abeb431c2eb5089f7c6.png
I, [2014-04-30T09:42:41.461121 #12193]  INFO -- : Writing /var/www/default/releases/20140430134522/public/assets/swipebox/img/loader-a66dde050b0b2447862919f2c4c37eda.gif

bash: line 1: 12193 Killed                  ( RAILS_ENV=production ~/.rvm/bin/rvm default do bundle exec rake assets:precompile )
kpblc
  • 903
  • 1
  • 8
  • 24
  • Have you run `gem install psych -- --enable-bundled-libyaml`? – BroiSatse Apr 30 '14 at 14:06
  • @BroiSatse yes, it's not updating. also i'l try to load in gemfile gem 'psych', '>= 2.0.5'- no result – kpblc Apr 30 '14 at 14:08
  • I have been seeing the same libyaml error recently on rails 4 / cap and have been ignoring it. It hasn't affected deployments. I will look into it eventually but have other issues. Did you solve your issue? – port5432 Apr 30 '14 at 14:38

4 Answers4

20

As was written above, probably, you have not enough RAM.

I solved problem by adding SWAP file on my Ubuntu 14.04 server:

Under the root:

dd if=/dev/zero of=/swapfile bs=1024 count=512k
mkswap /swapfile
swapon /swapfile

Add next line to /etc/fstab:

 /swapfile       none    swap    sw      0       0 

and:

echo 0 > /proc/sys/vm/swappiness
sudo chown root:root /swapfile 
sudo chmod 0600 /swapfile

check SWAP(maybe need reloading):

swapon -s 

How To Add Swap on Ubuntu 14.04 @ Digital Ocean Community

jibiel
  • 8,175
  • 7
  • 51
  • 74
Viktor Oleksyn
  • 624
  • 7
  • 6
  • thx! for me it's already solved as i written above, but it may be usefull, for someone else! i even mark you answer as correct) – kpblc Jan 04 '15 at 09:52
13

if someone have same error - problem was on hosting. server have not enough ram(512mb), and process of compilation css/js was killed every time. than we change rate plan, which has 1gb ram, all deployed successfully. SO if you assets precompile failed - just try to add some resources to server. P.S. similar problem i found here Capistrano deploy - assets precompile error

Community
  • 1
  • 1
kpblc
  • 903
  • 1
  • 8
  • 24
6

Try rebooting the server.Worked for me.

drumaddict
  • 121
  • 2
  • 7
  • this work, cause after reboot you have more ram, than after a few days of work. for myself, i solved this problem long ago, but thanks for you answer – kpblc Sep 07 '15 at 07:13
0

You appear to have an outdated version of libyaml

Update libyaml.

OneChillDude
  • 7,856
  • 10
  • 40
  • 79