zzyugl / xmemcached

Automatically exported from code.google.com/p/xmemcached
Apache License 2.0
0 stars 0 forks source link

当出现连接数多的时候,Xmc 出现异常情况 #210

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.当访问量相当大时,xmc会调用destroy-method='shutdown',导致连接�
��闭,重启应用后,能看到addSession,但运行一段时间后,xmc会�
��出一些异常
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
xmc -v 1.3.5  os -v centos 6

Please provide any additional information below.
1.2012-07-31 21:19:36,860 Xmemcached-Reactor-15 
[com.google.code.yanf4j.util.SelectorFactory]-[WARN] SelectorFactory 
initializing Selector pool
java.io.IOException: Too many open files
        at sun.nio.ch.IOUtil.initPipe(Native Method)
        at sun.nio.ch.EPollSelectorImpl.<init>(EPollSelectorImpl.java:49)
        at sun.nio.ch.EPollSelectorProvider.openSelector(EPollSelectorProvider.java:18)
        at java.nio.channels.Selector.open(Selector.java:209)
        at com.google.code.yanf4j.util.SelectorFactory.grow(SelectorFactory.java:162)
        at com.google.code.yanf4j.util.SelectorFactory.setMaxSelectors(SelectorFactory.java:85)
        at com.google.code.yanf4j.util.SelectorFactory.<clinit>(SelectorFactory.java:65)
        at com.google.code.yanf4j.nio.impl.NioTCPSession.blockingRead(NioTCPSession.java:242)
        at com.google.code.yanf4j.nio.impl.NioTCPSession.readFromBuffer(NioTCPSession.java:210)
        at com.google.code.yanf4j.nio.impl.AbstractNioSession.onRead(AbstractNioSession.java:198)
        at com.google.code.yanf4j.nio.impl.AbstractNioSession.onEvent(AbstractNioSession.java:343)
        at com.google.code.yanf4j.nio.impl.SocketChannelController.dispatchReadEvent(SocketChannelController.java:56)
        at com.google.code.yanf4j.nio.impl.NioController.onRead(NioController.java:157)
        at com.google.code.yanf4j.nio.impl.Reactor.dispatchEvent(Reactor.java:294)
        at com.google.code.yanf4j.nio.impl.Reactor.run(Reactor.java:141)
2012-07-31 21:19:46,863 Xmemcached-Reactor-14 
[net.rubyeye.xmemcached.impl.MemcachedHandler]-[ERROR] XMemcached network 
layout exception
java.lang.NullPointerException
        at java.nio.channels.spi.AbstractSelectableChannel.register(AbstractSelectableChannel.java:180)
        at java.nio.channels.SelectableChannel.register(SelectableChannel.java:254)
        at com.google.code.yanf4j.nio.impl.NioTCPSession.blockingRead(NioTCPSession.java:246)
        at com.google.code.yanf4j.nio.impl.NioTCPSession.readFromBuffer(NioTCPSession.java:

2012-07-31 21:19:36,860 Xmemcached-Reactor-15 
[com.google.code.yanf4j.util.SelectorFactory]-[WARN] SelectorFactory 
initializing Selector pool
java.io.IOException: Too many open files
        at sun.nio.ch.IOUtil.initPipe(Native Method)
        at sun.nio.ch.EPollSelectorImpl.<init>(EPollSelectorImpl.java:49)
        at sun.nio.ch.EPollSelectorProvider.openSelector(EPollSelectorProvider.java:18)
        at java.nio.channels.Selector.open(Selector.java:209)
        at com.google.code.yanf4j.util.SelectorFactory.grow(SelectorFactory.java:162)
        at com.google.code.yanf4j.util.SelectorFactory.setMaxSelectors(SelectorFactory.java:85)
        at com.google.code.yanf4j.util.SelectorFactory.<clinit>(SelectorFactory.java:65)
        at com.google.code.yanf4j.nio.impl.NioTCPSession.blockingRead(NioTCPSession.java:242)
        at com.google.code.yanf4j.nio.impl.NioTCPSession.readFromBuffer(NioTCPSession.java:210)
        at com.google.code.yanf4j.nio.impl.AbstractNioSession.onRead(AbstractNioSession.java:198)
        at com.google.code.yanf4j.nio.impl.AbstractNioSession.onEvent(AbstractNioSession.java:343)
        at com.google.code.yanf4j.nio.impl.SocketChannelController.dispatchReadEvent(SocketChannelController.java:56)
        at com.google.code.yanf4j.nio.impl.NioController.onRead(NioController.java:157)
        at com.google.code.yanf4j.nio.impl.Reactor.dispatchEvent(Reactor.java:294)
        at com.google.code.yanf4j.nio.impl.Reactor.run(Reactor.java:141)
2012-07-31 21:19:46,863 Xmemcached-Reactor-14 
[net.rubyeye.xmemcached.impl.MemcachedHandler]-[ERROR] XMemcached network 
layout exception
java.lang.NullPointerException
        at java.nio.channels.spi.AbstractSelectableChannel.register(AbstractSelectableChannel.java:180)
        at java.nio.channels.SelectableChannel.register(SelectableChannel.java:254)
        at com.google.code.yanf4j.nio.impl.NioTCPSession.blockingRead(NioTCPSession.java:246)
        at com.google.code.yanf4j.nio.impl.NioTCPSession.readFromBuffer(NioTCPSession.java:210)
        at com.google.code.yanf4j.nio.impl.AbstractNioSession.onRead(AbstractNioSession.java:198)
        at com.google.code.yanf4j.nio.impl.AbstractNioSession.onEvent(AbstractNioSession.java:343)
        at com.google.code.yanf4j.nio.impl.SocketChannelController.dispatchReadEvent(SocketChannelController.java:56)
        at com.google.code.yanf4j.nio.impl.NioController.onRead(NioController.java:157)
        at com.google.code.yanf4j.nio.impl.Reactor.dispatchEvent(Reactor.java:294)
        at com.google.code.yanf4j.nio.impl.Reactor.run(Reactor.java:141)
2012-07-31 21:19:46,869 Xmemcached-Reactor-13 
[net.rubyeye.xmemcached.impl.MemcachedHandler]-[ERROR] XMemcached network 
layout exception
java.lang.NullPointerException
        at java.nio.channels.spi.AbstractSelectableChannel.register(AbstractSelectableChannel.java:180)
        at java.nio.channels.SelectableChannel.register(SelectableChannel.java:254)
        at com.google.code.yanf4j.nio.impl.NioTCPSession.blockingRead(NioTCPSession.java:246)
        at com.google.code.yanf4j.nio.impl.NioTCPSession.readFromBuffer(NioTCPSession.java:210)
        at com.google.code.yanf4j.nio.impl.AbstractNioSession.onRead(AbstractNioSession.java:198)
        at com.google.code.yanf4j.nio.impl.AbstractNioSession.onEvent(AbstractNioSession.java:343)
        at com.google.code.yanf4j.nio.impl.SocketChannelController.dispatchReadEvent(SocketChannelController.java:56)
        at com.google.code.yanf4j.nio.impl.NioController.onRead(NioController.java:157)
        at com.google.code.yanf4j.nio.impl.Reactor.dispatchEvent(Reactor.java:294)
        at com.google.code.yanf4j.nio.impl.Reactor.run(Reactor.java:141)

Original issue reported on code.google.com by lesbluel...@gmail.com on 1 Aug 2012 at 4:08

Attachments:

GoogleCodeExporter commented 9 years ago
首先,xmc从来不会主动调用shutdown
其次,连接池本来就不应该设置太大。

Original comment by killme2...@gmail.com on 1 Aug 2012 at 4:39

GoogleCodeExporter commented 9 years ago
  访问量突然增加了一个量级,出现了一系列与xmc相关的异常信息。类型Xmemcached is stopped。不解。。。
  这个连接池,你指的是xmc与mem server之间的连接池吗?我设的是30,这个值怎样?

 谢谢!!~~

java.lang.NoClassDefFoundError: com/google/code/yanf4j/util/SelectorFactory
        at com.google.code.yanf4j.nio.impl.AbstractNioSession.flush0(AbstractNioSession.java:268)
        at com.google.code.yanf4j.nio.impl.NioTCPSession.closeChannel(NioTCPSession.java:314)
        at com.google.code.yanf4j.core.impl.AbstractSession.close(AbstractSession.java:286)
        at com.google.code.yanf4j.nio.impl.NioTCPSession.readFromBuffer(NioTCPSession.java:216)
        at com.google.code.yanf4j.nio.impl.AbstractNioSession.onRead(AbstractNioSession.java:198)
        at com.google.code.yanf4j.nio.impl.AbstractNioSession.onEvent(AbstractNioSession.java:343)
        at com.google.code.yanf4j.nio.impl.SocketChannelController.dispatchReadEvent(SocketChannelController.java:56)
        at com.google.code.yanf4j.nio.impl.NioController.onRead(NioController.java:157)
        at com.google.code.yanf4j.nio.impl.Reactor.dispatchEvent(Reactor.java:294)
        at com.google.code.yanf4j.nio.impl.Reactor.run(Reactor.java:141)

Original comment by lesbluel...@gmail.com on 1 Aug 2012 at 7:04

GoogleCodeExporter commented 9 years ago
确保你的应用没有主动关闭shutdown。是不是在压力大的时候,
你们的应用自动重启之类。
连接池,默认的1就够了。

Original comment by killme2...@gmail.com on 1 Aug 2012 at 11:43

GoogleCodeExporter commented 9 years ago
我是在spring中配置的xmc,
    <bean name="memcachedClient" factory-bean="memcachedClientBuilder"
        factory-method="build" destroy-method="shutdown" />
然后在业务bean中注入这个xmc的bean,但我发现当访问量大的时��
�,这个xmc 
bean会被destroy掉,导致业务bean也不能正常使用了。。不解。��
�
我需要把这个xmc的FactoryBuilder写到java代码中,然后做个心跳��
�制,发现xmc 没响应的时候,重新create 一个新的xmc吗?

Original comment by lesbluel...@gmail.com on 2 Aug 2012 at 2:01

GoogleCodeExporter commented 9 years ago
你们的应用容器是否会在压力增大的时候做保护性的重启?��
�看你的日志是否有重新启动的迹象,或者重新热部署的日志�
��
我可以保证的是xmc是不会自动重启的。

Original comment by killme2...@gmail.com on 2 Aug 2012 at 2:19

GoogleCodeExporter commented 9 years ago
嗯,那我找个测试工具,再加压测试看看。
非常感谢你的耐心解答。。。

Original comment by lesbluel...@gmail.com on 2 Aug 2012 at 2:31

GoogleCodeExporter commented 9 years ago
我也出现勒这个问题,memcahced会不会是因为某种原因自己重��
�,而重连之前的shutdowm又没有真正的断开与mem 
server的连接,然后受到mem server连接数的限制导致报勒too 
many的错误?

Original comment by erics...@good321.net on 16 Nov 2012 at 2:16