开发者

What is wrong with runing app in tomcat server?

开发者 https://www.devze.com 2022-12-13 14:32 出处:网络
Recently I created a maven based web project and used tomcat as application server to debug ... But tomcat is frequently dead (pergem error which means out of memery ) after run app from the Project

Recently I created a maven based web project and used tomcat as application server to debug ...

But tomcat is frequently dead (pergem error which means out of memery ) after run app from the Project context menu directly.

The worst is that It created many idle threads and they are all can not be killed by manually.

And tomcat status is also can not be detected by NetBeans, it can not be stop and restart. I must restart my system to clean them.

My system is Fedora 12 x86... Java version is SUN JDK 6 update 17. NetBeans verison is 6.7.1.

I tried to create a bug about this, but the NetBeans developer rejected it ... I am very surprise this is a big stopper to use NetBeans to develop web app.

Today I used JBoss 5.1 in the latest NetBeans 6.8rc1 and also encountered the same problem... I've tried adjusted the VM parameters and allocate more memory but no effec开发者_运维问答ts.

I've deployed several seam samples to JBoss 5.1 via seam ant build script , and there is no problem. But I switch to use NetBeans to do this, It failed due to Out of memory.

What is wrong????


(I'm assuming that the idle threads you are talking about are application threads. If you are talking about Tomcat's worker threads, then they should not cause permgen problems when idle.)

I tried to create a bug about this, but the NetBeans developer rejected it ... I am very surprise ...

I'm very unsurprised. This is not really a NetBeans problem. It is not even really a Tomcat or JBoss problem.

The problem with idle / orphaned application threads is that you cannot safely kill threads in a running JVM. And without the ability to do this you cannot stop leakages of (in this case) permgen space. This is essentially a Java platform problem. It can only be solved when JVMs support the Isolate mechanisms defined by JSR 121.

But assuming that your problem is related to doing hot deployment, it is not just the idle application threads that you have to worry about. If there is any reachable instance of any class that you are redeploying, that will cause the original old class loader and all classes it loaded to remain reachable.

... this is a big stopper to use NetBeans to develop web app.

The solution is to restart your web container every now and then. This will clean out the idle threads and other cruft and release the leaked permgen space. You can ameliorate it by running with a larger heap and more permgen, but you cannot make it go away, especially if some of the orphaned threads are not idle ...

Oh yea, and don't be a big baby! This ain't a show stopper, its just a small inconvenience :-)

0

精彩评论

暂无评论...
验证码 换一张
取 消