Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>PermGen exhaustions</strong> in combination with <code>ThreadLocal</code> are often caused by <strong>classloader leaks</strong>.<br><br> <em>An example:</em> <br> Imagine an application server which has a pool of <em>worker threads</em>.<br> They will be kept alive until application server termination.<br> A deployed web application uses a <strong>static</strong> <code>ThreadLocal</code> in one of its classes in order to store some thread-local data, an instance of another class (lets call it <code>SomeClass</code>) of the web application. This is done within the worker thread (e.g. this action originates from a <em>HTTP request</em>).<br><br> <strong>Important:</strong><br> <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/ThreadLocal.html">By definition</a>, a reference to a <code>ThreadLocal</code> <em>value</em> is kept until the "owning" thread dies or if the ThreadLocal itself is no longer reachable.<br><br> If the web application <strong>fails to clear the reference</strong> to the <code>ThreadLocal</code> <strong>on shutdown</strong>, bad things will happen:<br> Because the worker thread will usually never die and the reference to the <code>ThreadLocal</code> is static, the <code>ThreadLocal</code> value <strong>still references</strong> the instance of <code>SomeClass</code>, a web application's class - <strong>even if the web application has been stopped!</strong><br><br> As a consequence, the web application's <strong>classloader cannot be garbage collected</strong>, which means that <strong>all classes</strong> (and all static data) of the web application <strong>remain loaded</strong> (this affects the PermGen memory pool as well as the heap).<br> Every redeployment iteration of the web application will increase permgen (and heap) usage. <br><br><strong>=> This is the permgen leak</strong> <br><br>One popular example of this kind of leak is <a href="https://issues.apache.org/bugzilla/show_bug.cgi?id=50486">this bug</a> in log4j (fixed in the meanwhile).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload