mike bukhin
2008-Mar-04 21:27 UTC
[Backgroundrb-devel] Cleaing up after workers in backgroundrb
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(). thanks -- Mike Bukhin Interactive Telecommunications Program - ''07
hemant kumar
2008-Mar-06 07:30 UTC
[Backgroundrb-devel] Cleaing up after workers in backgroundrb
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.
Rue Turner
2008-Mar-06 07:40 UTC
[Backgroundrb-devel] Cleaing up after workers in backgroundrb
On Thu, 2008-03-06 at 13:00 +0530, hemant kumar wrote:> 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. > > > _______________________________________________ > 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/20080306/95941546/attachment.html
mike bukhin
2008-Mar-06 13:43 UTC
[Backgroundrb-devel] Cleaing up after workers in backgroundrb
I just remember that in the older version of backgroundrb I was having memory/performance issues until I added self.delete to do_work. Then those problems went away. My worker is very simple: class ContextWorker < BackgrounDRb::MetaWorker set_worker_name :context_worker pool_size 5 def create(args = nil) end def process_context(context_id) require ''context_update'' @r_update = ContextUpdate.new(Time.now) @r_update.load_public_context(context_id) end end The bulk of the code is in libraries. So you''re saying I self.delete is the same as putting exit after @r_update.load_public_context(context_id)? thanks! On Thu, Mar 6, 2008 at 2:30 AM, hemant kumar <gethemant at gmail.com> wrote:> > > 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. > > >-- Mike Bukhin Interactive Telecommunications Program - ''07
hemant kumar
2008-Mar-06 14:27 UTC
[Backgroundrb-devel] Cleaing up after workers in backgroundrb
On Thu, 2008-03-06 at 08:43 -0500, mike bukhin wrote:> I just remember that in the older version of backgroundrb I was having > memory/performance issues until I added self.delete to do_work. Then > those problems went away. My worker is very simple: > > class ContextWorker < BackgrounDRb::MetaWorker > > set_worker_name :context_worker > pool_size 5 > > > def create(args = nil) > > end > > def process_context(context_id) > require ''context_update'' > @r_update = ContextUpdate.new(Time.now) > @r_update.load_public_context(context_id) > end > > end > > > The bulk of the code is in libraries. So you''re saying I self.delete > is the same as putting exit after > @r_update.load_public_context(context_id)? >As far as I remember self.delete used to delete/exit the current worker. "exit" does the same thing in newer version.