-
Bug
-
Resolution: Won't Do
-
Major
-
3.0
-
None
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
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())
}
catch (Throwable e)
}
public void callClients(View view) throws Exception{
MethodCall call = new MethodCall("doIt", new Object[]
, 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())
}
public Collection<Address> filter(Collection<Address> addresses){
Collection<Address> result = new ArrayList<Address>();
for (Address address : addresses)
{
if (!address.equals(dispatcher.getChannel().getAddress()))
}
return result;
}
public String doIt(String 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@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@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?