hello:
    accidentally,i find a problem than the zookeeper client print "too many 
open files" with server version 3.4.6, and i use the same java client version.
    the env is like this:the server running on server A, and the client running 
on server B(RHEL AS5), when i pull out the cable between them, the client print 
"too many open files" ,and network unreachable.
    i test if i shutdown the network interface,the same log was printed.
    i use lsof -p <pid>,i can see a lot of socket file handle.




    my code is as following:
   public class ZKTest {


/**
* @param args
* @throws IOException 
* @throws InterruptedException 
* @throws KeeperException 
*/
public static void main(String[] args) throws IOException, 
InterruptedException, KeeperException {
ZooKeeper zk = new ZooKeeper(args[0], 30000, new Watcher() {


@Override
public void process(WatchedEvent event) {
if(event.getState()==KeeperState.SyncConnected) {
System.out.println("connected...");
} else if(event.getState()==KeeperState.Disconnected) {
System.out.println("disconnected...");
} else if(event.getState()==KeeperState.Expired) {
System.out.println("expired...");
} else {
System.out.println("unknow " + event.getState());
}
}
});
zk.exists("/testpath", false);
Object o = new Object();
synchronized(o) {
o.wait();
}
}


}



Reply via email to