weixin_42352216
weixin_42352216
2010-03-12 14:31

linux下tomcat运行几个小时,就挂掉,2~3天就会把服务器拖死的问题

已采纳

求大侠们帮忙!

tomcat 闹的百般故障....几个小时,就挂一次, 一天或者几天,甚至把机器拖死...
tomcat 5.5 ,连接池c3p0
mysql 5.0 ,linux 系统,8G内存。
设置了最大文件数字" fs.file-max = 65535"

以下是catalina.out 里的几种报错~ 很全面的全错.....
linux系统日志查不到特别的信息,mysql里也米有

1st error :

2010-3-12 2:06:12 org.apache.tomcat.util.net.PoolTcpEndpoint acceptSocket
严重: Endpoint ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=8080] ignored exception: java.net.SocketException: Too many open f
iles
java.net.SocketException: Too many open files
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
at java.net.ServerSocket.implAccept(ServerSocket.java:450)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:60)
at org.apache.tomcat.util.net.PoolTcpEndpoint.acceptSocket(PoolTcpEndpoint.java:407)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:70)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)

at java.lang.Thread.run(Thread.java:595)

2nd error

2010-3-12 2:06:41 org.apache.catalina.loader.WebappClassLoader openJARs
警告: Failed to open JAR
java.util.zip.ZipException: Too many open files
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:203)
at java.util.jar.JarFile.(JarFile.java:132)
at java.util.jar.JarFile.(JarFile.java:97)
at org.apache.catalina.loader.WebappClassLoader.openJARs(WebappClassLoader.java:1544)
at org.apache.catalina.loader.WebappClassLoader.findResourceInternal(WebappClassLoader.java:1763)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1570)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:850)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1299)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at org.apache.struts2.dispatcher.Dispatcher.cleanup(Dispatcher.java:254)
at org.apache.struts2.dispatcher.FilterDispatcher.destroy(FilterDispatcher.java:233)
at org.apache.catalina.core.ApplicationFilterConfig.release(ApplicationFilterConfig.java:258)
at org.apache.catalina.core.StandardContext.filterStop(StandardContext.java:3575)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4249)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:2924)
at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:403)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1276)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1568)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1577)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1577)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1557)
at java.lang.Thread.run(Thread.java:595)


3rd


2010-03-12 09:33:10 [Timer-4] WARN com.mchange.v2.async.ThreadPoolAsynchronousRunner --> com.mchange.v2.async.ThreadPoolAsynchronou
sRunner$DeadlockDetector@1796149 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
2010-03-12 09:33:12 [http-8080-Processor64] WARN com.mchange.v2.c3p0.impl.DefaultConnectionTester --> SQL State '08007' of Exceptio
n tested by statusOnException() implies that the database is invalid, and the pool should refill itself with fresh Connections.
com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Communications link failure during commit(). Transaction resolution
unknown.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:980)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
at com.mysql.jdbc.ConnectionImpl.commit(ConnectionImpl.java:1569)


4th

at java.lang.Thread.run(Thread.java:595)
2010-03-12 09:33:12 [http-8080-Processor65] WARN com.mchange.v2.c3p0.impl.DefaultConnectionTester --> SQL State '08007' of Exceptio
n tested by statusOnException() implies that the database is invalid, and the pool should refill itself with fresh Connections.
com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Communications link failure during commit(). Transaction resolution
unknown.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:980)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
at com.mysql.jdbc.ConnectionImpl.commit(ConnectionImpl.java:1569)
at com.mchange.v2.c3p0.impl.NewProxyConnection.commit(NewProxyConnection.java:803)
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doCommit(DataSourceTransactionManager.java:262)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManag
er.java:732)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java
:701)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSup
port.java:321)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy5.getAllSearchRolesNumByCondition(Unknown Source)


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

3条回答

  • iteye_15594 iteye_15594 11年前

    看下代码里面 对 mysql 连接池有没有没有release的地方。。
    明显socket 句柄没有得到释放。。

    [code="java"]
    .ThreadPoolAsynchronou
    sRunner$DeadlockDetector@1796149 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
    [/code]
    明显有deadlock database 的地方。。

    点赞 评论 复制链接分享
  • iteye_20112 iteye_20112 11年前

    在Linux中,很多东西都是以文件句柄方式存在的,比如文件,Socket等,

    从现象和异常来看,应该是Socket,文件或数据库连接等使用未正确关闭,导致过多的文件句柄被打开

    点赞 评论 复制链接分享
  • lzj0470 lzj0470 11年前

    Too many open files 问题
    你操作文本记得要关闭。否则,你把文件数量设置到N大都没用。
    我也是前天遇到这样的问题,操作3W多个文件,忘记关闭了,老给我提示too many open files。希望对你有帮助

    点赞 评论 复制链接分享

相关推荐