Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.6.0
    • Fix Version/s: 1.6.2, 2.0-M3
    • Component/s: camel-core, jmx
    • Labels:
      None
    • Environment:

      WinXP, Java 1.6

      Description

      There seems to be a memory leak if you are using recipientList and JMX enabled. The problem is that endpoint MBean name computed by using hashCode, if there is lot of different endpoints (created on runtime) every new endpoint will create a new MBean instance.
      Also in recipientList every entry will create new endpoint.
      In example if we have 3 urls ;
      http://host/index?id=1
      http://host/index?id=2
      http://host/index?id=3
      Camel will add 3 different MBeans entry to JMX. As url parameters are normally unique then camel will end up with creating thousands of endpoint entries. But every MBean takes memory.

      1. JConsole.jpg
        231 kB
        Andres
      2. MemLeak.java
        1 kB
        Andres
      3. Picture 1.png
        26 kB
        Claus Ibsen

        Activity

        Hide
        Claus Ibsen added a comment -

        Closing all 2.0M3 tickets

        Show
        Claus Ibsen added a comment - Closing all 2.0M3 tickets
        Hide
        Claus Ibsen added a comment -

        jconsole with Camel 1.6.2 showing that the http endpoints is only registered once.

        Show
        Claus Ibsen added a comment - jconsole with Camel 1.6.2 showing that the http endpoints is only registered once.
        Hide
        Claus Ibsen added a comment -

        Fixed by CAMEL-1771

        Show
        Claus Ibsen added a comment - Fixed by CAMEL-1771
        Hide
        Claus Ibsen added a comment -

        The direct component does not have its consumer named nicely as its an anonymous inner class. I am fixing this.

        Show
        Claus Ibsen added a comment - The direct component does not have its consumer named nicely as its an anonymous inner class. I am fixing this.
        Hide
        Claus Ibsen added a comment -

        Its kinda like the issue with seda component as well.

        We should have a new method on Endpoint to compute a key for the JMX bean to use.
        getEndpointKey()
        Then all your http endpoints can share the same JMX bean.

        But each endpoint is registered individually in the endpoint cache as they are different as they have a different id parameter.

        Thanks for the unit test. It uses about 50mb more memory with or without the patch on my laptop.

        Show
        Claus Ibsen added a comment - Its kinda like the issue with seda component as well. We should have a new method on Endpoint to compute a key for the JMX bean to use. getEndpointKey() Then all your http endpoints can share the same JMX bean. But each endpoint is registered individually in the endpoint cache as they are different as they have a different id parameter. Thanks for the unit test. It uses about 50mb more memory with or without the patch on my laptop.
        Hide
        Claus Ibsen added a comment -

        I guess some endpoints should not consider parameters and others should as they could differ.

        The http should obviously not consider parameters.

        Show
        Claus Ibsen added a comment - I guess some endpoints should not consider parameters and others should as they could differ. The http should obviously not consider parameters.
        Hide
        Claus Ibsen added a comment -

        Sorry this is JMX registering new endpoints all the time

        Show
        Claus Ibsen added a comment - Sorry this is JMX registering new endpoints all the time
        Hide
        Claus Ibsen added a comment -

        Duplicate of CAMEL-1771

        Show
        Claus Ibsen added a comment - Duplicate of CAMEL-1771
        Hide
        Claus Ibsen added a comment -

        Thanks for reporting.

        JMX is scheduled for an overhaul in Camel 2.1

        Show
        Claus Ibsen added a comment - Thanks for reporting. JMX is scheduled for an overhaul in Camel 2.1
        Hide
        Andres added a comment -

        Temporary workaround that works for me is to overwrite CamelNamingStrategy via custom lifecycleStrategy bean.

        My custom CamelNamingStrategy overwrites getEndpointId and computes EndpointId so that url parameters not considered.

        Show
        Andres added a comment - Temporary workaround that works for me is to overwrite CamelNamingStrategy via custom lifecycleStrategy bean. My custom CamelNamingStrategy overwrites getEndpointId and computes EndpointId so that url parameters not considered.
        Hide
        Andres added a comment -

        JConsole picture

        Show
        Andres added a comment - JConsole picture
        Hide
        Andres added a comment -

        Example class to reproduce problem

        Show
        Andres added a comment - Example class to reproduce problem

          People

          • Assignee:
            Claus Ibsen
            Reporter:
            Andres
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development