Sigh, it's been a long two days.

The bottom line is that if you use Client or ClientResource over the 
Apache HTTP Client, you better not use followingRedirect=true, or else 
you'll get hanging threads due to connections not being returned to the 
Apache Client's connection pool.

The issue is that Restlet (2.0.7) executes an additional GET request for 
the redirect, but does not release the representation for the first GET 
that contains the redirect response.

You can reproduce this easily by trying more than 10 GET requests to 
"http://google.com/"; (which will redirect you to 
"http://www.google.com/"; and return an entity). After 10 requests, your 
Restlet Client class will hang. :/

I hope this gets fixed and can be merged into the 2.0 branch! My 
deployments are not yet ready to shift to 2.1. In the meantime, use my 
simple (if annoying) workaround: setFollowingRedirect(false). You will 
have to handle redirects via your own logic.

(After a few wild goose chases, I now know far, far more than I ever 
wanted to know about the internals of the Apache HTTP Client. Its 
architecture is actually similar to Restlet's in many ways!)

And ... you're welcome.

-Tal

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2738502

Reply via email to