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

Stephen Weiss sweiss at stylesight.com
Thu Mar 20 15:06:12 EDT 2008


Hi,

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:

:backgroundrb:
   :port: 11006 # port to start listen
   :ip: 0.0.0.0 # 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:
                                                                              do_work
worker_methodprocess_batchtypedo_work
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.send_request
/usr/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_master.rb:44:in `ask_worker'
/Users/sweiss/Documents/workspace/RACE-local/vendor/plugins/ 
backgroundrb/server/lib/master_worker.rb:104:in `process_work'
/Users/sweiss/Documents/workspace/RACE-local/vendor/plugins/ 
backgroundrb/server/lib/master_worker.rb:35:in `receive_data'
/usr/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_parser.rb:29:in `call'
/usr/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_parser.rb:29:in `extract'
/Users/sweiss/Documents/workspace/RACE-local/vendor/plugins/ 
backgroundrb/server/lib/master_worker.rb:31:in `receive_data'
/usr/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:212:in `read_external_socket'
/usr/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:204:in `handle_external_messages'
/usr/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:178:in `handle_read_event'
/usr/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:174:in `each'
/usr/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:174:in `handle_read_event'
/usr/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:130:in `start_reactor'
/usr/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:124:in `loop'
/usr/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:124:in `start_reactor'
/usr/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_master.rb:21:in `run'
/Users/sweiss/Documents/workspace/RACE-local/vendor/plugins/ 
backgroundrb/server/lib/master_worker.rb:166:in `initialize'
script/backgroundrb:42:in `new'
script/backgroundrb:42

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
   end

   def process_batch

   end
end


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)
     worker.process_batch

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...

--
Steve


More information about the Backgroundrb-devel mailing list