You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Konstantin Kolinko <kn...@gmail.com> on 2010/10/14 02:01:55 UTC

Recycling processors in Http11NioProtocol

Hi!

Looking at the Http11NioProtocol.Http11ConnectionHandler.release(NioChannel
socket) method in Http11NioProtocol.java,  it looks for me that like
that method does in all other places before any call to
"recycledProcessors.offer(result);" there should be
 - a call to connections.remove(socket)
 - a call to Http11NioProcessor.recycle()

I see two places where those calls are missing.  A patch is inline
below,  as well as attached to the message. Any comments? I might miss
something.

I cannot call release(socket) in the second case, as it is possible
that connections.remove(socket) call will return null there.

[[[
Index: java/org/apache/coyote/http11/Http11NioProtocol.java
===================================================================
--- java/org/apache/coyote/http11/Http11NioProtocol.java	(revision 1022323)
+++ java/org/apache/coyote/http11/Http11NioProtocol.java	(working copy)
@@ -330,8 +330,7 @@
                         state = processor.asyncPostProcess();
                     }
                     if (state != SocketState.LONG && state !=
SocketState.ASYNC_END) {
-                        connections.remove(socket);
-                        recycledProcessors.offer(processor);
+                        release(socket);
                         if (state == SocketState.OPEN) {
                             socket.getPoller().add(socket);
                         }
@@ -422,6 +421,8 @@
                 // less-than-verbose logs.
                 log.error(sm.getString("http11protocol.proto.error"), e);
             }
+            connections.remove(socket);
+            processor.recycle();
             recycledProcessors.offer(processor);
             return SocketState.CLOSED;
         }

]]]

Best regards,
Konstantin Kolinko

Re: Recycling processors in Http11NioProtocol

Posted by Konstantin Kolinko <kn...@gmail.com>.
2010/10/14 Mark Thomas <ma...@apache.org>:
> On 14/10/2010 01:01, Konstantin Kolinko wrote:
>> Hi!
>>
>> Looking at the Http11NioProtocol.Http11ConnectionHandler.release(NioChannel
>> socket) method in Http11NioProtocol.java,  it looks for me that like
>> that method does in all other places before any call to
>> "recycledProcessors.offer(result);" there should be
>>  - a call to connections.remove(socket)
>>  - a call to Http11NioProcessor.recycle()
>>
>> I see two places where those calls are missing.  A patch is inline
>> below,  as well as attached to the message. Any comments? I might miss
>> something.
>
> +1 for applying.
>
> Mark

Thank you for review.
Applied in r1022415, proposed for 6.0.

Best regards,
Konstantin Kolinko

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


Re: Recycling processors in Http11NioProtocol

Posted by Mark Thomas <ma...@apache.org>.
On 14/10/2010 01:01, Konstantin Kolinko wrote:
> Hi!
> 
> Looking at the Http11NioProtocol.Http11ConnectionHandler.release(NioChannel
> socket) method in Http11NioProtocol.java,  it looks for me that like
> that method does in all other places before any call to
> "recycledProcessors.offer(result);" there should be
>  - a call to connections.remove(socket)
>  - a call to Http11NioProcessor.recycle()
> 
> I see two places where those calls are missing.  A patch is inline
> below,  as well as attached to the message. Any comments? I might miss
> something.

+1 for applying.

Mark

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