[Backgroundrb-devel] Cleaing up after workers in backgroundrb

hemant kumar gethemant at gmail.com
Thu Mar 6 02:30:52 EST 2008


On Tue, 2008-03-04 at 16:27 -0500, mike bukhin wrote:
> Hi there--
> 
> I just updated to the latest build of Backgroundrb and am hitting up
> against a memory leak because my workers aren't cleaning up.  My code
> concurrently pulls a large number of images using RMagick.  I thought
> the problem was with RMagick but after putting in some garbage
> collection code when pulling an image, my code runs well from irb.
> When wrapped with backgroundrb, it eventually hangs.
> 
> In the old backgroundrb I had a self.delete at the end of do_work to
> clean up.  Now my setup is a little different:
> 
> MiddleMan.worker(:context_worker).process_context(id)
> 
> and then
> 
> class ContextWorker < BackgrounDRb::MetaWorker
> 
>   set_worker_name :context_worker
>   pool_size 1
> 
> 
>   def create(args = nil)
> 
>   end
> 
>   def process_context(id)
> 
>      do_stuff()
> 
>   end
> 
> end
> 
> How do I clean up after process_context().
> 

You can still call, 'exit' at the end of worker to finish up execution
of task.

And what you mean by 'cleanup' actually? RMagick is one heck of a
library to work with, but if it works at irb prompt, should work in
BackgrounDRb worker too. Send us the worker code, and we will see whats
going wrong.




More information about the Backgroundrb-devel mailing list