[Backgroundrb-devel] [BUG] worker stopping abruptly

Jodi Showers jodi at nnovation.ca
Wed Apr 18 12:56:16 EDT 2007


> On 18-Apr-07, at 11:01 AM, hemant wrote:
>
>> On 4/18/07, hemant <gethemant at gmail.com> wrote:
>>> I have been facing this damn ugly issue since quite sometime.
>>>
>>> So this worker reads RSS feed from Yahoo news and stores it in a DB.
>>> The worker is scheduled to run at every 40 minutes and my
>>> background_schedules.yml looks like this:
>>>
>>> feed_worker:
>>>   :class: :feed_worker
>>>   :job_key: :feed_worker_key
>>>   :worker_method: :do_work
>>>   :trigger_args:
>>>     :start: <%= Time.now + 5 %>
>>>     :repeat_interval: <%= 40*60 %>
>>>
>>> So story is, worker stops working suddenly. no exception thrown  
>>> either
>>> in background.log or background_server.log.
>>>
>>> To also, to make sure that backgroundrb threads doesn't eat my
>>> excpetion my code looks like this:
>>>
>>> def do_work(args)
>>>   begin
>>>     logger.info "Starting the Yahoo feed worker on : #{Time.now}"
>>>     yahoo_url = "http://finance.yahoo.com/rss/headline?s="
>>>     symbol_list = NasdaqSymbols.find_all()
>>>
>>>     symbol_list.each do|sym|
>>>       temp_sym = sym.symbol.strip
>>>       temp_url = yahoo_url + temp_sym
>>>       get_feeds(temp_url,temp_sym) rescue next
>>>     end
>>>   rescue
>>>     logger.info $!
>>>     logger.info $!.backtrace
>>>   end
>>> end
>>>
>>> ^^^ could be naive, but the point is, why worker stops suddenly
>>> without any errors? Earlier I thought, may be logging has bug and
>>> worker is still running. But a quick check from database says
>>> otherwise.
>>>
>>> Following a full text of backgroundrb.log file:
>>>
>>>
>>> 20070417-15:51:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Tue Apr 17 15:51:01 +0530 2007
>>> 20070417-16:31:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Tue Apr 17 16:31:01 +0530 2007
>>> 20070417-17:11:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Tue Apr 17 17:11:01 +0530 2007
>>> 20070417-17:51:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Tue Apr 17 17:51:01 +0530 2007
>>> 20070417-18:31:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Tue Apr 17 18:31:01 +0530 2007
>>> 20070417-19:11:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Tue Apr 17 19:11:01 +0530 2007
>>> 20070417-19:51:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Tue Apr 17 19:51:01 +0530 2007
>>> 20070417-20:31:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Tue Apr 17 20:31:01 +0530 2007
>>> 20070417-21:11:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Tue Apr 17 21:11:01 +0530 2007
>>> 20070417-21:51:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Tue Apr 17 21:51:01 +0530 2007
>>> 20070417-22:31:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Tue Apr 17 22:31:01 +0530 2007
>>> 20070417-23:11:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Tue Apr 17 23:11:01 +0530 2007
>>> 20070417-23:51:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Tue Apr 17 23:51:01 +0530 2007
>>> 20070418-00:31:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 00:31:01 +0530 2007
>>> 20070418-01:11:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 01:11:01 +0530 2007
>>> 20070418-01:51:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 01:51:01 +0530 2007
>>> 20070418-02:31:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 02:31:01 +0530 2007
>>> 20070418-03:11:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 03:11:01 +0530 2007
>>> 20070418-03:51:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 03:51:01 +0530 2007
>>> 20070418-04:31:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 04:31:01 +0530 2007
>>> 20070418-05:11:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 05:11:01 +0530 2007
>>> 20070418-05:51:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 05:51:01 +0530 2007
>>> 20070418-06:31:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 06:31:01 +0530 2007
>>> 20070418-07:11:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 07:11:01 +0530 2007
>>> 20070418-07:51:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 07:51:01 +0530 2007
>>> 20070418-08:31:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 08:31:01 +0530 2007
>>> 20070418-09:11:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 09:11:01 +0530 2007
>>> 20070418-09:51:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 09:51:01 +0530 2007
>>> 20070418-10:31:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 10:31:01 +0530 2007
>>> 20070418-11:11:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 11:11:01 +0530 2007
>>> 20070418-11:51:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 11:51:01 +0530 2007
>>> 20070418-12:31:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 12:31:01 +0530 2007
>>> 20070418-13:11:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 13:11:01 +0530 2007
>>> 20070418-13:51:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 13:51:01 +0530 2007
>>> 20070418-14:31:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 14:31:01 +0530 2007
>>> 20070418-15:11:01 (22525) ***** Starting the Yahoo feed worker on  
>>> Time
>>> : Wed Apr 18 15:11:01 +0530 2007
>>>
>>
>> Another quick check in form of "ps aux|grep back" shows backgroundrb
>> running, but sadly feed worker didn't do its iteration after 3:11 PM.
>> woops.
>>
>> the other log(s) are empty as well?
>>
>> are you killing the worker every time? (self.delete). If not you may
>> be running out of resources.
>>
>> have you monitored ram (other resources) while it's running?
>>
>>
>
> I am not deleting them, because I thought, creating a new worker, each
> time would be a overhead. But I am not having an issues with RAM and
> all. I have couple of workers running all the time,in some i use
> self.delete or exit and in some I don't.

others with more fu than myself can help you with the implications of  
not deleting the worker. Why wouldn't you always terminate your  
workers in the same manner? My advice would be to be less loose and  
more particular when terminating.

++ you really should reply to the group. Others can benefit from  
documenting your challenge.

cheers,
Jodi

> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel



More information about the Backgroundrb-devel mailing list