解决PermGen问题的各种选项 [英] The various options for solving PermGen problems

查看:135
本文介绍了解决PermGen问题的各种选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在JBoss上运行我们的应用程序,偶尔在那里运行我们的应用程序在重新装备期间臭名昭着的PermGen错误。在互联网上有很多冲突和过时的信息可以帮助你解决或缓解这个问题。

oracle.com/fkieviet/entry/classloader_leaks_the_dreaded_javarel =nofollow noreferrer>我可以看到,以下是正确的:


  • 自己的上的VM选项不会解决此问题,只会推迟它。

  • 解决此问题的唯一可靠方法是修复编码错误在Application Server本身(不太可能)或在Application Server中运行的代码(我们的代码或第三方库)(更可能)。 Permgen的填充通常是由应用程序类加载器加载到Application Server类加载器加载的对象的引用的结果,从而防止垃圾回收应用程序的类加载器。



我有两个问题产生于此:


  1. 以上是否正确?

  2. VM选项 CMSClassUnloadingEnabled CMSPermGenSweepingEnabled 在哪里?从我可以看到 CMSClassUnloadingEnabled 取代或隐式启用 CMSPermGenSweepingEnabled 。它们中的任何一个都可以帮助解决上述问题?


解决方案

不幸的是,答案是:



  1. 这些VM选项只会推迟问题。

基本的问题是GC不会垃圾收集一个强烈可达的对象。你需要弄清楚为什么这些旧的应用程序类加载器在重新部署后仍然可以访问并修复泄漏。



或者,放弃热调整生产服务器,或更频繁地重新启动Web容器(例如JBoss)。

I am looking into the various options around garbage collection on a Java 6 18 VM and would like some pointers.

We run our application on JBoss, and occasionally there are the infamous PermGen errors during redeploys. There is a lot of conflicting and obsolete information on the internet about the best way to solve or mitigate this problem.

From what I can see, the following is correct:

  • VM options on their own will not resolve this issue, only postpone it.
  • The only reliable way to fix this problem is to fix coding errors either in the Application Server itself (unlikely) or the code (our code or third-party libraries) that is running in the Application Server (more likely). The filling of Permgen is often the result of references from objects loaded by the application classloader to objects loaded by the Application Server classloader, thus preventing garbage collection of the application's classloader.

I have two questions resulting from this:

  1. Is the above correct?
  2. Where do the VM options CMSClassUnloadingEnabled and CMSPermGenSweepingEnabled come into this? From what I can see CMSClassUnloadingEnabled supercedes or implicitly enables CMSPermGenSweepingEnabled. Do either of them help with the above problem?

解决方案

Unfortunately, the answers are:

  1. Yes
  2. Those VM options will only postpone the problem.

The basic problem is that the GC will not garbage collect a strongly reachable object. You need to figure out why those old application class loaders are still reachable after a redeploy ... and fix the leak.

Alternatively, give up on hot redeployment on your production servers, or restart the web container (e.g. JBoss) more often.

这篇关于解决PermGen问题的各种选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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