ICEfaces
  1. ICEfaces
  2. ICE-1613

Redeploying ICEfaces applications leaks Perm gen

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6DR#4
    • Fix Version/s: 1.6DR#5, 1.6
    • Component/s: None
    • Labels:
      None
    • Environment:
      ICEfaces

      Description

      When certain ICEfaces applications are repeatedly redeployed, the following Error will be displayed, requiring an application server restart:

      java.lang.OutOfMemoryError: PermGen space

      For instance, the following script can monitor this and reproduce the problem:

       while true; sleep 5; do curl -o /tmp/auction.html http://localhost:8080/auctionMonitor/; cp samples/auctionMonitor/dist/auctionMonitor.war /tmp/apache-tomcat-5.5.20/webapps/; /usr/local/jdk1.6.0_01/bin/jmap -J-Xmx512m 17824; done

        Activity

        Ted Goddard created issue -
        Hide
        Greg Dick added a comment -

        This seems to be a known issue with classloaders not releasing class definitions after redeployment.
        http://forum.hibernate.org/viewtopic.php?t=960856&highlight=leaks

        Show
        Greg Dick added a comment - This seems to be a known issue with classloaders not releasing class definitions after redeployment. http://forum.hibernate.org/viewtopic.php?t=960856&highlight=leaks
        Hide
        Ted Goddard added a comment -

        I've been looking at the following reference to help understand this bug:

        How to fix the dreaded "java.lang.OutOfMemoryError: PermGen space" exception (classloader leaks)

        http://blogs.sun.com/fkieviet/entry/how_to_fix_the_dreaded

        The leak appears to be a ClassLoader leak held by Thread ContextClassLoader and InheritableThreadLocal (the PersistentFacesState).

        Show
        Ted Goddard added a comment - I've been looking at the following reference to help understand this bug: How to fix the dreaded "java.lang.OutOfMemoryError: PermGen space" exception (classloader leaks) http://blogs.sun.com/fkieviet/entry/how_to_fix_the_dreaded The leak appears to be a ClassLoader leak held by Thread ContextClassLoader and InheritableThreadLocal (the PersistentFacesState).
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #13944 Tue May 22 14:20:32 MDT 2007 ted.goddard Disabling timed cleanup due to permgen leak (ICE-1613)
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/samples/auctionMonitor/src/com/icesoft/applications/faces/auctionMonitor/beans/LogBean.java
        Hide
        Ted Goddard added a comment -

        This appears mainly to be an application bug. On startup, auctionMonitor creates a java.util.Timer and an associated Thread

        new Timer().scheduleAtFixedRate(new TimerTask() { ...

        The ContextClassLoader of this Thread is the webapp classloader and keeps the ICEfaces classes locked in PermGen.

        Since auctionMonitor is now essentially resetting itself correctly and does not allow excessively large bids, the best approach is likely to disable the timed reset functionality.

        Show
        Ted Goddard added a comment - This appears mainly to be an application bug. On startup, auctionMonitor creates a java.util.Timer and an associated Thread new Timer().scheduleAtFixedRate(new TimerTask() { ... The ContextClassLoader of this Thread is the webapp classloader and keeps the ICEfaces classes locked in PermGen. Since auctionMonitor is now essentially resetting itself correctly and does not allow excessively large bids, the best approach is likely to disable the timed reset functionality.
        Hide
        Ted Goddard added a comment -

        Information on the technique used to debug the leak:

        jmap -dump:format=b,file=leak 29142
        jhat -J-Xmx512m leak

        Show
        Ted Goddard added a comment - Information on the technique used to debug the leak: jmap -dump:format=b,file=leak 29142 jhat -J-Xmx512m leak
        Hide
        Ted Goddard added a comment -

        Application-level fix seems to resolve the issue. Commented out the offending code rather than removing it to serve as a warning.

        Testing with component-showcase (fetching only the initial page, not testing using a full browser) shows no redeployment memory leak.

        So, it seems that this leak was specific to auctionMonitor.

        Show
        Ted Goddard added a comment - Application-level fix seems to resolve the issue. Commented out the offending code rather than removing it to serve as a warning. Testing with component-showcase (fetching only the initial page, not testing using a full browser) shows no redeployment memory leak. So, it seems that this leak was specific to auctionMonitor.
        Ted Goddard made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.6DR#5 [ 10071 ]
        Resolution Fixed [ 1 ]
        Ken Fyten made changes -
        Fix Version/s 1.6 [ 10031 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #23197 Wed Nov 24 10:57:19 MST 2010 carlo.guglielmin Re-added nightly TimerTask that resets the auction items. This was previously removed because of an obscure 2007 bug ICE-1613. Also added cleanup methods for btoh the clock thread and this new reset timer thread
        Files Changed
        Commit graph MODIFY /icefaces2/trunk/icefaces/compat/samples/auctionMonitor/src/com/icesoft/applications/faces/auctionMonitor/beans/ClockBean.java
        Commit graph MODIFY /icefaces2/trunk/icefaces/compat/samples/auctionMonitor/src/com/icesoft/applications/faces/auctionMonitor/beans/LogBean.java

          People

          • Assignee:
            Unassigned
            Reporter:
            Ted Goddard
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: