[Backgroundrb-devel] Cannot connect when spawning new workers on demand

hemant gethemant at gmail.com
Tue Jan 22 04:48:11 EST 2008


Hi,

On Jan 22, 2008 1:59 PM, Ger Apeldoorn <gapeldoorn at wehkamp.nl> wrote:
> Hi!
>
> I'm using the latest&greatest backgroundrb with rails 2.0.2 on ubuntu
> dapper.
>
> I've made an app that lets you run a query on several servers at once,
> which are selected at runtime. Therefore, for each server that is
> selected, I spawn a new worker and assign its work.
> After everything is completed, the workers are deleted.
>
> I often get this error:
> BackgrounDRb::BdrbConnError in Multi com/indexController#uitvoeren
> Not able to connect
>
> Here's the code that spawns the workers: (sorry for the linewraps)
>
>   def uitvoeren
>     # put selected servers in a session
>     session[:selectedservers] = params[:servers]
>     session[:running_cmd] = 1
>     @selected_servers = System.find_all_by_id(params[:servers])
>     @selected_servers.each do |svr|
>       # spawn new process
>       MiddleMan.new_worker(:worker => :remote_command_worker, :job_key
> => svr.name)
>       MiddleMan.ask_work(:worker => :remote_command_worker, :job_key =>
> svr.name, :worker_method => :do_work, :data => {:svr =>
> svr.name, :command =>
> MultiComCommand.find_by_id(params[:commando]).command})
>     end
>   end
>
> When I select only a few servers, it works just fine! There is no
> definable threshold, I've had failures with only 4 servers selected and
> success with 12 servers selected.
>
> After such a connection error, the worker processes are still running:
> $ ps -ef | grep worker
> 09:08 ?        00:00:00 ruby log_worker
> 09:08 ?        00:00:00 ruby remote_command_worker
> 09:08 ?        00:00:00 ruby remote_command_worker
> 09:08 ?        00:00:00 ruby remote_command_worker
> 09:08 ?        00:00:00 ruby remote_command_worker
> 09:08 ?        00:00:00 ruby remote_command_worker
>
> Your help is VERY MUCH appreciated!

Did you check backgroundrb_debug.log ?
You can turn on debugging to foreground with:

:log: foreground

option to further debug this. Something is killing BackgrounDRb master
process. Can you sync with trunk and enable foreground logging and
check on this?

Also, if possible, can we see your worker code?


More information about the Backgroundrb-devel mailing list