我们的应用程序“有时”超时,我们有一个Java客户端连接到一个unix守护进程,由于某种原因它现在又一次抛出以下错误:SocketChannel - java.net.ConnectException:连接超时:连接
SocketException: Cannot establish connection to daemon
java.net.ConnectException: Connection timed out: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
at java.nio.channels.SocketChannel.open(Unknown Source)
at ....
at java.lang.Thread.run(Unknown Source)
此堆栈跟踪是从下面的代码:
try
{
InetSocketAddress inetAddress = new InetSocketAddress(InetAddress.getByName(serverName), serverPort);
socketChannel = SocketChannel.open(inetAddress); // <--- I think the problem is here
pipeSck = socketChannel.socket();
}
catch (NoRouteToHostException e)//when the remote host cannot be reached or connection was refused
{
System.err.println("NoRouteToHostException: Cannot establish connection to daemon");
e.printStackTrace();
return 1; /* reply only with error */
}
catch (SocketException e)//when the remote host cannot be reached or connection was refused
{
System.err.println("SocketException: Cannot establish connection to daemon");
e.printStackTrace();
return 1; /* reply only with error */
}
这个工程的99%的时间......任何想法,为什么我们得到的超时?
谢谢!
根据我的其他评论,积压目前被设置为10(并且已经大约15年)。我们的客户现在有更多的用户,所以它看起来终于达到了极限。 – Samah
@Samah没有办法可以告诉实际的值没有偷看内核,但平台有其自己的最小值,并且它几乎肯定会将该值提高到至少为50. – EJP
它运行Solaris 10,并根据此:http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/topic/com.ibm.websphere.express.doc/info/exp/ae/tprf_tunesolaris.html默认积压是128.如果它默默地增加它到最低限度,我不知道那会是什么。编辑:运行这个说“1”,但我不知道如果我看着正确的参数:ndd -get/dev/tcp tcp_conn_req_min' – Samah