简体   繁体   中英

java.net.SocketException: Resource temporarily unavailable

Hi, We have two servers running simultaneously in the production environment. Sometimes, server1 throws an exception "java.net.SocketException: Resource temporarily unavailable". Below are the details,

Thanks in advance :)

Failed to connect to ssh server [10.0.0.0:22]
    org.apache.sshd.common.RuntimeSshException: Failed to get the session.
    at org.apache.sshd.client.future.DefaultConnectFuture.getSession(DefaultConnectFuture.java:43)
    at com.abc.OurSshClient.getSessionWithTimeOut(OurSshClient.java:328)
    at com.abc.OurSshClient.connect(OurSshClient.java:228)
    at com.abc.spi.ConnectionImpl.connectToServer(ConnectionImpl.java:92)
    at com.abc.spi.ConnectionImpl.<init>(ConnectionImpl.java:84)
    at com.abc.spi.ConnectionFactoryImpl.getInvalidConnections(ConnectionFactoryImpl.java:97)
    at com.abc.resource.pool.ConnectionPoolRegistry.runHeartBeatCheck(ConnectionPoolRegistry.java:303)
    at com.abc.resource.pool.ConnectionPoolRegistry$CheckConnectionThread.run(ConnectionPoolRegistry.java:498)
 Caused by: java.net.SocketException: Resource temporarily unavailable
    at sun.nio.ch.Net.connect0(Native Method)
    at sun.nio.ch.Net.connect(Net.java:484)
    at sun.nio.ch.Net.connect(Net.java:476)
    at sun.nio.ch.UnixAsynchronousSocketChannelImpl.implConnect(UnixAsynchronousSocketChannelImpl.java:326)
    at sun.nio.ch.AsynchronousSocketChannelImpl.connect(AsynchronousSocketChannelImpl.java:209)
    at org.apache.sshd.common.io.nio2.Nio2Connector.connect(Nio2Connector.java:53)
    at org.apache.sshd.SshClient.connect(SshClient.java:298)
    at org.apache.sshd.SshClient.connect(SshClient.java:284)
    at org.apache.sshd.SshClient.connect(SshClient.java:274)
    at com.abc.OurSshClient.getSessionWithTimeOut(OurSshClient.java:317)
    ... 6 more

private ClientSession getSession(int connectionTimeout) throws TimeoutException, IOException {
    ConnectFuture connection;
    boolean hasTimedOut = true;
    try {
        connection = this.client.connect(username, host, port);
        hasTimedOut = !connection.await(connectionTimeout);
    } catch (Exception e) {
        throw new IOException("Failed to connect", e);
    }
    if (hasTimedOut) {
        this.client.stop();
        this.client = null;
        this.clientStarted = false;
        throw new TimeoutException("TimeOut Exception while attempting to connect to [" + host + "]:[" + port + "]");
    }
    return connection.getSession();
}

We just changed the port ranges in eVip configuration file and it is working well now.

Thank you all :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM