You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2010/02/18 10:22:40 UTC

[jira] Created: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

camel-mina - Using close session could potentially cause memory to be not released
----------------------------------------------------------------------------------

                 Key: CAMEL-2484
                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
             Project: Apache Camel
          Issue Type: Bug
          Components: camel-mina
    Affects Versions: 2.2.0, 2.1.0
            Reporter: Claus Ibsen
             Fix For: 2.3.0


See nabble
http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Commented: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Stan Lewis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57705#action_57705 ] 

Stan Lewis commented on CAMEL-2484:
-----------------------------------

That sounds like an excellent fit, I can look into that as part of tidying up the RecipientList...

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Commented: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Stan Lewis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57699#action_57699 ] 

Stan Lewis commented on CAMEL-2484:
-----------------------------------

@Claus, thanks!  I'll look into getting the RecipientList working properly with the cache, did a long-running test last night with Johan's test case just to verify that's the issue, and I didn't get any OOMs, but creating/destroying the producers with each exchange is definitely expensive and can cause other problems.

@Johan, in case you need something running right away you should be able to avoid this problem for now by replacing the RecipientList with a simple processor that looks at the header and uses a producer template to send on the message, the producer template uses the cache properly.  I'll of course update the ticket when I get this fixed...

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Commented: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Stan Lewis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57702#action_57702 ] 

Stan Lewis commented on CAMEL-2484:
-----------------------------------

I was thinking that yesterday and had even added a "removeService()" method to CamelContext and implemented it so that when you remove a service it's then stopped etc.  Guess you could have a thread that keeps an eye on this list and let it periodically garbage collect LRU services.  It'd be another thing to tune though, in a case like this you could hit an OOM before the list is checked for old services.

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Commented: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Stan Lewis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57762#action_57762 ] 

Stan Lewis commented on CAMEL-2484:
-----------------------------------

@Claus, ah, okay your fix also changes the behavior of the test also, but I like your fix better anyway.  I've modified the test case so that new messages are pumped into the route every second so it keeps running, will let this run for awhile and see if anything happens.

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Commented: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57719#action_57719 ] 

Claus Ibsen commented on CAMEL-2484:
------------------------------------

And by *not* adding it as a {{service}} in the {{servicesToClose}} we avoid Camel holding on the producers forever :)
That just means we loose a little JMX capabilities as you cant manage those created producers then

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Updated: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Johan Haleby (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Johan Haleby updated CAMEL-2484:
--------------------------------

    Attachment: java_pid26327.hprof.tar.gz

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Commented: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57700#action_57700 ] 

Claus Ibsen commented on CAMEL-2484:
------------------------------------

I wonder if the servicesToClose should be a LRUCache which we then can stop the service then an item is evicted. That will prevent similar issues in the future.

Maybe I should go check the source code of DefaultCamelContext :)

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Commented: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Stan Lewis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57731#action_57731 ] 

Stan Lewis commented on CAMEL-2484:
-----------------------------------

figured you'd beat me to it :-).  I'll give it a good long test on Monday and have a look at what you changed...

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Commented: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57710#action_57710 ] 

Claus Ibsen commented on CAMEL-2484:
------------------------------------

Stan I just realized that {{servicesToClose}} contains some mandatory services which *must* be running and only stopped when CamelContext stops. Its things like the registry, type converter, inflight registry and whatnot.

So we should look to put those into a *mandatory* List and the others in a *limited* list for reusing purpose.

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Commented: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57720#action_57720 ] 

Claus Ibsen commented on CAMEL-2484:
------------------------------------

This bug is only a problem when using
- recipinentList
- non singleton producers which there are only a few ones such as: FTP and MINA

The other components should be safe to use with recipientList

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Commented: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Stan Lewis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57721#action_57721 ] 

Stan Lewis commented on CAMEL-2484:
-----------------------------------

Hey Claus, makes sense to me.  I've been toying with a tentative set of "borrowProducer"/"returnProducer" methods here on the producerCache so that the recipient list gets it from the pool but for some reason the test case appears to lock up.  Haven't had a chance to see why that is, I'd be interested if you get the same results.

Also I think the test case may expose a couple other leaks, though this was from earlier testing where I just ensured servicesToClose wasn't getting filled with MinaProducers.  If you come up with a fix though before I get a chance to work on this further I'd be happy to give the test case a long run just to see if any other issues crop up.

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Resolved: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-2484.
--------------------------------

    Resolution: Fixed

Stan that is great.

Yeah it was a bad move by Claus to enlist Producer's for management ;). Wonder how we slipped this for 2 releases?

I actually think we should just enlist producers only if CamelContext is in state of starting. Then we get the starting Producers enlisted which are the ones in your routes (eg in the to(xxx)).

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Updated: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Johan Haleby (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Johan Haleby updated CAMEL-2484:
--------------------------------

    Attachment: camel-mina-outofmemory-example.zip

Small example that demonstrates the out of memory issue. You should lower the heap to see the result faster.

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Assigned: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Stan Lewis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stan Lewis reassigned CAMEL-2484:
---------------------------------

    Assignee: Stan Lewis

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Commented: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Stan Lewis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57776#action_57776 ] 

Stan Lewis commented on CAMEL-2484:
-----------------------------------

Let a test run all morning here with the above changes and Claus's fix, no OOMs and memory usage remained in a stable pattern, so this should be all set.

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Commented: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57723#action_57723 ] 

Claus Ibsen commented on CAMEL-2484:
------------------------------------

Stan maybe I had better luck than you with the acquire / release thingy.

I have just committed a patch.

ProducerCache will no longer add created producers for management (with does not make too much sense as JMX can then grow too much).
Also I fixed an issue with stopping cached resources if they where cached using a LRUCache.
Now Camel should properly stop cached producers when being stopped.

Please give it a test on your system as well. For example the long running example.

trunk: 912103.

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Commented: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Johan Haleby (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57667#action_57667 ] 

Johan Haleby commented on CAMEL-2484:
-------------------------------------

Done.

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Commented: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57718#action_57718 ] 

Claus Ibsen commented on CAMEL-2484:
------------------------------------

Ah the MinaProducer is non singleton and {{ServicePoolAware}} which the {{receipientList}} does not take into account. 

It should be able to acquire and release the producers it uses. I will add such a feature. Then that will speedup using mina as it can pool and reuse the MinaProducers.

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Commented: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Stan Lewis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57765#action_57765 ] 

Stan Lewis commented on CAMEL-2484:
-----------------------------------

Seems to be a leak in either maven or log4j that this test exposes, if I set the root logger to DEBUG it gets an OOM pretty quickly, have changed the log4j.properties to log to a file instead, that seems to have taken care of that problem, now just waiting to see if there's any other issues.

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Issue Comment Edited: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57723#action_57723 ] 

Claus Ibsen edited comment on CAMEL-2484 at 2/20/10 12:00 PM:
--------------------------------------------------------------

Stan maybe I had better luck than you with the acquire / release thingy.

I have just committed a patch.

ProducerCache will no longer add created producers for management (with does not make too much sense as JMX can then grow too much).
Also I fixed an issue with stopping cached resources if they where cached using a LRUCache.
Now Camel should properly stop cached producers when being stopped.

Please give it a test on your system as well. For example the long running example.

trunk: 912103 + 912105

      was (Author: davsclaus):
    Stan maybe I had better luck than you with the acquire / release thingy.

I have just committed a patch.

ProducerCache will no longer add created producers for management (with does not make too much sense as JMX can then grow too much).
Also I fixed an issue with stopping cached resources if they where cached using a LRUCache.
Now Camel should properly stop cached producers when being stopped.

Please give it a test on your system as well. For example the long running example.

trunk: 912103.
  
> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Commented: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57703#action_57703 ] 

Claus Ibsen commented on CAMEL-2484:
------------------------------------

We got a LRUCache that is map based. I recon we can create some bounded List and have a callback when its full so it can auto remove the oldest which it then will close the service.

Then there is no need for a background thread.



> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Commented: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Stan Lewis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57665#action_57665 ] 

Stan Lewis commented on CAMEL-2484:
-----------------------------------

Hey Johan, you mentioned in the thread you've got a heapdump that you can attach, would you mind attaching it?  I wouldn't mind starting with that here to track this down.

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Commented: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57686#action_57686 ] 

Claus Ibsen commented on CAMEL-2484:
------------------------------------

Well spotted. Yeah we should ensure the cache is properly used. Some producers are expensive to create such as FTP, JMS etc. And very often the recipient list is sending to the same endpoints over and over again, and thus the cache idea is good.

BTW the routing slip could very well have the same issue.

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Commented: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57717#action_57717 ] 

Claus Ibsen commented on CAMEL-2484:
------------------------------------

Had a look this morning. I can now see how the recipient list *doesnt* used pooled producers and thus it recreates a new producer every time.

And at the same time the old producer is added as a service which allows Camel to manage it, but that should not happen as the producer if not pooled is a short lived service.

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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


[jira] Commented: (CAMEL-2484) camel-mina - Using close session could potentially cause memory to be not released

Posted by "Stan Lewis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57678#action_57678 ] 

Stan Lewis commented on CAMEL-2484:
-----------------------------------

So the problem is thanks to the RecipientList.  It obtains a producer from the ProducerCache directly, in this case the ProducerCache doesn't actually cache the producer, it just creates a new producer and adds it to DefaultCamelContext.servicesToClose, which winds up holding thousands of MinaProducer objects.  It looks like really the RecipientList is better off just calling Endpoint.createProducer() and avoiding the producer cache altogether, *or* the RecipientList could ensure that each producer is removed from the CamelContext (am testing this now just to be sure it fixes the OOM) *or* the RecipientList could use a bit of a re-factoring so that it uses the ProducerCache properly.

> camel-mina - Using close session could potentially cause memory to be not released
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-2484
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2484
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-mina
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Claus Ibsen
>            Assignee: Stan Lewis
>             Fix For: 2.3.0
>
>         Attachments: camel-mina-outofmemory-example.zip, java_pid26327.hprof.tar.gz
>
>
> See nabble
> http://old.nabble.com/SocketSessionImpl-in-Mina-component-retained-in-memory-indefinitely-ts27624487.html

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