You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "lionel gomez (JIRA)" <ta...@jakarta.apache.org> on 2006/11/16 01:30:38 UTC

[jira] Created: (TAPESTRY-1151) PagePool doesnt remove idle pages, heap memory doens't get reallocated

PagePool doesnt remove idle pages, heap memory doens't get reallocated
----------------------------------------------------------------------

                 Key: TAPESTRY-1151
                 URL: http://issues.apache.org/jira/browse/TAPESTRY-1151
             Project: Tapestry
          Issue Type: Bug
          Components: Framework
    Affects Versions: 4.0
         Environment: java 1.4, apache tomcat 5.0 IBM websphere 5.0 
            Reporter: lionel gomez
            Priority: Minor


This may not qualify as a bug since its so easy to provide override using hivemind, but instead an improvement for future releases. Also provided an optional page pool implementation.
Tapestry 4.0 PagePool implementation doesnt remove idle pages. When having hundred of pages with a lot of components and high user concurrency, tapestry generates many instances of each page. These instances are pooled and never unreferenced and never garbage collected. Our 1GB heap eventually fills up and reduces the memory available to other parts of the application. Eventually causes OutOfMemoryException.
We ensured caching is enabled and config change made to use unique locale, but still, heap eventually fills up.

With Hivemind its very easy to override the pagePool and provide different implementation. A page pool that uses softReferences is a good option.
Acording to java api:
All soft references to softly-reachable objects are guaranteed to have been cleared before the virtual machine throws an OutOfMemoryError.
This prevents OEM due to heap filling up.

New SoftPagePool only changes a couple of lines to use soft references.

  public synchronized Object get(Object key)
  {
      List pooled = (List) _pool.get(key);

      if (pooled == null || pooled.isEmpty())
          return null;

      _count--;
      SoftReference reference  = (SoftReference) pooled.remove(0);
      //returns null if has been cleared by GC same as pool where empty
      return reference.get();
  }

  public synchronized void store(Object key, Object value)
  {
      List pooled = (List) _pool.get(key);

      if (pooled == null)
      {
          pooled = new LinkedList();
          _pool.put(key, pooled);
      }

      SoftReference reference = new SoftReference(value);
      pooled.add(reference);

      _count++;
  }

Additionally the page pool  implementation can use a clean idle pages mechanism using same design as Tapestry 3.0 ThreadJanitor or setting a timestamp when storing pages and a TimerTask and Timer wich receives events on registry shutdown. All this by using hivemind overriding features.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-1151) PagePool doesnt remove idle pages, heap memory doens't get reallocated

Posted by "Greg Woolsey (JIRA)" <ta...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/TAPESTRY-1151?page=comments#action_12457159 ] 
            
Greg Woolsey commented on TAPESTRY-1151:
----------------------------------------

Or just implement pooling with Commons Pool:

http://jakarta.apache.org/commons/pool/

which has a SoftReferenceObjectPool.

> PagePool doesnt remove idle pages, heap memory doens't get reallocated
> ----------------------------------------------------------------------
>
>                 Key: TAPESTRY-1151
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-1151
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 4.0
>         Environment: java 1.4, apache tomcat 5.0 IBM websphere 5.0 
>            Reporter: lionel gomez
>         Assigned To: Jesse Kuhnert
>            Priority: Minor
>             Fix For: 4.1.1
>
>
> This may not qualify as a bug since its so easy to provide override using hivemind, but instead an improvement for future releases. Also provided an optional page pool implementation.
> Tapestry 4.0 PagePool implementation doesnt remove idle pages. When having hundred of pages with a lot of components and high user concurrency, tapestry generates many instances of each page. These instances are pooled and never unreferenced and never garbage collected. Our 1GB heap eventually fills up and reduces the memory available to other parts of the application. Eventually causes OutOfMemoryException.
> We ensured caching is enabled and config change made to use unique locale, but still, heap eventually fills up.
> With Hivemind its very easy to override the pagePool and provide different implementation. A page pool that uses softReferences is a good option.
> Acording to java api:
> All soft references to softly-reachable objects are guaranteed to have been cleared before the virtual machine throws an OutOfMemoryError.
> This prevents OEM due to heap filling up.
> New SoftPagePool only changes a couple of lines to use soft references.
>   public synchronized Object get(Object key)
>   {
>       List pooled = (List) _pool.get(key);
>       if (pooled == null || pooled.isEmpty())
>           return null;
>       _count--;
>       SoftReference reference  = (SoftReference) pooled.remove(0);
>       //returns null if has been cleared by GC same as pool where empty
>       return reference.get();
>   }
>   public synchronized void store(Object key, Object value)
>   {
>       List pooled = (List) _pool.get(key);
>       if (pooled == null)
>       {
>           pooled = new LinkedList();
>           _pool.put(key, pooled);
>       }
>       SoftReference reference = new SoftReference(value);
>       pooled.add(reference);
>       _count++;
>   }
> Additionally the page pool  implementation can use a clean idle pages mechanism using same design as Tapestry 3.0 ThreadJanitor or setting a timestamp when storing pages and a TimerTask and Timer wich receives events on registry shutdown. All this by using hivemind overriding features.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Updated: (TAPESTRY-1151) PagePool doesnt remove idle pages, heap memory doens't get reallocated

Posted by "Jesse Kuhnert (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-1151?page=all ]

Jesse Kuhnert updated TAPESTRY-1151:
------------------------------------

    Fix Version/s: 4.1.2
                       (was: 4.1.1)

> PagePool doesnt remove idle pages, heap memory doens't get reallocated
> ----------------------------------------------------------------------
>
>                 Key: TAPESTRY-1151
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-1151
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 4.0
>         Environment: java 1.4, apache tomcat 5.0 IBM websphere 5.0 
>            Reporter: lionel gomez
>         Assigned To: Jesse Kuhnert
>            Priority: Minor
>             Fix For: 4.1.2
>
>
> This may not qualify as a bug since its so easy to provide override using hivemind, but instead an improvement for future releases. Also provided an optional page pool implementation.
> Tapestry 4.0 PagePool implementation doesnt remove idle pages. When having hundred of pages with a lot of components and high user concurrency, tapestry generates many instances of each page. These instances are pooled and never unreferenced and never garbage collected. Our 1GB heap eventually fills up and reduces the memory available to other parts of the application. Eventually causes OutOfMemoryException.
> We ensured caching is enabled and config change made to use unique locale, but still, heap eventually fills up.
> With Hivemind its very easy to override the pagePool and provide different implementation. A page pool that uses softReferences is a good option.
> Acording to java api:
> All soft references to softly-reachable objects are guaranteed to have been cleared before the virtual machine throws an OutOfMemoryError.
> This prevents OEM due to heap filling up.
> New SoftPagePool only changes a couple of lines to use soft references.
>   public synchronized Object get(Object key)
>   {
>       List pooled = (List) _pool.get(key);
>       if (pooled == null || pooled.isEmpty())
>           return null;
>       _count--;
>       SoftReference reference  = (SoftReference) pooled.remove(0);
>       //returns null if has been cleared by GC same as pool where empty
>       return reference.get();
>   }
>   public synchronized void store(Object key, Object value)
>   {
>       List pooled = (List) _pool.get(key);
>       if (pooled == null)
>       {
>           pooled = new LinkedList();
>           _pool.put(key, pooled);
>       }
>       SoftReference reference = new SoftReference(value);
>       pooled.add(reference);
>       _count++;
>   }
> Additionally the page pool  implementation can use a clean idle pages mechanism using same design as Tapestry 3.0 ThreadJanitor or setting a timestamp when storing pages and a TimerTask and Timer wich receives events on registry shutdown. All this by using hivemind overriding features.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Assigned: (TAPESTRY-1151) PagePool doesnt remove idle pages, heap memory doens't get reallocated

Posted by "Jesse Kuhnert (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-1151?page=all ]

Jesse Kuhnert reassigned TAPESTRY-1151:
---------------------------------------

    Assignee: Jesse Kuhnert

> PagePool doesnt remove idle pages, heap memory doens't get reallocated
> ----------------------------------------------------------------------
>
>                 Key: TAPESTRY-1151
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-1151
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 4.0
>         Environment: java 1.4, apache tomcat 5.0 IBM websphere 5.0 
>            Reporter: lionel gomez
>         Assigned To: Jesse Kuhnert
>            Priority: Minor
>
> This may not qualify as a bug since its so easy to provide override using hivemind, but instead an improvement for future releases. Also provided an optional page pool implementation.
> Tapestry 4.0 PagePool implementation doesnt remove idle pages. When having hundred of pages with a lot of components and high user concurrency, tapestry generates many instances of each page. These instances are pooled and never unreferenced and never garbage collected. Our 1GB heap eventually fills up and reduces the memory available to other parts of the application. Eventually causes OutOfMemoryException.
> We ensured caching is enabled and config change made to use unique locale, but still, heap eventually fills up.
> With Hivemind its very easy to override the pagePool and provide different implementation. A page pool that uses softReferences is a good option.
> Acording to java api:
> All soft references to softly-reachable objects are guaranteed to have been cleared before the virtual machine throws an OutOfMemoryError.
> This prevents OEM due to heap filling up.
> New SoftPagePool only changes a couple of lines to use soft references.
>   public synchronized Object get(Object key)
>   {
>       List pooled = (List) _pool.get(key);
>       if (pooled == null || pooled.isEmpty())
>           return null;
>       _count--;
>       SoftReference reference  = (SoftReference) pooled.remove(0);
>       //returns null if has been cleared by GC same as pool where empty
>       return reference.get();
>   }
>   public synchronized void store(Object key, Object value)
>   {
>       List pooled = (List) _pool.get(key);
>       if (pooled == null)
>       {
>           pooled = new LinkedList();
>           _pool.put(key, pooled);
>       }
>       SoftReference reference = new SoftReference(value);
>       pooled.add(reference);
>       _count++;
>   }
> Additionally the page pool  implementation can use a clean idle pages mechanism using same design as Tapestry 3.0 ThreadJanitor or setting a timestamp when storing pages and a TimerTask and Timer wich receives events on registry shutdown. All this by using hivemind overriding features.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Updated: (TAPESTRY-1151) PagePool doesnt remove idle pages, heap memory doens't get reallocated

Posted by "Jesse Kuhnert (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-1151?page=all ]

Jesse Kuhnert updated TAPESTRY-1151:
------------------------------------

    Fix Version/s: 4.1.1

> PagePool doesnt remove idle pages, heap memory doens't get reallocated
> ----------------------------------------------------------------------
>
>                 Key: TAPESTRY-1151
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-1151
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 4.0
>         Environment: java 1.4, apache tomcat 5.0 IBM websphere 5.0 
>            Reporter: lionel gomez
>         Assigned To: Jesse Kuhnert
>            Priority: Minor
>             Fix For: 4.1.1
>
>
> This may not qualify as a bug since its so easy to provide override using hivemind, but instead an improvement for future releases. Also provided an optional page pool implementation.
> Tapestry 4.0 PagePool implementation doesnt remove idle pages. When having hundred of pages with a lot of components and high user concurrency, tapestry generates many instances of each page. These instances are pooled and never unreferenced and never garbage collected. Our 1GB heap eventually fills up and reduces the memory available to other parts of the application. Eventually causes OutOfMemoryException.
> We ensured caching is enabled and config change made to use unique locale, but still, heap eventually fills up.
> With Hivemind its very easy to override the pagePool and provide different implementation. A page pool that uses softReferences is a good option.
> Acording to java api:
> All soft references to softly-reachable objects are guaranteed to have been cleared before the virtual machine throws an OutOfMemoryError.
> This prevents OEM due to heap filling up.
> New SoftPagePool only changes a couple of lines to use soft references.
>   public synchronized Object get(Object key)
>   {
>       List pooled = (List) _pool.get(key);
>       if (pooled == null || pooled.isEmpty())
>           return null;
>       _count--;
>       SoftReference reference  = (SoftReference) pooled.remove(0);
>       //returns null if has been cleared by GC same as pool where empty
>       return reference.get();
>   }
>   public synchronized void store(Object key, Object value)
>   {
>       List pooled = (List) _pool.get(key);
>       if (pooled == null)
>       {
>           pooled = new LinkedList();
>           _pool.put(key, pooled);
>       }
>       SoftReference reference = new SoftReference(value);
>       pooled.add(reference);
>       _count++;
>   }
> Additionally the page pool  implementation can use a clean idle pages mechanism using same design as Tapestry 3.0 ThreadJanitor or setting a timestamp when storing pages and a TimerTask and Timer wich receives events on registry shutdown. All this by using hivemind overriding features.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Resolved: (TAPESTRY-1151) PagePool doesnt remove idle pages, heap memory doens't get reallocated

Posted by "Jesse Kuhnert (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-1151?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jesse Kuhnert resolved TAPESTRY-1151.
-------------------------------------

    Resolution: Fixed

Done. 

> PagePool doesnt remove idle pages, heap memory doens't get reallocated
> ----------------------------------------------------------------------
>
>                 Key: TAPESTRY-1151
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1151
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 4.0
>         Environment: java 1.4, apache tomcat 5.0 IBM websphere 5.0 
>            Reporter: lionel gomez
>            Assignee: Jesse Kuhnert
>            Priority: Minor
>             Fix For: 4.1.2
>
>
> This may not qualify as a bug since its so easy to provide override using hivemind, but instead an improvement for future releases. Also provided an optional page pool implementation.
> Tapestry 4.0 PagePool implementation doesnt remove idle pages. When having hundred of pages with a lot of components and high user concurrency, tapestry generates many instances of each page. These instances are pooled and never unreferenced and never garbage collected. Our 1GB heap eventually fills up and reduces the memory available to other parts of the application. Eventually causes OutOfMemoryException.
> We ensured caching is enabled and config change made to use unique locale, but still, heap eventually fills up.
> With Hivemind its very easy to override the pagePool and provide different implementation. A page pool that uses softReferences is a good option.
> Acording to java api:
> All soft references to softly-reachable objects are guaranteed to have been cleared before the virtual machine throws an OutOfMemoryError.
> This prevents OEM due to heap filling up.
> New SoftPagePool only changes a couple of lines to use soft references.
>   public synchronized Object get(Object key)
>   {
>       List pooled = (List) _pool.get(key);
>       if (pooled == null || pooled.isEmpty())
>           return null;
>       _count--;
>       SoftReference reference  = (SoftReference) pooled.remove(0);
>       //returns null if has been cleared by GC same as pool where empty
>       return reference.get();
>   }
>   public synchronized void store(Object key, Object value)
>   {
>       List pooled = (List) _pool.get(key);
>       if (pooled == null)
>       {
>           pooled = new LinkedList();
>           _pool.put(key, pooled);
>       }
>       SoftReference reference = new SoftReference(value);
>       pooled.add(reference);
>       _count++;
>   }
> Additionally the page pool  implementation can use a clean idle pages mechanism using same design as Tapestry 3.0 ThreadJanitor or setting a timestamp when storing pages and a TimerTask and Timer wich receives events on registry shutdown. All this by using hivemind overriding features.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org