You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Guillaume Nodet (JIRA)" <ji...@apache.org> on 2008/06/17 15:27:00 UTC

[jira] Created: (SM-1407) Memory Leak in http consumer processor when a timeout occurs

Memory Leak in http consumer processor when a timeout occurs
------------------------------------------------------------

                 Key: SM-1407
                 URL: https://issues.apache.org/activemq/browse/SM-1407
             Project: ServiceMix
          Issue Type: Bug
          Components: servicemix-http
            Reporter: Guillaume Nodet
            Assignee: Guillaume Nodet
             Fix For: 3.2.2, 3.3




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


[jira] Updated: (SM-1407) Memory Leak in http consumer processor when a timeout occurs

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

Kevin Borden updated SM-1407:
-----------------------------

    Attachment: ConsumerProcessor.java

Fix so done is always sent.

> Memory Leak in http consumer processor when a timeout occurs
> ------------------------------------------------------------
>
>                 Key: SM-1407
>                 URL: https://issues.apache.org/activemq/browse/SM-1407
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-http
>            Reporter: Guillaume Nodet
>            Assignee: Guillaume Nodet
>             Fix For: 3.2.2, 3.3
>
>         Attachments: ConsumerProcessor.java
>
>


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


[jira] Reopened: (SM-1407) Memory Leak in http consumer processor when a timeout occurs

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

Mateusz Nowakowski reopened SM-1407:
------------------------------------

    Regression:   (was: [Broken Unit Test])

org.apache.servicemix.http.endpoints.HttpConsumerEndpoint sets an error on message in case of timeouts, it generates such exception:

java.lang.IllegalStateException: component is not owner when trying to set error: java.lang.Exception: Exchange timed out: ID:10.136.44.179-11cd73d18dc-4:4
at org.apache.servicemix.jbi.messaging.MessageExchangeImpl.setError(MessageExchangeImpl.java:264)
at org.apache.servicemix.common.endpoints.SimpleEndpoint.fail(SimpleEndpoint.java:82)
at org.apache.servicemix.http.endpoints.HttpConsumerEndpoint.process(HttpConsumerEndpoint.java:319)
at org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:71)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:757)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:502)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:371)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.jetty.nio.SelectChannelConnector$RetryContinuation.run(SelectChannelConnector.java:525)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:451)
Caused by: java.lang.Exception: Exchange timed out: ID:10.136.44.179-11cd73d18dc-4:4
at org.apache.servicemix.http.endpoints.HttpConsumerEndpoint.process(HttpConsumerEndpoint.java:318)
... 15 more

This code generates this isuue:
if (!cont.isResumed()) { 
 Exception e = new Exception("Exchange timed out: " + exchange.getExchangeId());
 fail(exchange, e);
 throw e; 
}
The consumer sets error on actually sent exchange. It is not the owner of this exchange, because it sends it before to the bus, and wait for the answer.

The previous version of this piece of code was that:
if (!result) {
 throw new Exception("Timeout"); 
}
I don't know either if other catches and fail invokes made sense, because it would generate the same error.

And last question. Let's say that setting an error would be succeed, the message would be sent again to the bus with the error. What would happen? The consumer creates the exchange and sets error to this exchange, there is nobody who can "eat" this error.

> Memory Leak in http consumer processor when a timeout occurs
> ------------------------------------------------------------
>
>                 Key: SM-1407
>                 URL: https://issues.apache.org/activemq/browse/SM-1407
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-http
>            Reporter: Guillaume Nodet
>            Assignee: Guillaume Nodet
>             Fix For: 3.2.2, servicemix-http-2008.01, 3.2.3, 3.3
>
>         Attachments: ConsumerProcessor.java
>
>


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


[jira] Resolved: (SM-1407) Memory Leak in http consumer processor when a timeout occurs

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

Guillaume Nodet resolved SM-1407.
---------------------------------

    Resolution: Fixed

Sending        servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java
Sending        servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
Sending        servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java
Transmitting file data ...
Committed revision 668659.

Sending        servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java
Sending        servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
Sending        servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java
Transmitting file data ...
Committed revision 668665.

> Memory Leak in http consumer processor when a timeout occurs
> ------------------------------------------------------------
>
>                 Key: SM-1407
>                 URL: https://issues.apache.org/activemq/browse/SM-1407
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-http
>            Reporter: Guillaume Nodet
>            Assignee: Guillaume Nodet
>             Fix For: 3.2.2, 3.3
>
>


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


[jira] Reopened: (SM-1407) Memory Leak in http consumer processor when a timeout occurs

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

Kevin Borden reopened SM-1407:
------------------------------

    Regression: [Broken Unit Test]

This seems to still be present. Looks like a done exchange is not being sent on a timeout.  A fix patch is included.

> Memory Leak in http consumer processor when a timeout occurs
> ------------------------------------------------------------
>
>                 Key: SM-1407
>                 URL: https://issues.apache.org/activemq/browse/SM-1407
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-http
>            Reporter: Guillaume Nodet
>            Assignee: Guillaume Nodet
>             Fix For: 3.2.2, 3.3
>
>


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


[jira] Commented: (SM-1407) Memory Leak in http consumer processor when a timeout occurs

Posted by "Mateusz Nowakowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SM-1407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46279#action_46279 ] 

Mateusz Nowakowski commented on SM-1407:
----------------------------------------

It's working now. Thanks.

> Memory Leak in http consumer processor when a timeout occurs
> ------------------------------------------------------------
>
>                 Key: SM-1407
>                 URL: https://issues.apache.org/activemq/browse/SM-1407
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-http
>            Reporter: Guillaume Nodet
>            Assignee: Guillaume Nodet
>             Fix For: 3.2.2, servicemix-http-2008.01, 3.2.3, 3.3, servicemix-http-2008.02
>
>         Attachments: ConsumerProcessor.java
>
>


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


[jira] Updated: (SM-1407) Memory Leak in http consumer processor when a timeout occurs

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

Guillaume Nodet updated SM-1407:
--------------------------------

    Fix Version/s: servicemix-http-2008.01

> Memory Leak in http consumer processor when a timeout occurs
> ------------------------------------------------------------
>
>                 Key: SM-1407
>                 URL: https://issues.apache.org/activemq/browse/SM-1407
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-http
>            Reporter: Guillaume Nodet
>            Assignee: Guillaume Nodet
>             Fix For: 3.2.2, 3.2.3, 3.3, servicemix-http-2008.01
>
>         Attachments: ConsumerProcessor.java
>
>


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


[jira] Resolved: (SM-1407) Memory Leak in http consumer processor when a timeout occurs

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

Guillaume Nodet resolved SM-1407.
---------------------------------

    Fix Version/s: 3.2.3
       Resolution: Fixed

I have been able to reproduce the problem and fix it.

Sending        src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java
Sending        src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
Sending        src/test/java/org/apache/servicemix/http/ConsumerEndpointTest.java
Transmitting file data ...
Committed revision 694206.

Sending        servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java
Sending        servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
Transmitting file data ..
Committed revision 694207.

> Memory Leak in http consumer processor when a timeout occurs
> ------------------------------------------------------------
>
>                 Key: SM-1407
>                 URL: https://issues.apache.org/activemq/browse/SM-1407
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-http
>            Reporter: Guillaume Nodet
>            Assignee: Guillaume Nodet
>             Fix For: 3.2.3, 3.3, 3.2.2
>
>         Attachments: ConsumerProcessor.java
>
>


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


[jira] Commented: (SM-1407) Memory Leak in http consumer processor when a timeout occurs

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SM-1407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45618#action_45618 ] 

Guillaume Nodet commented on SM-1407:
-------------------------------------

In case of a timeout, the component should send back an error to indicate that there was a problem, else the answer will be completely lost. In the current code, the fact that the HTTP request has timed out before the exchange comes back result in the continuation object being removed from the locks map. When the exchange comes back later, an exception is thrown in the process(MessageExchange) method which will result in an ERROR status being sent by the component for this exchange.
This critical method either send an exception (which will result in an error on the exchange) or call cont.resume() which will trigger a new call to process(HttpServletRequest request, HttpServletResponse response) or unblock the call to cont.suspend(timeout) depending if the jetty connector is an NIO connector or a BIO connector.

Btw, I've written lots of comments in the HttpConsumerEndpoint (https://svn.apache.org/repos/asf/servicemix/components/bindings/servicemix-http/trunk/src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java) which uses the exact same logic and done some testing using the ConsumerEndpointTest#testHttpInOutUnderLoad() and it seems to work fine.

Could you set up a test case to illustrate the problem or provide more informations ?

> Memory Leak in http consumer processor when a timeout occurs
> ------------------------------------------------------------
>
>                 Key: SM-1407
>                 URL: https://issues.apache.org/activemq/browse/SM-1407
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-http
>            Reporter: Guillaume Nodet
>            Assignee: Guillaume Nodet
>             Fix For: 3.2.2, 3.3
>
>         Attachments: ConsumerProcessor.java
>
>


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


[jira] Commented: (SM-1407) Memory Leak in http consumer processor when a timeout occurs

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SM-1407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46253#action_46253 ] 

Guillaume Nodet commented on SM-1407:
-------------------------------------

Your're right, this code snippet seems to be problematic.
I'll investigate.

> Memory Leak in http consumer processor when a timeout occurs
> ------------------------------------------------------------
>
>                 Key: SM-1407
>                 URL: https://issues.apache.org/activemq/browse/SM-1407
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-http
>            Reporter: Guillaume Nodet
>            Assignee: Guillaume Nodet
>             Fix For: 3.2.2, servicemix-http-2008.01, 3.2.3, 3.3
>
>         Attachments: ConsumerProcessor.java
>
>


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


[jira] Resolved: (SM-1407) Memory Leak in http consumer processor when a timeout occurs

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

Guillaume Nodet resolved SM-1407.
---------------------------------

    Fix Version/s: servicemix-http-2008.02
       Resolution: Fixed

Sending        src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java
Sending        src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
Transmitting file data ..
Committed revision 702812.

The problem appears when the resume of the continutation fails.
It happens when the continuation timeout has elapsed but has not been processed yet.
In such a case, the exchange is sent back with an ERROR when received instead and it should avoid the component is not owner problem.

> Memory Leak in http consumer processor when a timeout occurs
> ------------------------------------------------------------
>
>                 Key: SM-1407
>                 URL: https://issues.apache.org/activemq/browse/SM-1407
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-http
>            Reporter: Guillaume Nodet
>            Assignee: Guillaume Nodet
>             Fix For: 3.2.3, 3.3, servicemix-http-2008.02, servicemix-http-2008.01, 3.2.2
>
>         Attachments: ConsumerProcessor.java
>
>


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


[jira] Updated: (SM-1407) Memory Leak in http consumer processor when a timeout occurs

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

Guillaume Nodet updated SM-1407:
--------------------------------

    Fix Version/s:     (was: 3.2.2)
                       (was: servicemix-http-2008.02)

> Memory Leak in http consumer processor when a timeout occurs
> ------------------------------------------------------------
>
>                 Key: SM-1407
>                 URL: https://issues.apache.org/activemq/browse/SM-1407
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-http
>            Reporter: Guillaume Nodet
>            Assignee: Guillaume Nodet
>             Fix For: servicemix-http-2008.01, 3.2.3, 3.3
>
>         Attachments: ConsumerProcessor.java
>
>


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