ahww520 / xmemcached

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

OutOfMemoryError,创建不了新线程 #187

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
2012-3-25 下午04时14分49秒 CST> <Error> <HTTP> <BEA-101017> 
<[ServletContext@8404868[app:_appsdir_mjj_dir module:mjj path: 
spec-version:2.5], request: weblogic.servlet.internal.ServletRequestImpl@1c9756[
GET /mjj.jsp?id=292 HTTP/1.0
Accept: */*
Referer: www.baidu.com

]] Root cause of ServletException.
java.lang.OutOfMemoryError: unable to create new native thread
    at java.lang.Thread.start0(Native Method)
    at java.lang.Thread.start(Thread.java:640)
    at com.google.code.yanf4j.nio.impl.SelectorManager.start(SelectorManager.java:58)
    at com.google.code.yanf4j.nio.impl.NioController.initialSelectorManager(NioController.java:141)
    at com.google.code.yanf4j.nio.impl.NioController.start0(NioController.java:121)
    Truncated. see log file for complete stacktrace
> 
<2012-3-25 下午04时14分49秒 CST> <Error> <HTTP> <BEA-101017> 
<[ServletContext@8404868[app:_appsdir_mjj_dir module:mjj path: 
spec-version:2.5], request: weblogic.servlet.internal.ServletRequestImpl@55c3eb[
GET /mjj.jsp?id=292 HTTP/1.0
Accept: */*
Referer: www.baidu.com

]] Root cause of ServletException.
java.lang.OutOfMemoryError: unable to create new native thread
    at java.lang.Thread.start0(Native Method)
    at java.lang.Thread.start(Thread.java:640)
    at com.google.code.yanf4j.nio.impl.SelectorManager.start(SelectorManager.java:58)
    at com.google.code.yanf4j.nio.impl.NioController.initialSelectorManager(NioController.java:141)
    at com.google.code.yanf4j.nio.impl.NioController.start0(NioController.java:121)
    Truncated. see log file for complete stacktrace
> 

帮忙注意看下日志,创建不了新线程,后面直接不处理jsp了��
�
使用的最新的xmemcached-1.3.6-bin-with-dependencies.tar.gz,
服务器配置:
win2003server32bit sp2,
物理内存16GB,
Intel Xeon(R)L5420@2.5GHZ cpu x8
有朋友说换64位可能要好些,
但给你们讲讲怪事:
PROJECT运行起来后,貌似历史请求总量一大JAVA程序必挂,而没
有用到xmemcached的jsp servlet没有影响。
P.S:我不是JAVA程序员,所以语言不够专业。

Original issue reported on code.google.com by inaos...@gmail.com on 25 Mar 2012 at 8:29

GoogleCodeExporter commented 8 years ago
这个问题理论上应该跟xmc没有太大关系,我回复你邮件了,��
�议用jhat或者jprofile之类的工具分析下内存状况。

Original comment by killme2...@gmail.com on 26 Mar 2012 at 10:30

GoogleCodeExporter commented 8 years ago
没有用到xmemcached的java/jsp在出错后完全正常 
(用到xmemcached的请求已经报错,无法执行)。

Original comment by inaos...@gmail.com on 27 Mar 2012 at 7:33

GoogleCodeExporter commented 8 years ago
我估计是你误用了,你是不是每次调用都创建一个XMemcachedClie
nt?
MemcachedClient应该作为单例使用,请仔细阅读用户指南。

Original comment by killme2...@gmail.com on 27 Mar 2012 at 9:19

GoogleCodeExporter commented 8 years ago
今天我在开发环境遇到这个问题了,用jstack看了下,一共493��
�线程,其中有240个是
com.google.code.yanf4j.nio.impl.Reactor.run(), 然后就无法创建线程了

我用的版本是com.googlecode.xmemcached:xmemcached:jar:1.3.3:compile
jstack在附件中
jmap附件太大,用jprofile分析的结果如下
Used heap dump  13.9 MB
Number of objects   257,634
Number of classes   9,061
Number of class loaders 84
Number of GC roots  2,261

看来应该不是mem不够,而是线程太多了的原因。
另外程序中MemcachedClient是被封装在一个Spring 
Bean里,SpringBean是Singleton,所以不存在多个MemcachedClient的情况
。

Original comment by iamlo...@gmail.com on 26 Dec 2013 at 11:55

Attachments:

GoogleCodeExporter commented 8 years ago
OOM的原因已经查明,是程序中有地方未使用SpringBean,而独自n
ew 
XmemcachedClient,并且没有shutdown所致。Xmemcached是清白的。。。�
��

Original comment by iamlo...@gmail.com on 26 Dec 2013 at 2:13