java.net.coonectexception:coonection refused:no further toinformation

牛人给看看:大量客户端socket连接netty服务器时出现Connection refused: connect异常 - ITeye问答
最近打算用netty写一个服务器,在压力测试时,模拟大量客户端socket连接netty服务器(1w的socket连接),结果有1/4的连接成功,3/4的连接失败,异常如下:
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.$$YJP$$socketConnect(Native Method)
at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at com.towords.client.simulate.SocketClient.run(SocketClient.java:38)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
大家帮忙看看。。。
测试客户端和服务器都是在本机测试,不是dns的问题,现在考虑有没有可能是下面的情况:
1.socket连接有限制,但是1w个连接不算多吧,而且异常信息是Connection refused,看起来像是服务端的问题
2.我机子的配置不高,有没有可能是机子的性能影响netty的boss线程限制客户端的连接呢?
或者是其他的情况??
我机子的配置:
Intel 奔腾 TGHZ * 2
内存3G
测试服务器的JVM参数:(客户端的参数也基本一样)
-Xmx1200m
-Xms1200m
-XX:NewSize=1g
-XX:MaxNewSize=1g
-XX:SurvivorRatio=8
-XX:PermSize=30m
-XX:MaxPermSize=100m
问题补充:代码和官方的例子基本上一样
确认下客户端与服务端是不是都是使用的NIO,如果都是NIO的话,会产生很多Selector,而Selector在window上的实现是基于连接的,一个selector会占用两个本地端口
我今天也碰到这个问题,200个并发socket连接是好使的,没有问题。
当超过300个,就会出现:
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at java.net.Socket.&init&(Socket.java:375)
at java.net.Socket.&init&(Socket.java:189)
at com.thunisoft.service.Service.query(Service.java:29)
at Test.getPayInfo(Test.java:19)
at Test.run(Test.java:33)
应该是服务器的配置问题,还有机器性能问题。
socket连接是同步的,netty是异步的,client连接上后,nettyServer接收数据,接收完后就将channel关闭了,client connection也就不存在了,就会refused,
怎么保证客户端不变,netty接收数据后保持channel还存活,是个问题,我也在研究!可以看一下channelFuture,可能只能用这个来处理,异步返回后回调
已解决问题
未解决问题Re: Client Error: &java.net.ConnectException: Connection refused: no further information& after update HBase-0.20.6 to HBase0.90.2
hbase-user mailing list archives
Message view
陈加俊 &cjjvict...@&
Re: Client Error: &java.net.ConnectException: Connection refused: no further information& after update HBase-0.20.6 to HBase0.90.2
Soryy I had make a mistake at hbase.zookeeper.property.clientPort
On Tue, Apr 12, 2011 at 1:08 PM, 陈加俊 && wrote:
& WARN : 04-12 12:54:13 Session 0x0 for server null, unexpected error,
& closing socket connection and attempting reconnect
& java.net.ConnectException: Connection refused: no further information
& at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:574)
& at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1119)
& WARN : 04-12 12:54:14 Session 0x0 for server null, unexpected error,
& closing socket connection and attempting reconnect
& java.net.ConnectException: Connection refused: no further information
& at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:574)
& at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1119)
& WARN : 04-12 12:54:16 Session 0x0 for server null, unexpected error,
& closing socket connection and attempting reconnect
& java.net.ConnectException: Connection refused: no further information
& at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:574)
& at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1119)
& Thanks & Best regards
Thanks & Best regards
Unnamed multipart/alternative (inline, None, 0 bytes)
(inline, Quoted Printable, 1476 bytes)WARN : 04-12 12:54:13 Session 0x0 for server null, unexpected error, closingsocket connection and attempting reconnectjava.net.ConnectException: Connection refused: no further informationat sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:574)at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1119)WARN : 04-12 12:54:14 Session 0x0 for server null, unexpected error, closingsocket connection and attempting reconnectjava.net.ConnectException: Connection refused: no further informationat sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:574)at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1119)WARN : 04-12 12:54:16 Session 0x0 for server null, unexpected error, closingsocket connection and attempting reconnectjava.net.ConnectException: Connection refused: no further informationat sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:574)at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1119)--Thanks & Best regardsjiajun
Search Discussions
Soryy I had make a mistake at hbase.zookeeper.property.clientPortOn Tue, Apr 12, 2011 at 1:08 PM, 陈加俊 wrote:WARN : 04-12 12:54:13 Session 0x0 for server null, unexpected error,closing socket connection and attempting reconnectjava.net.ConnectException: Connection refused: no further informationat sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:574)at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1119)WARN : 04-12 12:54:14 Session 0x0 for server null, unexpected error,closing socket connection and attempting reconnectjava.net.ConnectException: Connection refused: no further informationat sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:574)at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1119)WARN : 04-12 12:54:16 Session 0x0 for server null, unexpected error,closing socket connection and attempting reconnectjava.net.ConnectException: Connection refused: no further informationat sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:574)at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1119)--Thanks & Best regardsjiajun--Thanks & Best regardsjiajun
Related Discussions
viewthread |
categories,
user style
1 user in discussion
site design / logo & 2017 Grokbase}

我要回帖

更多关于 further study 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信