camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J- <jmand...@hotmail.com>
Subject Restlet GET request can cause Memeory leak/Stream not closed due to CAMEL-9611
Date Fri, 13 May 2016 10:03:52 GMT
My apologies, this bug is 100% my fault because of CAMEL-9611.
Jira is in some weird locked down state so i can't post the issue on there, but this is pretty
major.

The fact that we no longer read the message body for Restlet GET request has created a very
painful bug (that took me 3 days to figure out).  
The problem is that if body is never read and the body is a connection/stream, it is never
closed.

To reproduce just call restlet GET 20 times in a row.

from("direct:start").loop(20).to("restlet:http://<anyURL>?restletMethod=get");

Simpiliest fix for me was to read the body and dump it for the GET path in DefaultRestletBinding.java

@line 220:
else {
                // no body
               // dump body to close streams
               try{
                    String garbage = exchange.getIn().getBody(String.class);
                }catch(Exception ex){
                     //we don't care if this fails
                }
                LOG.debug("Populate Restlet {} request from exchange using media type {}",
method, mediaType);
                request.setEntity(new EmptyRepresentation());
            }

Mime
View raw message