[Backgroundrb-devel] Problem with worker servers

Daniel Lockhart daniel at newzwag.com
Fri Jul 25 16:59:33 EDT 2008

Thanks again for your help.  I discovered what the problem was; I had  
receive_data defined in a module that was included in the handler  
class.  Apparently this was not getting called (I am guessing the way  
in which packet determines whether the method exists in the handler  
class changed, or the order in which modules are mixed in changed).   
Either way, moving the method directly into the handler class seems to  
have solved the problem.  Thank you again for your help, I really love  

On Jul 25, 2008, at 1:28 PM, hemant wrote:

> On Sat, Jul 26, 2008 at 1:31 AM, Daniel Lockhart  
> <daniel at newzwag.com> wrote:
>> Both servers are RHLE, one Red Hat 5, the other 4.  The kernel on  
>> the 4 is
>> 2.6.9-55.0.9.ELsmp which is 32 bit.  The kernel on the 5 is  
>> 2.6.18-92.el5,
>> which is 64 bit.
> Okay, I am assuming one of the workers is starting the server and
> perhaps other worker uses #connect to connect to the server started on
> previous worker, right?
> What might be happening is, when next worker attempts to connect, it
> may not find server up yet, hence you need to make reconnect attempt.
> This is of course, complete guess work, but for example:
> class Bar
>  def receive_data p_data
>    send_data(p_data)
>  end
>  def connection_completed
>    puts "whoa man"
>  end
>  # will be automatically called when server refuses the connection,
> lets try to reconnect after 10 seconds
>  # if reconnect fails unbind will be automatically called and next
> attempt will be made after 10 seconds.
>  def unbind
>    add_timer(10) { reconnect("localhost",2981,Bar) }
>  end
> end
> class FooWorker < BackgrounDRb::MetaWorker
>  set_worker_name :foo_worker
>  def create(args = nil)
>    # this method is called, when worker is loaded for the first time
>    connect("localhost",2981,Bar)
>  end
> end
> Also, there was a problem with add_timer.. when used within tcp
> connections like that, hence I had to release a new version of packet
> (0.1.10, its up on rubyforge.org).
> Let me know, if this fixes your problem.

More information about the Backgroundrb-devel mailing list