1

I have an app using resque, capistrano and capistrano-resque gem, Here is my deploy.rb:

role :resque_worker, "webmaster@url"
role :resque_scheduler, "webmaster@url"
set :application, 'app_name'
set :repo_url, 'git@url'
set :scm, :git
set :branch, "master"
set :keep_releases, 2
set :ssh_options, { forward_agent: true }


set :workers, { "*" => 2 }

# Uncomment this line if your workers need access to the Rails environment:
set :resque_environment_task, true

set :bundle_roles, :all

set :linked_files, %w{config/database.yml config/initializers/secret_token.rb config/aws.rb}
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}

namespace :deploy do
  desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
      execute :mkdir, "-p #{release_path.join('tmp')}"
      execute :touch, release_path.join('tmp/restart.txt')
    end
  end
end

after "deploy:restart", "resque:restart", "resque:scheduler:restart"

Ofcourse I have all necessary gems in gemfile, all was working fine, but now every deploy is crashing with error:

SSHKit::Command::Failed: kill exit status: 1
kill stdout: Nothing written
kill stderr: kill: No such process

I added *.pid to gitignore, but it didnt help.

Here is more detailed output:

cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host staging.shoko-service.projects.digitalizm.com: kill exit status: 1
kill stdout: Nothing written
kill stderr: kill: No such process
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/command.rb:97:in `exit_status='
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:148:in `block (5 levels) in _execute'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `call'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `do_request'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:561:in `channel_request'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:269:in `wait'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:170:in `block (3 levels) in _execute'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `call'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:172:in `block (2 levels) in _execute'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:186:in `with_ssh'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:131:in `block in _execute'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `tap'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `_execute'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:66:in `execute'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/bundler/gems/capistrano-resque-94c388e01574/lib/capistrano-resque/tasks/capistrano-resque.rake:77:in `block (5 levels) in <top (required)>'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/bundler/gems/capistrano-resque-94c388e01574/lib/capistrano-resque/tasks/capistrano-resque.rake:76:in `each_line'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/bundler/gems/capistrano-resque-94c388e01574/lib/capistrano-resque/tasks/capistrano-resque.rake:76:in `block (4 levels) in <top (required)>'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/abstract.rb:77:in `within'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/bundler/gems/capistrano-resque-94c388e01574/lib/capistrano-resque/tasks/capistrano-resque.rake:74:in `block (3 levels) in <top (required)>'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'

exectued command

INFO[ec1820b4] Running /usr/bin/env kill -s QUIT $(cat tmp/pids/resque_work_1.pid) && rm tmp/pids/resque_work_1.pid on host
DEBUG[ec1820b4] Command: cd /home/webmaster/www/host/current && /usr/bin/env kill -s QUIT $(cat tmp/pids/resque_work_1.pid) && rm tmp/pids/resque_work_1.pid
DEBUG[ec1820b4]     kill: No such process
xamenrax
  • 1,724
  • 3
  • 27
  • 47
  • Add `set :log_level, :debug` to your setup and try again, it should print out additional info on why the process failed. Can you post the additional debug output? – Dylan Markow Jun 09 '14 at 11:46
  • @DylanMarkow, check out an updatet question, ty for reply btw. – xamenrax Jun 09 '14 at 11:50
  • My guess would be that you still have a pid file sitting somewhere with an invalid process id in it; can you find it and try deleting it and see if that fixes? – Dylan Markow Jun 09 '14 at 11:56
  • @DylanMarkow, I did ``sudo kill -9 `ps aux | grep [r]esque | grep -v grep | cut -c 10-16``` but no resque processes was found anyway. – xamenrax Jun 09 '14 at 12:12
  • No, you won't find it using `ps aux`. I'm saying there's a file, not a process, maybe `resque.pid`, that contains a process number that doesn't exist anymore. Delete the `pid` file and try deploying again. – Dylan Markow Jun 09 '14 at 16:06
  • @DylanMarkow, ok sry, should I delete a pid file even if it not in projects directory? – xamenrax Jun 10 '14 at 07:31
  • @DylanMarkow anyway no pids was found. – xamenrax Jun 10 '14 at 09:42
  • Did you make sure the log level was set to debug? That should print out the full command it's trying to run that's causing the error (it would be just before the error dump you posted) – Dylan Markow Jun 10 '14 at 11:04
  • @DylanMarkow sure, here is the failed command (see updated question) – xamenrax Jun 10 '14 at 11:29
  • 2
    I doubt this will help anyone, but I had the same issue as Nikita, and using the debug log level "solved" my problem -- the error message just went away mysteriously. Still not sure why there was difficulty with killing the scheduler process, nor why the debug log level made any difference. Anyone have any thoughts? – Jared Goodner Jul 23 '14 at 00:26

0 Answers0