Bug 57011 - Exception when writing HTTP response in the AsyncListener onTimeout method (servlet 3 HTTP-NIO)
Exception when writing HTTP response in the AsyncListener onTimeout method (s...
Status: RESOLVED FIXED
Product: Tomcat 7
Classification: Unclassified
Component: Catalina
trunk
PC All
: P2 regression (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2014-09-23 21:27 UTC by Dario Franceschi
Modified: 2015-11-18 08:42 UTC (History)
0 users



Attachments
Servlet (1.32 KB, text/plain)
2014-09-23 21:27 UTC, Dario Franceschi
Details
Context listener (935 bytes, text/plain)
2014-09-23 21:29 UTC, Dario Franceschi
Details
bug32051.war (3.08 KB, application/octet-stream)
2014-09-24 10:21 UTC, Konstantin Kolinko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dario Franceschi 2014-09-23 21:27:28 UTC
Created attachment 32050 [details]
Servlet

Get the following exception every time the onTimeout method has been called

INFO: Encountered a non-recycled request and recycled it forcedly.
org.apache.catalina.connector.CoyoteAdapter$RecycleRequiredException
	at org.apache.catalina.connector.CoyoteAdapter.checkRecycled(CoyoteAdapter.java:717)
	at org.apache.coyote.http11.AbstractHttp11Processor.recycle(AbstractHttp11Processor.java:1791)
	at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.release(Http11NioProtocol.java:239)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:733)
	at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:724)
Comment 1 Dario Franceschi 2014-09-23 21:29:32 UTC
Created attachment 32051 [details]
Context listener

If you omit the close on the printwriter the socket will be RST before the data is transferred causing for instance wget to re-submit
Comment 2 Dario Franceschi 2014-09-23 21:34:21 UTC
Seems I only get this on windows 7 (64) and tomcat 8 ( tried 8-11 & 8-12 ) on tomcat 7 I do not get this, I do not get this on tomcat 8 on (32 bit) linux either.

Have also tried Java7 & Java8 but that does not seem to be related.
Comment 3 Konstantin Kolinko 2014-09-24 10:21:27 UTC
Created attachment 32052 [details]
bug32051.war

A war file that contains reproducer classes, as submitted by Dario Franceschi, compiled with Java 6.

Steps to reproduce:
1. Deploy the war
2. Access http://localhost:8080/bug32051
A simple HTML page with word "hej" is displayed in browser.
3. The INFO message from CoyoteAdapter.checkRecycled is printed on the console

It reproduces for me with current Tomcat 8 (trunk @r1627265) with every one of 4 connectors (Bio, Nio, Nio2, Apr) using JDK 7u67 (32-bit) on Windows 7.

It does not reproduce for me with current Tomcat 7 (tc7.0.x @r1627245) with any of 3 connectors (Bio, Nio, Apr) and any of {JDK 6u45, 7u67} (32-bit) on Windows 7. The page is displayed and there is no log message.
Comment 4 Mark Thomas 2014-09-24 13:10:12 UTC
Comment on attachment 32051 [details]
Context listener

Thanks for the WAR Konstantin. I see this on OSX. It looks to be OS neutral to me.

I'll note that the AsyncListener should be calling AsyncContext.complete() at the end of onTimeout() which may avoid this error. Irrespective of that, this is still a bug that needs to be fixed.
Comment 5 Mark Thomas 2014-09-24 17:31:32 UTC
This has been fixed in 8.0.x and will be included in 8.0.13 onwards.
Comment 6 Violeta Georgieva 2014-09-25 07:58:40 UTC
This has been back-ported in 7.0.x and will be included in 7.0.56 onwards.
Comment 7 melon 2015-11-18 03:36:47 UTC
i use the tomcat7.0.61,and got the exception:
Nov 18, 2015 10:01:43 AM org.apache.catalina.connector.CoyoteAdapter checkRecycled
INFO: Encountered a non-recycled response and recycled it forcedly.
org.apache.catalina.connector.CoyoteAdapter$RecycleRequiredException
        at org.apache.catalina.connector.CoyoteAdapter.checkRecycled(CoyoteAdapter.java:592)
        at org.apache.coyote.http11.AbstractHttp11Processor.recycle(AbstractHttp11Processor.java:1814)
        at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.release(Http11NioProtocol.java:218)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:703)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1741)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1700)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)

i don't know how to fix it,it looks like this bug
Comment 8 melon 2015-11-18 08:42:18 UTC
I upgrade to tomcat8.0.28,hope that it will be ok