You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Craig Cobb (JIRA)" <ji...@apache.org> on 2008/09/09 04:45:52 UTC

[jira] Created: (SM-1560) Items not removed from BeanEndpoint requests Map in all cases of request completion

Items not removed from BeanEndpoint requests Map in all cases of request completion 
------------------------------------------------------------------------------------

                 Key: SM-1560
                 URL: https://issues.apache.org/activemq/browse/SM-1560
             Project: ServiceMix
          Issue Type: Bug
          Components: servicemix-bean
    Affects Versions: 3.2.2
            Reporter: Craig Cobb


Memory leak caused by Request objects not being removed from "requests" Map in all cases.  Requests not removed results in memory leak.

Patch info:

### Eclipse Workspace Patch 1.0
#P servicemix-3.2
Index: deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java
===================================================================
--- deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java	(revision 693290)
+++ deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java	(working copy)
@@ -236,13 +236,16 @@
             } else {
                 // Exchange is finished
                 if (exchange.getStatus() == ExchangeStatus.DONE) {
+                    requests.remove(corId);
                     return;
                 // Exchange has been aborted with an exception
                 } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
+                    requests.remove(corId);
                     return;
                 // Fault message
                 } else if (exchange.getFault() != null) {
                     // TODO: find a way to send it back to the bean before setting the DONE status
+                    requests.remove(corId);
                     done(exchange);
                 } else {
                     MethodInvocation invocation = getMethodInvocationStrategy().createInvocation(



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


[jira] Updated: (SMXCOMP-24) Items not removed from BeanEndpoint requests Map in all cases of request completion

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

Gert Vanthienen updated SMXCOMP-24:
-----------------------------------

    Attachment: SMXCOMP-24.diff

Another failed attempt to reproduce the issue: it now has two tests, one where the exchange is being sent by a client and another where a consumer bean is sending the initial request.

> Items not removed from BeanEndpoint requests Map in all cases of request completion 
> ------------------------------------------------------------------------------------
>
>                 Key: SMXCOMP-24
>                 URL: https://issues.apache.org/activemq/browse/SMXCOMP-24
>             Project: ServiceMix Components
>          Issue Type: Bug
>          Components: servicemix-bean
>    Affects Versions: 3.2.2
>            Reporter: Craig Cobb
>         Attachments: BeanEndpointPatch.txt, SMXCOMP-24.diff, SMXCOMP-24.diff
>
>
> Memory leak caused by Request objects not being removed from "requests" Map in all cases.  Requests not removed results in memory leak.
> Patch info:
> {code}
> ### Eclipse Workspace Patch 1.0
> #P servicemix-3.2
> Index: deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java
> ===================================================================
> --- deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java	(revision 693290)
> +++ deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java	(working copy)
> @@ -236,13 +236,16 @@
>              } else {
>                  // Exchange is finished
>                  if (exchange.getStatus() == ExchangeStatus.DONE) {
> +                    requests.remove(corId);
>                      return;
>                  // Exchange has been aborted with an exception
>                  } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
> +                    requests.remove(corId);
>                      return;
>                  // Fault message
>                  } else if (exchange.getFault() != null) {
>                      // TODO: find a way to send it back to the bean before setting the DONE status
> +                    requests.remove(corId);
>                      done(exchange);
>                  } else {
>                      MethodInvocation invocation = getMethodInvocationStrategy().createInvocation(
> {code}

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


[jira] Updated: (SM-1560) Items not removed from BeanEndpoint requests Map in all cases of request completion

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

Guillaume Nodet updated SM-1560:
--------------------------------

    Description: 
Memory leak caused by Request objects not being removed from "requests" Map in all cases.  Requests not removed results in memory leak.

Patch info:
{code}
### Eclipse Workspace Patch 1.0
#P servicemix-3.2
Index: deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java
===================================================================
--- deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java	(revision 693290)
+++ deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java	(working copy)
@@ -236,13 +236,16 @@
             } else {
                 // Exchange is finished
                 if (exchange.getStatus() == ExchangeStatus.DONE) {
+                    requests.remove(corId);
                     return;
                 // Exchange has been aborted with an exception
                 } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
+                    requests.remove(corId);
                     return;
                 // Fault message
                 } else if (exchange.getFault() != null) {
                     // TODO: find a way to send it back to the bean before setting the DONE status
+                    requests.remove(corId);
                     done(exchange);
                 } else {
                     MethodInvocation invocation = getMethodInvocationStrategy().createInvocation(
{code}


  was:
Memory leak caused by Request objects not being removed from "requests" Map in all cases.  Requests not removed results in memory leak.

Patch info:

### Eclipse Workspace Patch 1.0
#P servicemix-3.2
Index: deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java
===================================================================
--- deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java	(revision 693290)
+++ deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java	(working copy)
@@ -236,13 +236,16 @@
             } else {
                 // Exchange is finished
                 if (exchange.getStatus() == ExchangeStatus.DONE) {
+                    requests.remove(corId);
                     return;
                 // Exchange has been aborted with an exception
                 } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
+                    requests.remove(corId);
                     return;
                 // Fault message
                 } else if (exchange.getFault() != null) {
                     // TODO: find a way to send it back to the bean before setting the DONE status
+                    requests.remove(corId);
                     done(exchange);
                 } else {
                     MethodInvocation invocation = getMethodInvocationStrategy().createInvocation(




> Items not removed from BeanEndpoint requests Map in all cases of request completion 
> ------------------------------------------------------------------------------------
>
>                 Key: SM-1560
>                 URL: https://issues.apache.org/activemq/browse/SM-1560
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-bean
>    Affects Versions: 3.2.2
>            Reporter: Craig Cobb
>         Attachments: BeanEndpointPatch.txt
>
>
> Memory leak caused by Request objects not being removed from "requests" Map in all cases.  Requests not removed results in memory leak.
> Patch info:
> {code}
> ### Eclipse Workspace Patch 1.0
> #P servicemix-3.2
> Index: deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java
> ===================================================================
> --- deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java	(revision 693290)
> +++ deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java	(working copy)
> @@ -236,13 +236,16 @@
>              } else {
>                  // Exchange is finished
>                  if (exchange.getStatus() == ExchangeStatus.DONE) {
> +                    requests.remove(corId);
>                      return;
>                  // Exchange has been aborted with an exception
>                  } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
> +                    requests.remove(corId);
>                      return;
>                  // Fault message
>                  } else if (exchange.getFault() != null) {
>                      // TODO: find a way to send it back to the bean before setting the DONE status
> +                    requests.remove(corId);
>                      done(exchange);
>                  } else {
>                      MethodInvocation invocation = getMethodInvocationStrategy().createInvocation(
> {code}

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


[jira] Commented: (SMXCOMP-24) Items not removed from BeanEndpoint requests Map in all cases of request completion

Posted by "Stuart Roe (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMXCOMP-24?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56170#action_56170 ] 

Stuart Roe commented on SMXCOMP-24:
-----------------------------------

I have also encountered the issue with async replies (as described by Nathan. Changing the reply to sendSync fixes the leak. I think that there is another leak involving the classes: java.util.HashMap$Entry, org.apache.activemq.command.ConsumerId, org.apache.activemq.command.SessionId and org.apache.activemq.command.ConnectionId.


> Items not removed from BeanEndpoint requests Map in all cases of request completion 
> ------------------------------------------------------------------------------------
>
>                 Key: SMXCOMP-24
>                 URL: https://issues.apache.org/activemq/browse/SMXCOMP-24
>             Project: ServiceMix Components
>          Issue Type: Bug
>          Components: servicemix-bean
>    Affects Versions: 3.2.2
>            Reporter: Craig Cobb
>         Attachments: BeanEndpointPatch.txt
>
>
> Memory leak caused by Request objects not being removed from "requests" Map in all cases.  Requests not removed results in memory leak.
> Patch info:
> {code}
> ### Eclipse Workspace Patch 1.0
> #P servicemix-3.2
> Index: deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java
> ===================================================================
> --- deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java	(revision 693290)
> +++ deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java	(working copy)
> @@ -236,13 +236,16 @@
>              } else {
>                  // Exchange is finished
>                  if (exchange.getStatus() == ExchangeStatus.DONE) {
> +                    requests.remove(corId);
>                      return;
>                  // Exchange has been aborted with an exception
>                  } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
> +                    requests.remove(corId);
>                      return;
>                  // Fault message
>                  } else if (exchange.getFault() != null) {
>                      // TODO: find a way to send it back to the bean before setting the DONE status
> +                    requests.remove(corId);
>                      done(exchange);
>                  } else {
>                      MethodInvocation invocation = getMethodInvocationStrategy().createInvocation(
> {code}

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


[jira] Updated: (SM-1560) Items not removed from BeanEndpoint requests Map in all cases of request completion

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

Craig Cobb updated SM-1560:
---------------------------

    Attachment: BeanEndpointPatch.txt

Patch on file instead of workspace.

> Items not removed from BeanEndpoint requests Map in all cases of request completion 
> ------------------------------------------------------------------------------------
>
>                 Key: SM-1560
>                 URL: https://issues.apache.org/activemq/browse/SM-1560
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-bean
>    Affects Versions: 3.2.2
>            Reporter: Craig Cobb
>         Attachments: BeanEndpointPatch.txt
>
>
> Memory leak caused by Request objects not being removed from "requests" Map in all cases.  Requests not removed results in memory leak.
> Patch info:
> ### Eclipse Workspace Patch 1.0
> #P servicemix-3.2
> Index: deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java
> ===================================================================
> --- deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java	(revision 693290)
> +++ deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java	(working copy)
> @@ -236,13 +236,16 @@
>              } else {
>                  // Exchange is finished
>                  if (exchange.getStatus() == ExchangeStatus.DONE) {
> +                    requests.remove(corId);
>                      return;
>                  // Exchange has been aborted with an exception
>                  } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
> +                    requests.remove(corId);
>                      return;
>                  // Fault message
>                  } else if (exchange.getFault() != null) {
>                      // TODO: find a way to send it back to the bean before setting the DONE status
> +                    requests.remove(corId);
>                      done(exchange);
>                  } else {
>                      MethodInvocation invocation = getMethodInvocationStrategy().createInvocation(

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


[jira] Commented: (SMXCOMP-24) Items not removed from BeanEndpoint requests Map in all cases of request completion

Posted by "Nathan Ferris (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMXCOMP-24?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=51766#action_51766 ] 

Nathan Ferris commented on SMXCOMP-24:
--------------------------------------

I have run into this issue as well and independently came to the conclusion that my BeanEndpoint was leaking Request objects.  I am using version 2009.01 of servicemix-bean

The Bean that I am using implements MessageExchangeListener, so it wouldn't ever get into the enclosing else block from Craig's patch.  The if block above it looks like this: 

if (req.getBean() instanceof MessageExchangeListener) {
                ((MessageExchangeListener) req.getBean()).onMessageExchange(exchange);
} else ....

In this case, the bean has no access to the requests member variable and thus can't remove the request itself.  Suppose that the provider bean sends a reply message asynchronously.  Since the exchange will not yet be marked done, it will be stored in requests.  Later, when the consumer marks the exchange as done, which sends an exchange back to the provider, the exchange will come through as a new object.  The new exchange object is marked as done, but the original, which is still in the requests map, is still marked as active, which prevents it from being removed.

> Items not removed from BeanEndpoint requests Map in all cases of request completion 
> ------------------------------------------------------------------------------------
>
>                 Key: SMXCOMP-24
>                 URL: https://issues.apache.org/activemq/browse/SMXCOMP-24
>             Project: ServiceMix Components
>          Issue Type: Bug
>          Components: servicemix-bean
>    Affects Versions: 3.2.2
>            Reporter: Craig Cobb
>         Attachments: BeanEndpointPatch.txt
>
>
> Memory leak caused by Request objects not being removed from "requests" Map in all cases.  Requests not removed results in memory leak.
> Patch info:
> {code}
> ### Eclipse Workspace Patch 1.0
> #P servicemix-3.2
> Index: deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java
> ===================================================================
> --- deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java	(revision 693290)
> +++ deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java	(working copy)
> @@ -236,13 +236,16 @@
>              } else {
>                  // Exchange is finished
>                  if (exchange.getStatus() == ExchangeStatus.DONE) {
> +                    requests.remove(corId);
>                      return;
>                  // Exchange has been aborted with an exception
>                  } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
> +                    requests.remove(corId);
>                      return;
>                  // Fault message
>                  } else if (exchange.getFault() != null) {
>                      // TODO: find a way to send it back to the bean before setting the DONE status
> +                    requests.remove(corId);
>                      done(exchange);
>                  } else {
>                      MethodInvocation invocation = getMethodInvocationStrategy().createInvocation(
> {code}

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


[jira] Updated: (SMXCOMP-24) Items not removed from BeanEndpoint requests Map in all cases of request completion

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

Gert Vanthienen updated SMXCOMP-24:
-----------------------------------

    Attachment: SMXCOMP-24.diff

I would have thought this issue would have been exposed through the unit test in the attached diff file, but the test passes.
I made sure to only use send() and no sendSync() but perhaps I'm missing the point somewhere.

> Items not removed from BeanEndpoint requests Map in all cases of request completion 
> ------------------------------------------------------------------------------------
>
>                 Key: SMXCOMP-24
>                 URL: https://issues.apache.org/activemq/browse/SMXCOMP-24
>             Project: ServiceMix Components
>          Issue Type: Bug
>          Components: servicemix-bean
>    Affects Versions: 3.2.2
>            Reporter: Craig Cobb
>         Attachments: BeanEndpointPatch.txt, SMXCOMP-24.diff
>
>
> Memory leak caused by Request objects not being removed from "requests" Map in all cases.  Requests not removed results in memory leak.
> Patch info:
> {code}
> ### Eclipse Workspace Patch 1.0
> #P servicemix-3.2
> Index: deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java
> ===================================================================
> --- deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java	(revision 693290)
> +++ deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java	(working copy)
> @@ -236,13 +236,16 @@
>              } else {
>                  // Exchange is finished
>                  if (exchange.getStatus() == ExchangeStatus.DONE) {
> +                    requests.remove(corId);
>                      return;
>                  // Exchange has been aborted with an exception
>                  } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
> +                    requests.remove(corId);
>                      return;
>                  // Fault message
>                  } else if (exchange.getFault() != null) {
>                      // TODO: find a way to send it back to the bean before setting the DONE status
> +                    requests.remove(corId);
>                      done(exchange);
>                  } else {
>                      MethodInvocation invocation = getMethodInvocationStrategy().createInvocation(
> {code}

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


[jira] Commented: (SMXCOMP-24) Items not removed from BeanEndpoint requests Map in all cases of request completion

Posted by "Ryan Mayo (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMXCOMP-24?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=50866#action_50866 ] 

Ryan Mayo commented on SMXCOMP-24:
----------------------------------

I think the solution also needs to set the currentRequest to null otherwise a previous request can also be left for later exchange.

Its probably best to just put the last to lines of the synchoronize block inside a finally block.  i.e.:

finally {
	checkEndOfRequest(req);
        currentRequest.set(null);
}

this should solve the memory leak as well as clean up the currentRequest.



> Items not removed from BeanEndpoint requests Map in all cases of request completion 
> ------------------------------------------------------------------------------------
>
>                 Key: SMXCOMP-24
>                 URL: https://issues.apache.org/activemq/browse/SMXCOMP-24
>             Project: ServiceMix Components
>          Issue Type: Bug
>          Components: servicemix-bean
>    Affects Versions: 3.2.2
>            Reporter: Craig Cobb
>         Attachments: BeanEndpointPatch.txt
>
>
> Memory leak caused by Request objects not being removed from "requests" Map in all cases.  Requests not removed results in memory leak.
> Patch info:
> {code}
> ### Eclipse Workspace Patch 1.0
> #P servicemix-3.2
> Index: deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java
> ===================================================================
> --- deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java	(revision 693290)
> +++ deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java	(working copy)
> @@ -236,13 +236,16 @@
>              } else {
>                  // Exchange is finished
>                  if (exchange.getStatus() == ExchangeStatus.DONE) {
> +                    requests.remove(corId);
>                      return;
>                  // Exchange has been aborted with an exception
>                  } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
> +                    requests.remove(corId);
>                      return;
>                  // Fault message
>                  } else if (exchange.getFault() != null) {
>                      // TODO: find a way to send it back to the bean before setting the DONE status
> +                    requests.remove(corId);
>                      done(exchange);
>                  } else {
>                      MethodInvocation invocation = getMethodInvocationStrategy().createInvocation(
> {code}

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