Camel
  1. Camel
  2. CAMEL-5086

Archetype: camel-archetype-web retains loaded classes after redeployment, causing permgen space to fill up.

    Details

    • Estimated Complexity:
      Unknown

      Description

      Steps to reproduce:
      1. Create a new camel web project (based on instructions here: http://camel.apache.org/camel-maven-archetypes.html ):

      mvn archetype:generate -DarchetypeGroupId=org.apache.camel.archetypes -DarchetypeArtifactId=camel-archetype-web -DarchetypeVersion=2.9.1 -DarchetypeRepository=https://repository.apache.org/content/groups/snapshots-group

      2. Build the new project:
      mvn clean install

      3. Copy .war file in target/ to tomcat's webapps directory.
      4. Reload webapp (easiest way is to touch the .war file)
      5. If you are using a profiler, you will see that the permgen space increases on every reload (the previous webapp's classes don't get unloaded)
      6. Eventually the webapp container will crash with a permgen out of memory error.

      Workaround: restarting the webapp container will reset the permgen space.
      Removing the Spring nature of the project makes this go away, so it could be a problem with Spring itself.

      This also happens when using Jetty7, so I don't think it is a problem with the container.

      1. tomcat2.png
        21 kB
        Claus Ibsen
      2. tomcat.png
        24 kB
        Claus Ibsen

        Activity

        Dan Richelson created issue -
        Dan Richelson made changes -
        Field Original Value New Value
        Description Steps to reproduce:
        1. Create a new camel web project (based on instructions here: http://camel.apache.org/camel-maven-archetypes.html):

        mvn archetype:generate -DarchetypeGroupId=org.apache.camel.archetypes -DarchetypeArtifactId=camel-archetype-web -DarchetypeVersion=2.9.1 -DarchetypeRepository=https://repository.apache.org/content/groups/snapshots-group

        2. Build the new project:
        mvn clean install

        3. Copy .war file in target/ to tomcat's webapps directory.
        4. Reload webapp (easiest way is to touch the .war file)
        5. If you are using a profiler, you will see that the permgen space increases on every reload (the previous webapp's classes don't get unloaded)
        6. Eventually the webapp container will crash with a permgen out of memory error.

        Workaround: restarting the webapp container will reset the permgen space.
        Removing the Spring nature of the project makes this go away, so it could be a problem with Spring itself.

        This also happens when using Jetty7, so I don't think it is a problem with the container.

        Steps to reproduce:
        1. Create a new camel web project (based on instructions here: http://camel.apache.org/camel-maven-archetypes.html ):

        mvn archetype:generate -DarchetypeGroupId=org.apache.camel.archetypes -DarchetypeArtifactId=camel-archetype-web -DarchetypeVersion=2.9.1 -DarchetypeRepository=https://repository.apache.org/content/groups/snapshots-group

        2. Build the new project:
        mvn clean install

        3. Copy .war file in target/ to tomcat's webapps directory.
        4. Reload webapp (easiest way is to touch the .war file)
        5. If you are using a profiler, you will see that the permgen space increases on every reload (the previous webapp's classes don't get unloaded)
        6. Eventually the webapp container will crash with a permgen out of memory error.

        Workaround: restarting the webapp container will reset the permgen space.
        Removing the Spring nature of the project makes this go away, so it could be a problem with Spring itself.

        This also happens when using Jetty7, so I don't think it is a problem with the container.

        Claus Ibsen made changes -
        Comment [ Why do you want to use the Camel web console embedded with your application?
        You drag in the web console, that uses scala, scalete, jersey, and whatnot. All libraries that may have a leak somewhere.
        The Camel web console is not really ment for production usage, but a developer consoler for trying out stuff with Camel.

        I suggest to use this tutorial, and just use a plain war project
        http://camel.apache.org/tutorial-on-using-camel-in-a-web-application.html

        ]
        Hide
        Claus Ibsen added a comment -

        I suggest to attach jvisualvm to the tomcat container and try to see if you can spot any leaks?

        Show
        Claus Ibsen added a comment - I suggest to attach jvisualvm to the tomcat container and try to see if you can spot any leaks?
        Claus Ibsen made changes -
        Assignee Claus Ibsen [ davsclaus ]
        Hide
        Claus Ibsen added a comment -

        We have fixed a number of leaks on trunk. I suggest to try the upcoming 2.10 release. Or the 2.9.2 release.

        I just tried with 2.10 and could not detect any leaks. I touched the web app 5 times

        davsclaus:/opt/apache-tomcat-7.0.26/webapps$ touch bar-1.0-SNAPSHOT.war 
        davsclaus:/opt/apache-tomcat-7.0.26/webapps$ touch bar-1.0-SNAPSHOT.war 
        davsclaus:/opt/apache-tomcat-7.0.26/webapps$ touch bar-1.0-SNAPSHOT.war 
        davsclaus:/opt/apache-tomcat-7.0.26/webapps$ touch bar-1.0-SNAPSHOT.war 
        davsclaus:/opt/apache-tomcat-7.0.26/webapps$ touch bar-1.0-SNAPSHOT.war 
        

        And memory usage was low. When performing a GC I get down to 7-8mb.

        Show
        Claus Ibsen added a comment - We have fixed a number of leaks on trunk. I suggest to try the upcoming 2.10 release. Or the 2.9.2 release. I just tried with 2.10 and could not detect any leaks. I touched the web app 5 times davsclaus:/opt/apache-tomcat-7.0.26/webapps$ touch bar-1.0-SNAPSHOT.war davsclaus:/opt/apache-tomcat-7.0.26/webapps$ touch bar-1.0-SNAPSHOT.war davsclaus:/opt/apache-tomcat-7.0.26/webapps$ touch bar-1.0-SNAPSHOT.war davsclaus:/opt/apache-tomcat-7.0.26/webapps$ touch bar-1.0-SNAPSHOT.war davsclaus:/opt/apache-tomcat-7.0.26/webapps$ touch bar-1.0-SNAPSHOT.war And memory usage was low. When performing a GC I get down to 7-8mb.
        Claus Ibsen made changes -
        Attachment tomcat.png [ 12519026 ]
        Claus Ibsen made changes -
        Attachment tomcat2.png [ 12519027 ]
        Hide
        Claus Ibsen added a comment -

        And my permgen, was not leaking, and getting down to 31mb - see tomcat2

        Show
        Claus Ibsen added a comment - And my permgen, was not leaking, and getting down to 31mb - see tomcat2
        Claus Ibsen made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.10.0 [ 12317612 ]
        Resolution Fixed [ 1 ]
        Hide
        Claus Ibsen added a comment -

        I am trying with the 2.9-SNAPSHOT to see how it goes there.

        Show
        Claus Ibsen added a comment - I am trying with the 2.9-SNAPSHOT to see how it goes there.
        Hide
        Claus Ibsen added a comment -

        Looks fine with the 2.9-SNAPSHOT (to be 2.9.2 release).

        Show
        Claus Ibsen added a comment - Looks fine with the 2.9-SNAPSHOT (to be 2.9.2 release).
        Claus Ibsen made changes -
        Fix Version/s 2.9.2 [ 12320143 ]

          People

          • Assignee:
            Claus Ibsen
            Reporter:
            Dan Richelson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development