[jboss-jira] [JBoss JIRA] Created: (JGRP-1368) RPC calls during view updates

Andrey Vorobiev (JIRA) jira-events at lists.jboss.org
Thu Sep 22 10:47:26 EDT 2011


RPC calls during view updates
-----------------------------

                 Key: JGRP-1368
                 URL: https://issues.jboss.org/browse/JGRP-1368
             Project: JGroups
          Issue Type: Bug
    Affects Versions: 3.0
         Environment: Java version: 1.6.0_22
JGroups: 3.0.0.CR1
            Reporter: Andrey Vorobiev
            Assignee: Bela Ban


Environment consists of one server node and several client nodes. When new client node joins group I should call some remote method on it from server node.

Client node source code:

import org.jgroups.*;
import org.jgroups.blocks.RpcDispatcher;

public class Client extends ReceiverAdapter{
   public void start() throws Exception{
       JChannel channel = new JChannel();
       RpcDispatcher dispatcher = new RpcDispatcher(channel, this, this, this);
       channel.connect("cluster");
   }
   public String doIt(String arg){
       System.out.println("Client called: " + arg);
       return arg;
   }
   public static void main(String[] args) throws Exception{
       new Client().start();
   }
}

Server node source code:
import java.util.*;
import org.jgroups.*;
import org.jgroups.blocks.*;
import org.jgroups.util.*;

public class Server extends ReceiverAdapter{
   JChannel channel;
   RpcDispatcher dispatcher;

   public void start() throws Exception{
       channel = new JChannel();
       dispatcher = new RpcDispatcher(channel, null, this, this);
       channel.connect("cluster");
   }
   public void viewAccepted(View view){
       try
       {
           System.out.println("view accepted: " + view);
           if (channel.isConnected())
           {
               callClients(view);
           }
       }
       catch (Throwable e)
       {
           e.printStackTrace();
       }
   }
   public void callClients(View view) throws Exception{
       MethodCall call = new MethodCall("doIt", new Object[]{ "Hello world" }, new Class[]{String.class});
       RspList<String> rsp = dispatcher.callRemoteMethods(filter(view.getMembers()), call, new RequestOptions(ResponseMode.GET_ALL, 10000));
       for (Map.Entry<Address, Rsp<String>> pair : rsp.entrySet())
       {
           System.out.println(pair.getKey() + " -- " + pair.getValue().getValue());
       }
   }
   public Collection<Address> filter(Collection<Address> addresses){
       Collection<Address> result = new ArrayList<Address>();
       for (Address address : addresses)
       {
           if (!address.equals(dispatcher.getChannel().getAddress()))
           {
               result.add(address);
           }
       }
       return result;
   }
   public String doIt(String arg){
       System.out.println("Server called: " + arg);
       return arg;
   }
   public static void main(String[] args) throws Exception{
       new Server().start();
   }
}

If client node is started before server one everything work as expected.
But when server node is started before client one I observe following
in stdout from server node:

Sep 16, 2011 5:15:54 PM org.jgroups.logging.JDKLogImpl info
INFO: JGroups version: 3.0.0.CR1
Sep 16, 2011 5:15:54 PM org.jgroups.logging.JDKLogImpl warn
WARNING: receive buffer of socket java.net.DatagramSocket at 7c6572b was
set to 20MB, but the OS only allocated 65.51KB. This might lead to
performance problems. Please set your max receive buffer in the OS
correctly (e.g. net.core.rmem_max on Linux)
Sep 16, 2011 5:15:54 PM org.jgroups.logging.JDKLogImpl warn
WARNING: receive buffer of socket java.net.MulticastSocket at 6e84cc09
was set to 25MB, but the OS only allocated 65.51KB. This might lead to
performance problems. Please set your max receive buffer in the OS
correctly (e.g. net.core.rmem_max on Linux)

-------------------------------------------------------------------
GMS: address=andrey-8222, cluster=cluster, physical address=10.0.1.197:65216
-------------------------------------------------------------------
view [andrey-8222|0] [andrey-8222]
connected true
method called
[]
view [andrey-8222|1] [andrey-8222, andrey-63112]
connected true
Sep 16, 2011 5:16:17 PM org.jgroups.logging.JDKLogImpl warn
WARNING: andrey-8222: failed to collect all ACKs (expected=1) for view
[andrey-8222|1] [andrey-8222, andrey-63112] after 2000ms, missing ACKs
from [andrey-8222]
method called
[]
andrey-63112 -- null
Server called: Hello world

I'm confused by the following:
- server nodes tries to receive ACKs from itself (missing ACKs from [andrey-8222])
- rpc dispatcher calls server node (Server called: Hello world)

I can work around this issue by doing rpc call in separate thread. By in this case I sometimes receive null as call result from some nodes with following messages in client logs: no physical address for xxx.

Also I have some general questions about RPC dispatcher:
- are rpc calls supported during view update?
- what conditions I should wait for in order to guarantee rpc dispatcher's correct behavior?
 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list