tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronald Klop <ronald-mailingl...@base.nl>
Subject Re: IllegalStateException: The response object has been recycled and is no longer associated with this facade
Date Wed, 17 Aug 2011 11:36:40 GMT



Op zondag, 14 augustus 2011 23:46 schreef Konstantin Kolinko <knst.kolinko@gmail.com>:
> 
>   
>  2011/8/14 Ronald Klop <ronald-mailinglist@base.nl>:
>  >
>  > I'm running Tomcat 7.0.19 to scale and serve images for use on a lot of
>  > websites. Since the upgrade from 7.0.16 to 7.0.19 I get the following stacks
>  > now and than.
>  > java.lang.IllegalStateException: The response object has been recycled and
>  > is no longer associated with this facade
>  >(...)
>  >
>  > Is this known? I didn't change code recently and I read it again and we are
>  > not doing unusual things with the Reponse object. Any hints? Should I file a
>  > bugreport?
>  
>  It is more likely that a problem is in your code, not in Tomcat.
>  
>  It looks like you accessed a Response that has already been recycled.
>  Usually it happens when response object is stored in a field that is
>  shared by several threads
>  (e.g. in a field in a Servlet, because a single Servlet instance is
>  shared by several threads).
>  
>  
>  In case if there really is a bug, can you reproduce this issue with
>  some sample code?
>  
>  There were refactorings in connectors, so some subtle changes in
>  behaviour are possible, but thus far all such IllegalStateException
>  issues that I remember were application errors.
>  
>  Recycling of facades can be turned on with a system property,  and it
>  is always on when running with a security manager. Were you running
>  7.0.16 with security manager as well?
>  
>  > I'm going to upgrade to 7.0.20 this afternoon, but the release notes don't
>  > mention this problem as solved.
>  
>  Best regards,
>  Konstantin Kolinko
>  
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>  For additional commands, e-mail: users-help@tomcat.apache.org
>   
>  
> 
> 
>   

 
 Hi,

 I did some experiments past days on my live servers and have more information.

 The problem occurs with 7.0.19 and 7.0.20 with the NIO connector, but not with the BIO connector.
In 7.0.16 it doesn't happen with the NIO connector.
 My code is not more than something like this (pseudocode):
 doGet(...) {
    File image = getFile(request.getParameter(...));
    File resized = getFile(request.getParameter(...));
    if (image.newerThan(resized)) {
       resize(image, resized, size);
    }
    response.getOutputStream().write(resized.getContent());
 }

 So very straight forward and no fancy tricks with Response objects. This worked for years
since Tomcat 5 or 6.

 Ronald.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message