[Backgroundrb-devel] Backgroundrb keeps spawning processes

Mason Hale masonhale at gmail.com
Mon Jan 15 12:01:43 EST 2007


I've seen the same behavior before too. I found one needs to add a "
self.delete" at the end of the do_work method, for the process to terminate
after it's done doing its work.

Mason

On 1/15/07, Mike Aizatsky <mike.aizatsky at gmail.com> wrote:
>
> Hi!
>
> I've just a created a really simple rails scheduled worker for
> backgroundrb to start playing with :
>
> class SessionCleanerWorker < BackgrounDRb::Worker::RailsBase
>
>   def do_work(args)
>     logger.info "SessionCleaner> started"
>
>     CGI::Session::ActiveRecordStore::Session.destroy_all( ['updated_at
> <?', 120.minutes.ago] )
>     LoginToken.destroy_expired
>
>     logger.info "SessionCleaner> done"
>   end
>
> end
> SessionCleanerWorker.register
>
>
> It indeed works, and is being executed in the same process:
>
> 20070115-19:00:00 (6172) SessionCleaner> started
> 20070115-19:00:00 (6172) SessionCleaner> done
> 20070115-19:10:00 (6172) SessionCleaner> started
> 20070115-19:10:00 (6172) SessionCleaner> done
>
> However backgroundrb keeps spawning ruby processes for some strange
> reason without mentioning their ids in the log file:
>
> 20070115-18:50:00 (6171) Schedule triggered: #<struct
> #<Class:0x7773b0>
>
> job=#<Proc:0x0062fd2c@/u/apps/learnbyrote/releases/20070115150803/vendor/plugins/backgroundrb/server/lib/backgroundrb/middleman.rb:355>,
> trigger=#<BackgrounDRb::CronTrigger:0x28a2440 @min=[0, 10, 20, 30, 40,
> 50], @month=1..12, @hour=0..23, @year=nil, @day=1..31, @cron_expr="0
> 0,10,20,30,40,50 * * * * *", @sec=[0], @wday=0..6>, earliest=Mon Jan
> 15 18:50:00 +0300 2007, last=Mon Jan 15 18:50:00 +0300 2007>
> 20070115-18:50:00 (6171) Starting worker: session_cleaner_worker
> ceb1eb03562acb8cb9c866320084383d
> (session_cleaner_worker_ceb1eb03562acb8cb9c866320084383d) ()
> 20070115-19:00:00 (6171) Schedule triggered: #<struct
> #<Class:0x7773b0>
>
> job=#<Proc:0x0062fd2c@/u/apps/learnbyrote/releases/20070115150803/vendor/plugins/backgroundrb/server/lib/backgroundrb/middleman.rb:355>,
> trigger=#<BackgrounDRb::CronTrigger:0x28a2440 @min=[0, 10, 20, 30, 40,
> 50], @month=1..12, @hour=0..23, @year=nil, @day=1..31, @cron_expr="0
> 0,10,20,30,40,50 * * * * *", @sec=[0], @wday=0..6>, earliest=Mon Jan
> 15 19:00:00 +0300 2007, last=Mon Jan 15 19:00:00 +0300 2007>
> 20070115-19:00:00 (6171) Starting worker: session_cleaner_worker
> bf18c891526f3d7d979ddb40642c0558
> (session_cleaner_worker_bf18c891526f3d7d979ddb40642c0558) ()
> ^[OC20070115-19:10:00 (6171) Schedule triggered: #<struct
> #<Class:0x7773b0>
>
> job=#<Proc:0x0062fd2c@/u/apps/learnbyrote/releases/20070115150803/vendor/plugins/backgroundrb/server/lib/backgroundrb/middleman.rb:355>,
> trigger=#<BackgrounDRb::CronTrigger:0x28a2440 @min=[0, 10, 20, 30, 40,
> 50], @month=1..12, @hour=0..23, @year=nil, @day=1..31, @cron_expr="0
> 0,10,20,30,40,50 * * * * *", @sec=[0], @wday=0..6>, earliest=Mon Jan
> 15 19:10:00 +0300 2007, last=Mon Jan 15 19:10:00 +0300 2007>
> 20070115-19:10:00 (6171) Starting worker: session_cleaner_worker
> ba173e9ecb22443bce084fac06545413
> (session_cleaner_worker_ba173e9ecb22443bce084fac06545413) ()
>
>
> and there're dozens of child ruby processes spawned from 6171
> according to my activity monitor. Any idea how can this be traced down
> and/or fixed?
>
> --
> Regards,
> Mike
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20070115/528f3fcf/attachment.html 


More information about the Backgroundrb-devel mailing list