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

        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).
        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.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: