Re: IllegalStateException: The response object has been recycled and is no longer associated with this facade
Op woensdag, 17 augustus 2011 13:41 schreef Mark Thomas ma...@apache.org: On 17/08/2011 12:36, Ronald Klop wrote: 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. Are you using javax.imageio? Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org Is this imageio thing only with NIO+sendfile? If I disable sendfile in server.xml I don't see the error anymore. Ronald.
Re: IllegalStateException: The response object has been recycled and is no longer associated with this facade
On 18/08/2011 16:42, Ronald Klop wrote: Is this imageio thing only with NIO+sendfile? If I disable sendfile in server.xml I don't see the error anymore. Possible but unlikely. There were some sendfile changes recently in 7.0.x to address stability issues that may have introduced a regression. As before, a test case that demonstrates the issue would help significantly. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: IllegalStateException: The response object has been recycled and is no longer associated with this facade
Op zondag, 14 augustus 2011 23:46 schreef Konstantin Kolinko knst.koli...@gmail.com: 2011/8/14 Ronald Klop ronald-mailingl...@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-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@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.
Re: IllegalStateException: The response object has been recycled and is no longer associated with this facade
On 17/08/2011 12:36, Ronald Klop wrote: 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. Are you using javax.imageio? Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: IllegalStateException: The response object has been recycled and is no longer associated with this facade
Op woensdag, 17 augustus 2011 13:41 schreef Mark Thomas ma...@apache.org: On 17/08/2011 12:36, Ronald Klop wrote: 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. Are you using javax.imageio? Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org Sometimes. Mostly I run ImageMagick in a separate process. But sometimes it does things with javax.imagio. I'm curious about the link between them. And what happened in 7.0.19 that triggers something new. Ronald.
Re: IllegalStateException: The response object has been recycled and is no longer associated with this facade
2011/8/17 Ronald Klop ronald-mailingl...@base.nl: Op woensdag, 17 augustus 2011 13:41 schreef Mark Thomas ma...@apache.org: On 17/08/2011 12:36, Ronald Klop wrote: 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. Are you using javax.imageio? Mark Sometimes. Mostly I run ImageMagick in a separate process. But sometimes it does things with javax.imagio. https://wiki.apache.org/tomcat/FAQ/KnownIssues - see ImageIO Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: IllegalStateException: The response object has been recycled and is no longer associated with this facade
On 17/08/2011 13:20, Ronald Klop wrote: Sometimes. Mostly I run ImageMagick in a separate process. But sometimes it does things with javax.imagio. I'm curious about the link between them. And what happened in 7.0.19 that triggers something new. Details in the archives. If you have a simple test case that demonstrates the problem that doesn't use imageio then I'd be interested. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: IllegalStateException: The response object has been recycled and is no longer associated with this facade
Op woensdag, 17 augustus 2011 14:28 schreef Mark Thomas ma...@apache.org: On 17/08/2011 13:20, Ronald Klop wrote: Sometimes. Mostly I run ImageMagick in a separate process. But sometimes it does things with javax.imagio. I'm curious about the link between them. And what happened in 7.0.19 that triggers something new. Details in the archives. If you have a simple test case that demonstrates the problem that doesn't use imageio then I'd be interested. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org Ok. I read the FAQ mentioned by Konstantin and I understand it. My ImageIO always writes to a File and never directly to the ServletOutputStream.. The communication between my servlet and the image resize module is a File. (Which I cache on the Tomcat node, so I only have to resize ones.) And I read some more archives, but they are about problems after reloading a Context, but I always restart my Tomcat nodes as I'm deploying new code and have only one Context. But I understand ImageIO can be troublesome. And I'm also interested in a simple test case. :-) I'm trying to figure out how to reproduce this. Ronald.
Re: IllegalStateException: The response object has been recycled and is no longer associated with this facade
Op woensdag, 17 augustus 2011 15:02 schreef Ronald Klop ronald-mailingl...@base.nl: Op woensdag, 17 augustus 2011 14:28 schreef Mark Thomas ma...@apache.org: On 17/08/2011 13:20, Ronald Klop wrote: Sometimes. Mostly I run ImageMagick in a separate process. But sometimes it does things with javax.imagio. I'm curious about the link between them. And what happened in 7.0.19 that triggers something new. Details in the archives. If you have a simple test case that demonstrates the problem that doesn't use imageio then I'd be interested. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org Ok. I read the FAQ mentioned by Konstantin and I understand it. My ImageIO always writes to a File and never directly to the ServletOutputStream.. The communication between my servlet and the image resize module is a File. (Which I cache on the Tomcat node, so I only have to resize ones.) And I read some more archives, but they are about problems after reloading a Context, but I always restart my Tomcat nodes as I'm deploying new code and have only one Context. But I understand ImageIO can be troublesome. And I'm also interested in a simple test case. :-) I'm trying to figure out how to reproduce this. Ronald. Maybe this is of any interest from catalina.out on 7.0.19 with NIO. Long before the first exception about a recylced response facade I get this: Aug 15, 2011 10:55:07 AM org.apache.tomcat.util.net.NioEndpoint processSocket SEVERE: Error allocating socket processor java.lang.NullPointerException at org.apache.tomcat.util.net.NioEndpoint.processSocket(NioEndpoint.java:710) at org.apache.tomcat.util.net.NioEndpoint$Poller.processKey(NioEndpoint.java:1194) at org.apache.tomcat.util.net.NioEndpoint$Poller.run(NioEndpoint.java:1130) at java.lang.Thread.run(Thread.java:662) And some similar NPE's and a day later I get this: Aug 16, 2011 9:00:29 AM org.apache.coyote.AbstractProtocol$AbstractConnectionHandler process SEVERE: null java.lang.NullPointerException at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.release(Http11NioProtocol.java:231) at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.release(Http11NioProtocol.java:150) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:531) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1544) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Aug 16, 2011 9:00:42 AM org.apache.catalina.connector.CoyoteAdapter service SEVERE: An exception or error occurred in the container during the request processing java.lang.NullPointerException at org.apache.coyote.http11.InternalNioOutputBuffer.addToBB(InternalNioOutputBuffer.java:227) at org.apache.coyote.http11.InternalNioOutputBuffer.commit(InternalNioOutputBuffer.java:218) at org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:698) at org.apache.coyote.Response.action(Response.java:170) at org.apache.coyote.Response.sendHeaders(Response.java:350) at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:317) at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:276) at org.apache.catalina.connector.Response.finishResponse(Response.java:501) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:432) at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:313) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1544) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Aug 16, 2011 9:00:42 AM org.apache.coyote.http11.AbstractHttp11Processor endRequest SEVERE: Error finishing response java.lang.NullPointerException at org.apache.coyote.http11.InternalNioOutputBuffer.flushBuffer(InternalNioOutputBuffer.java:252) at org.apache.coyote.http11.InternalNioOutputBuffer.endRequest(InternalNioOutputBuffer.java:144) at org.apache.coyote.http11.AbstractHttp11Processor.endRequest(AbstractHttp11Processor.java:1282) at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:356) at
IllegalStateException: The response object has been recycled and is no longer associated with this facade
Hi, 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 at org.apache.catalina.connector.ResponseFacade.isCommitted(ResponseFacade.java:325) ~[catalina.jar:7.0.19] at org.apache.catalina.connector.ResponseFacade.setContentType(ResponseFacade.java:237) ~[catalina.jar:7.0.19] at javax.servlet.ServletResponseWrapper.setContentType(ServletResponseWrapper.java:123) ~[servlet-api.jar:3.0.FR] at nl.base.io.HttpUtils.sendBaseFileToBrowser(HttpUtils.java:366) ~[HttpUtils.class:na] at nl.base.servlets.objects.MediaServlet.process(MediaServlet.java:272) [MediaServlet.class:na] at nl.base.servlets.objects.MediaServlet.doPost(MediaServlet.java:66) [MediaServlet.class:na] at nl.base.servlets.objects.MediaServlet.doGet(MediaServlet.java:59) [MediaServlet.class:na] at javax.servlet.http.HttpServlet.service(HttpServlet.java:629) [servlet-api.jar:na] at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) [servlet-api.jar:na] I'm running with the security manager on, because I use RMI. And it runs on Debian 5 with Sun java 1.6.0_22 from the Debian pkg. 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? I'm going to upgrade to 7.0.20 this afternoon, but the release notes don't mention this problem as solved. Ronald.
Re: IllegalStateException: The response object has been recycled and is no longer associated with this facade
2011/8/14 Ronald Klop ronald-mailingl...@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-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org