为什么 Tomcat 5.5(使用 Java 1.4,在 Windows XP 32 位上运行)突然挂起? [英] Why does Tomcat 5.5 (with Java 1.4, running on Windows XP 32-bit) suddenly hang?

查看:21
本文介绍了为什么 Tomcat 5.5(使用 Java 1.4,在 Windows XP 32 位上运行)突然挂起?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 Java 1.4 运行 Tomcat 5.5 一段时间了,现在有一个巨大的 web 应用程序.大多数时候它运行良好,但有时它会挂起,没有产生异常,并且除了重新启动 Tomcat 之外没有明显的方法让它再次运行.tomcat 实例允许在堆上有 1 GB 的内存,但很少超过 300 MB.有没有其他人遇到过这个问题,有解决方案吗?

I've been running Tomcat 5.5 with Java 1.4 for a while now with a huge webapp. Most of the time it runs fine, but sometimes it will just hang, with no exception generated, and no apparant way of getting it to run again other than re-starting Tomcat. The tomcat instance is allowed a gigabyte of memory on the heap, but rarely exceeds 300 MB. Has anyone else run into this issue, and is there a solution for it?

澄清:我通过任务管理器和 Eclipse 确定了它使用了多少内存(我也尝试过在 Eclipse 之外运行它,但最终还是遇到了同样的问题,虽然它需要更长的时间).使用 Eclipse,我查看通过它的小(可选)内存窗格分配的内存和通过任务管理器分配给 javaw.exe 的数量.我用的是sysdeo?Eclipse 的 tomcat 插件.

For clarification: I determined how much memory it is using via Task Manager and via Eclipse (I've also tried running it outside of Eclipse, but get the same problem eventually, though it takes a little longer). With Eclipse, I look at the memory allocated via its little (optional) memory pane and the amount allocated to javaw.exe via the task manager. I use the sysdeo? tomcat plugin for Eclipse.

推荐答案

对于任何 jvm 进程,强制进行线程转储.在 Windows 中,这可以通过 CTRL-BREAK 来完成,我相信,在控制台窗口中.

For any jvm process, force a thread dump. In windows, this can be done with CTRL-BREAK, I believe, in the console window.

在 *nix 中,它几乎总是kill -3 jvm-pid".

In *nix, it is almost always "kill -3 jvm-pid".

这可能会显示您是否有线程在等待数据库连接池/线程池等.

This may show if you have threads waiting on db connection pool/thread pool, etc.

要检查的另一件事是您当前与 JVM 之间有多少连接——使用 NETSTAT 或 SysInternals 实用程序,例如 tcpconn/tcpview(谷歌它).

Another thing to check out is how many connections you have currently to the JVM -- either use NETSTAT or SysInternals utility such as tcpconn/tcpview (google it).

另外,尝试使用verbose:gc JVM 标志运行.对于 Sun 的 JVM,像java -verbose:gc"一样运行.这将显示您的垃圾收集.如果它收集了很多(完整的收集,特别是),那么你可能有内存泄漏.完整的集合代价高昂,尤其是在像这样的大堆上.

Also, try to run with the verbose:gc JVM flag. For Sun's JVM, run like "java -verbose:gc". This will show your garbage collections. If it is collecting a lot (FULL COLLECTIONS, expecially) then you probably have a memory leak. The full collections are costly, especially on large heaps like that.

您如何确定仅使用了 300mb?

How are you determining that only 300mb are being used?

这篇关于为什么 Tomcat 5.5(使用 Java 1.4,在 Windows XP 32 位上运行)突然挂起?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆