[Backgroundrb-devel] failed to find slave socket - (RuntimeError)

Alessio Bernesco Làvore bernesco at muteki.it
Thu Feb 22 09:29:39 EST 2007


Hi everyone,

I've a class that try to spawn two workers, every 5 seconds.

The code is something like:

while true do
	MiddleMan.new_worker(:class => :researches_worker,:job_key  
=> :researches)
	MiddleMan.new_worker(:class => :products_worker,:job_key => :products)
	sleep(5)
end

I'm using ":job_key", so if a worker hasn't already ended its work  
after five seconds, it's not duplicated.

The code inside the worker is something like:

class ResearchesWorker < BackgrounDRb::Worker::RailsBase
	def do_work(args)
		completed = RunningResearch.find(:all,:conditions => ["endtime  
< ?",Time.now])
		for complete in completed
			complete.complete
		end
		self.delete
	end
end
ResearchesWorker.register

After 4 or 5 minutes of working, the worker stops to respond and i've  
this error in the log file:

20070222-15:13:37 (15574) failed to find slave socket - (RuntimeError)
20070222-15:13:37 (15574) /usr/local/lib/ruby/gems/1.8/gems/ 
slave-1.2.0/lib/slave.rb:435:in `initialize'
20070222-15:13:37 (15574) /Users/abernesco/Documents/ruby/alfaomega/ 
vendor/plugins/backgroundrb/server/lib/backgroundrb/middleman.rb: 
210:in `new'
20070222-15:13:37 (15574) /Users/abernesco/Documents/ruby/alfaomega/ 
vendor/plugins/backgroundrb/server/lib/backgroundrb/middleman.rb: 
210:in `new_worker'
20070222-15:13:37 (15574) /Users/abernesco/Documents/ruby/alfaomega/ 
vendor/plugins/backgroundrb/server/lib/backgroundrb/thread_pool.rb: 
36:in `dispatch'
20070222-15:13:37 (15574) /Users/abernesco/Documents/ruby/alfaomega/ 
vendor/plugins/backgroundrb/server/lib/backgroundrb/thread_pool.rb: 
22:in `initialize'
20070222-15:13:37 (15574) /Users/abernesco/Documents/ruby/alfaomega/ 
vendor/plugins/backgroundrb/server/lib/backgroundrb/thread_pool.rb: 
22:in `new'
20070222-15:13:37 (15574) /Users/abernesco/Documents/ruby/alfaomega/ 
vendor/plugins/backgroundrb/server/lib/backgroundrb/thread_pool.rb: 
22:in `dispatch'
20070222-15:13:37 (15574) /Users/abernesco/Documents/ruby/alfaomega/ 
vendor/plugins/backgroundrb/server/lib/backgroundrb/middleman.rb: 
199:in `new_worker'


I've try to keep the workers class as simple and light as i can...  
any advice about?

Thanks,
ale.


More information about the Backgroundrb-devel mailing list