我在apache 2.2上运行tomcat 7 & mod_jk 1.2.26在2GB内存的debian-lenny x64服务器上。
我的服务器出现了一个奇怪的问题:每隔几分钟,每隔几小时&(负载下),我的tomcat ajp连接器会因内存泄漏错误而暂停,但似乎这个错误也会影响系统的其他部分(例如一些其他正在运行的应用程序也停止工作)&我必须重新启动服务器以解决问题一段时间。
我检查catalina.out中了好几天,但它只是这个消息暂停AJP似乎之前的没有一个唯一的错误模式:与apache,tomcat和mod_jk和mysql的内存泄漏
Exception in thread "ajp-bio-8009-Acceptor-0" java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:597)...
:暂停前
INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
有时,此消息
&有时这一个:
INFO: Reloading Context with name [] has started
Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:597)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5482)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:230)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3847)
at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:424)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1214)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1400)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1410)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1410)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1389)
at java.lang.Thread.run(Thread.java:619)
java.sql.SQLException: null, message from server: "Can't create a new thread (errno 11); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug"...
&一些其他时候outpu t消息与程序的其他部分有关。
我检查了我的应用程序源代码&我不认为它会导致问题,我还使用jConsole检查了内存使用情况。令人满意的一点是,当服务器失败时,在堆堆&非堆栈jvm内存空间上显示大量可用内存。正如我之前告诉的,在服务器崩溃后,许多其他应用程序在我想重新启动它们时也会失败&它会提供资源暂时不可用的消息(我也检查了我的limits.conf文件)。
所以我真的很困惑这个严重的问题很多天&我真的没有更多的想法。所以,任何人都可以给我任何建议,以解决这个复杂的&未知的问题?
这个错误最可能的原因是什么?
也许你可以看看serverfault.com – Sietse