[Backgroundrb-devel] can't call any methods on workers

Stephen Weiss sweiss at stylesight.com
Thu Mar 20 21:07:39 EDT 2008

[ sorry if this went out twice, sent once but it didn't seem to go  
through ]


I'm a long time backgroundrb user, still stuck using the very ancient  
original version from Ezra (not even Ezra's 2.0 version, I'm using the  
one that didn't really have a version number).  The 2.0 version did  
very little but crash for me.  Anyway I finally got some time set  
aside to try out this new version you all have been developing.  I'm  
very excited about the new all_worker_info method on MiddleMan!  It  
should drastically improve the way my users can manage their  
background processes.

Unfortunately, I can't seem to get even the most basic worker to do  
anything.  I followed all the instructions for installation, and  
installed from SVN (I'm on OS X Tiger, it doesn't appear that there's  
a very good port for git out there without installing a package  
manager, which tend to screw up the rest of my computer).  I deleted  
my script/backgroundrb directory, and the old backgroundrb out of  
vendor plugins.  I checked out the SVN source and moved it into / 
vendor/plugins.  I installed all the appropriate gems (and my packet  
version is 0.1.5).

The server starts fine with this config:

  :port: 11006 # port to start listen
  :ip: # host to listen
  :environment: development # rails environment to load
  :log: foreground # foreground mode,print log messages on console

And I can start my test worker.  However, whenever I call any method  
on my test_worker, I get this error in backgroundrb_11006_debug.log:
00000004{:worker_method:process_batch:	type:
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.send_request
packet_master.rb:44:in `ask_worker'
backgroundrb/server/lib/master_worker.rb:104:in `process_work'
backgroundrb/server/lib/master_worker.rb:35:in `receive_data'
packet_parser.rb:29:in `call'
packet_parser.rb:29:in `extract'
backgroundrb/server/lib/master_worker.rb:31:in `receive_data'
packet_core.rb:212:in `read_external_socket'
packet_core.rb:204:in `handle_external_messages'
packet_core.rb:178:in `handle_read_event'
packet_core.rb:174:in `each'
packet_core.rb:174:in `handle_read_event'
packet_core.rb:130:in `start_reactor'
packet_core.rb:124:in `loop'
packet_core.rb:124:in `start_reactor'
packet_master.rb:21:in `run'
backgroundrb/server/lib/master_worker.rb:166:in `initialize'
script/backgroundrb:42:in `new'

It doesn't matter what's in the method, it could be empty and it still  
doesn't run (I am restarting backgroundrb after each modification - is  
this still necessary?).

Here's my test worker:

class BatchMakerWorker < BackgrounDRb::MetaWorker
  set_worker_name :batch_maker_worker
  def create(args = nil)
    # this method is called, when worker is loaded for the first time

  def process_batch


The rails code I'm using to test the worker looks like this:

    job_key = MiddleMan.new_worker(:class => :batch_maker_worker)
    worker = MiddleMan.worker(job_key)

Anyway, the only thing I could find on the error out there was this (http://pastie.caboo.se/pastes/167509 
), which someone posted yesterday.  This leads me to believe some bug  
got put on the SVN very recently, and at least one other person's in  
the same boat.

If anyone has a version that does work, or if anyone knows what wrong  
gem I'm using or what I'm doing wrong in general, I'd really  
appreciate it.  I only have a week or so I can devote to this before  
my boss puts me onto something else, and I'd *really* like to upgrade  
to something that's not twice-deprecated.

Machine runs OS X (client) 10.4.11, ruby 1.8.5

Thanks everyone!   Sorry about the super long e-mail...


More information about the Backgroundrb-devel mailing list