[Backgroundrb-devel] Memory leaks in backgroundrb

Mike Aizatsky mike.aizatsky at gmail.com
Sat Jan 27 10:03:16 EST 2007


While debugging stale backgroundrb it became apparent that there're
memory leaks in it. Here's top object counts dump:

36715  String
 6211  Array
 5598  Proc
 3150  Hash
 1478  DRb::DRbObject
 1313  Regexp
 1272  Class
  750  Thread
  741  Socket
  739  Slave
  739  Slave::LifeLine
  737  Process::Status
  691  DrillReminderWorker
  391  Module
  160  Range
   75  Gem::Version
   73  XSD::QName

It's easy to see that loads of threads and slaves are present in the
process. It also has references to 691 workers!

In case there might be some problems with my worker here's its full code:

class DrillReminderWorker < BackgrounDRb::Worker::RailsBase

  def do_work(args)
    logger.info "DrillReminderSender started"
    t = Time.now.gmtime
    tsec = t.sec + t.min*60 + t.hour*60*60

    logger.info "utc seconds: #{tsec}"

    User.find_all_to_send_drill_reminder(tsec).each do |u|
      Notification.deliver_drill_reminder(u)
      u.update_attributes!(
        :drill_notification_last_send => TimeUtils.nowf
      )
    end

    logger.info "DrillReminderSender end"

    self.delete
  end

end
DrillReminderWorker.register


-- 
Regards,
Mike


More information about the Backgroundrb-devel mailing list