Search code examples
ruby-on-railscentossidekiqdigital-ocean

Sidekiq got killed for no reason


I am having problem with Sidekiq, when Worker starts, the process gets killed.

[deploy@server svr]$ bundle exec sidekiq -e production
2014-05-22T07:49:33Z 4043 TID-18mgoy INFO: Running in ruby 2.1.1p76 (2014-02-24 revision 45161) [i686-linux]
2014-05-22T07:49:33Z 4043 TID-18mgoy INFO: See LICENSE and the LGPL-3.0 for licensing details.
2014-05-22T07:49:33Z 4043 TID-18mgoy INFO: Starting processing, hit Ctrl-C to stop
2014-05-22T07:49:33Z 4043 TID-1sux8k INFO: Booting Sidekiq 3.0.0 with redis options {}

I will then run a process that trigger workers from my Rails App

2014-05-22T07:49:59Z 4043 TID-1e780u S3Worker JID-8c862be58af968fa8b84aedf INFO: start
2014-05-22T07:49:59Z 4043 TID-1e3ye4 S3Worker JID-79c585fbd3c7000a5a6fbf95 INFO: start
2014-05-22T07:49:59Z 4043 TID-1e1i6k S3Worker JID-d62d41b13f2dd4849d4cc887 INFO: start
Killed
[deploy@server svr]$

This is my Worker Code, the purpose of the Worker is to upload images to S3 from a remote location.

class S3Worker
   include Sidekiq::Worker

   def perform(id, url)
      @image = Image.new(post_id: id)
      @image.remote_image_url = url

      if @image.save
         logger.info "Image Uploaded to S3"
      end
   end
end

I am running this server at Digital Ocean on Centos 6.5 with 512MB RAM, Rails4 Application. I am guessing that the problem might be related to my lack of RAM. Can anyone advice me on how to tackle this problem?

  • Additional note, if I access the Sidekiq Dashboard, the Workers does not even get into "Busy", it will just disappear, not "Failed" or "Processed"

Thank you in advance!


Solution

  • Yes, you need more RAM. Try using -c 5 to shrink Sidekiq's memory usage a bit.