https://issues.apache.org/bugzilla/show_bug.cgi?id=50651

--- Comment #8 from Konstantin Kolinko <knst.koli...@gmail.com> 2011-01-26 
19:45:54 EST ---
Created an attachment (id=26554)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=26554)
catalina.2011-01-27.log

(In reply to comment #7)
> Whether the recycle method should be idempotent is a separate discussion.
> I agree that it should, but it doesn't mean it should be called multiple 
> times.
> Cause the bugs that come up from coding like that, is way harder to track 
> down.

I am sure that if we skip recycling the processor before its reuse in some
case, the consequences will be harder than if we recycle it twice.

The code is already hard to follow at some places. 

> So, why not fix the real problem ?

I think the bug in recycle() is the real problem. Though I do not mind patching
CoyoteAdapter.log() as well. Part of the necessary changes is in r1059548 [2]

[2]
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java?r1=1059548&r2=1059547&pathrev=1059548


Here is one more occurrence of the issue,
just using the browser (Firefox 3.6.13):
1. Using Tomcat 6.0.31. Configure Tomcat with Http11NioProtocol connector and
AccessLogValve in <Host>
2. Clear cache of the browser
3. Access http://localhost:8080/examples/jsp/plugin/plugin.jsp
4. Wait for more than 10 seconds.
5. The pair of exceptions occur:

27.01.2011 3:09:37
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler process
SEVERE: Error reading request, ignored
java.lang.NullPointerException
    at
org.apache.coyote.http11.InternalNioOutputBuffer.recycle(InternalNioOutputBuffer.java:351)
    at
org.apache.coyote.http11.Http11NioProcessor.recycle(Http11NioProcessor.java:1007)
    at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.release(Http11NioProtocol.java:655)
    at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:751)
    at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2262)
    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)
27.01.2011 3:09:37 org.apache.tomcat.util.net.NioEndpoint$SocketProcessor run
SEVERE: 
java.lang.NullPointerException
    at
org.apache.coyote.http11.InternalNioOutputBuffer.recycle(InternalNioOutputBuffer.java:351)
    at
org.apache.coyote.http11.Http11NioProcessor.recycle(Http11NioProcessor.java:1007)
    at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.release(Http11NioProtocol.java:655)
    at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:776)
    at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2262)
    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)

-- see attachment.

Access log:
127.0.0.1 - - [27/Jan/2011:03:09:26 +0300] "GET /examples/jsp/plugin/plugin.jsp
HTTP/1.1" 200 1655
127.0.0.1 - - [27/Jan/2011:03:09:26 +0300] "GET /favicon.ico HTTP/1.1" 200
21630
127.0.0.1 - - [27/Jan/2011:03:09:27 +0300] "GET
/examples/jsp/plugin/applet/Clock2.class HTTP/1.1" 304 -

I am not able to reproduce this with usual static or JSP pages.

I suspect that some cause is that Http11NioProtocol#process(NioChannel) there
are calls to release(socket, processor) in "if (state == SocketState.OPEN)" and
in "else" branches -- Http11NioProtocol.java:751 is where the exception occurs,
 but Http11NioProcessor#process(NioChannel) called from there already calls
recycle() by itself.

I think this comes from r1030613. There were later changes in
Http11NioProcessor to add to this.


The second exception in the pair, at (Http11NioProtocol.java:776) occurs after
a catch block. This comes from r1033341. In this place it is hard to guess
whether recycle() call already happened or not.


The reproduction recipe in comment 5 is different from the both of mine ones.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to