我們的應用程序「有時」超時,我們有一個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