Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change pidfile handling, always add index to pidfile name #116

Merged
merged 1 commit into from
Oct 27, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions lib/capistrano/tasks/capistrano2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@
def for_each_process(sidekiq_role, &block)
sidekiq_processes = fetch(:"#{ sidekiq_role }_processes") rescue 1
sidekiq_processes.times do |idx|
if idx.zero? && sidekiq_processes <= 1
pid_file = fetch(:sidekiq_pid)
else
pid_file = fetch(:sidekiq_pid).gsub(/\.pid$/, "-#{idx}.pid")
end
pid_file = fetch(:sidekiq_pid).gsub(/\.pid$/, "-#{idx}.pid")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Um, guys?

This overrides our pidfile setting in sidekiq.yml, and that's been causing some rather serious problems.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what serious problems ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problems all stem from the fact that capistrano-sidekiq is now incompatible with the command line tool ‘sidekiq’ with the -C option for a config file.

For a week we’ve been chasing unexpected multiple instances of sidekiq running against the same queues, unable to figure out where the errant processes have been coming from. We use multiple tools to start and stop sidekiq, and we really, really need all of the tools we use to do the same thing, not least because we have a hard ceiling on sidekiq concurrency at 12, above which our solr server will stop accepting connections and bring down the whole app.

I do understand the benefit of the naming scheme for those running multiple sidekiq instances on a single machine, but for anyone else it is completely unexpected. And in our case at least, it breaks system management, which breaks the app.

We’ve reverted to 0.5.3.

On Dec 4, 2015, at 2:27 PM, Abdelkader Boudih notifications@github.com wrote:

In lib/capistrano/tasks/capistrano2.rb:

@@ -34,11 +34,7 @@
def for_each_process(sidekiq_role, &block)
sidekiq_processes = fetch(:"#{ sidekiq_role }_processes") rescue 1
sidekiq_processes.times do |idx|

  •    if idx.zero? && sidekiq_processes <= 1
    
  •      pid_file = fetch(:sidekiq_pid)
    
  •    else
    
  •      pid_file = fetch(:sidekiq_pid).gsub(/.pid$/, "-#{idx}.pid")
    
  •    end
    
  •    pid_file = fetch(:sidekiq_pid).gsub(/.pid$/, "-#{idx}.pid")
    

what serious problems ?


Reply to this email directly or view it on GitHub.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. I think this should be an option.
Instead of modifying the passed PID, which is quite unexpected, as @edslocomb mentioned,
why not just accept a pid of the form my-file-%d.pid and just sprintf on it?
It would work as well while staying explicit and avoid breaking things.
If this seems fine for you, I will send a PR, so let me know what you think.

yield(pid_file, idx)
end
end
Expand Down
4 changes: 1 addition & 3 deletions lib/capistrano/tasks/sidekiq.rake
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ namespace :sidekiq do
next unless host.roles.include?(role)
processes = fetch(:"#{ role }_processes") || fetch(:sidekiq_processes)
processes.times do |idx|
pids.push (idx.zero? && processes <= 1) ?
fetch(:sidekiq_pid) :
fetch(:sidekiq_pid).gsub(/\.pid$/, "-#{idx}.pid")
pids.push fetch(:sidekiq_pid).gsub(/\.pid$/, "-#{idx}.pid")
end
end

Expand Down