dtown
2007-May-31 23:45 UTC
[Backgroundrb-devel] background worker just stops running after some time
Hi,
I am fairly new to ruby/rails, but I thought I did a fair job of setting up
my background worker, but after some time, maybe 4-5 hours of running, it
just stops running, without any messages. Here is the yml file:
backgroundrb.yml
---
:port: 2000
:rails_env: production
:host: localhost
here is my schedules file:
alerts_task:
:class: :alerts_worker
:job_key: :alerts_key
:worker_method: :do_work
:trigger_args:
:start: <%= Time.now + 5.seconds %>
:repeat_interval: <%= 1.hour %>
and i start it by doing: />script/backgroundrb start
everytime the worker is called, I print an Iteration Time to the logger.
While checking on the worker, I noticed that it hadn''t run in several
hours
(i.e. the Iteration printout was several hours old). I looked at the
background_server.log, and everything looked fine, here is the last few
entries:
20070531-12:47:44 (678) Schedule triggered: #<struct #<Class:0x834cc74>
job=#<Proc:0x0847d238@/usr/local/www/mysite/vendor/plugins/backgroundrb/server/lib/backgroundrb/middleman.rb:336>,
trigger=#<BackgrounDRb::Trigger:0x8d669f8 @start_time=Thu May 31 10:47:44
-0700 2007, @repeat_interval=3600, @end_time=nil>, earliest=Thu May 31
12:47:44 -0700 2007, last=Thu May 31 12:47:44 -0700 2007>
20070531-13:47:44 (678) Schedule triggered: #<struct #<Class:0x834cc74>
job=#<Proc:0x0847d238@/usr/local/www/mysite/vendor/plugins/backgroundrb/server/lib/backgroundrb/middleman.rb:336>,
trigger=#<BackgrounDRb::Trigger:0x8d669f8 @start_time=Thu May 31 10:47:44
-0700 2007, @repeat_interval=3600, @end_time=nil>, earliest=Thu May 31
13:47:44 -0700 2007, last=Thu May 31 13:47:44 -0700 2007>
20070531-14:47:48 (678) Schedule triggered: #<struct #<Class:0x834cc74>
job=#<Proc:0x0847d238@/usr/local/www/mysite/vendor/plugins/backgroundrb/server/lib/backgroundrb/middleman.rb:336>,
trigger=#<BackgrounDRb::Trigger:0x8d669f8 @start_time=Thu May 31 10:47:44
-0700 2007, @repeat_interval=3600, @end_time=nil>, earliest=Thu May 31
14:47:44 -0700 2007, last=Thu May 31 14:47:44 -0700 2007>
and no error messages.
So I checked to see if the processes are still running, and I have:
$ps aux | grep ruby
mongrel 639 0.5 3.2 36000 32176 ?? S 10:47AM
2:28.13/usr/local/bin/ruby /usr/local/bin/mongrel_rai
mongrel 633 0.3 3.3 36820 32924 ?? S 10:47AM
2:41.17/usr/local/bin/ruby /usr/local/bin/mongrel_rai
mongrel 636 0.0 3.2 35888 32040 ?? S 10:47AM
2:33.56/usr/local/bin/ruby /usr/local/bin/mongrel_rai
root 678 0.0 0.2 39076 1816 ?? S 10:47AM 2:22.97 ruby:
backgroundrb (ruby)
root 679 0.0 0.0 20824 0 ?? IW - 0:00.00 ruby:
backgroundrb_logger (ruby)
root 681 0.0 0.0 20824 0 ?? IW - 0:00.00 ruby:
backgroundrb_results (ruby)
root 688 0.0 0.0 67288 0 ?? IW - 0:00.00 ruby:
alerts_worker_alerts_key (ruby)
root 2266 0.0 0.0 348 224 p0 R+ 4:42PM 0:00.00 grep ruby
I have thought of having a sleep call inside my do_work, but I dont like
that...i want to keep my design as simple as possible.
Does anyone have any ideas?
thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20070531/378d6c75/attachment.html
