tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: svn commit: r1050249 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11NioProtocol.java webapps/docs/changelog.xml
Date Fri, 07 Jan 2011 14:09:42 GMT
Is it worth being ported to 6.0? It looks so, though have not reviewed
it in detail yet.

2010/12/17  <markt@apache.org>:
> Author: markt
> Date: Fri Dec 17 00:17:18 2010
> New Revision: 1050249
>
> URL: http://svn.apache.org/viewvc?rev=1050249&view=rev
> Log:
> Fix massive memory leak in NIO connector. Http11NioProcessor objects were not being recycled.
>
> Modified:
>    tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
>    tomcat/trunk/webapps/docs/changelog.xml
>
> Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java?rev=1050249&r1=1050248&r2=1050249&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java (original)
> +++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java Fri Dec 17 00:17:18
2010
> @@ -244,6 +244,10 @@ public class Http11NioProtocol extends A
>                 log.debug("Done iterating through our connections to release
a socket channel:"+socket +" released:"+released);
>         }
>
> +        /**
> +         * Use this only if the processor is not available, otherwise use
> +         * {@link #release(NioChannel, Http11NioProcessor).
> +         */
>         @Override
>         public void release(NioChannel socket) {
>             Http11NioProcessor result = connections.remove(socket);
> @@ -253,6 +257,14 @@ public class Http11NioProtocol extends A
>             }
>         }
>
> +
> +        public void release(NioChannel socket, Http11NioProcessor processor) {
> +            connections.remove(socket);
> +            processor.recycle();
> +            recycledProcessors.offer(processor);
> +        }
> +
> +
>         @Override
>         public SocketState event(NioChannel socket, SocketStatus status) {
>             Http11NioProcessor processor = connections.get(socket);
> @@ -294,7 +306,7 @@ public class Http11NioProtocol extends A
>                         state = processor.asyncPostProcess();
>                     }
>                     if (state == SocketState.OPEN || state == SocketState.CLOSED)
{
> -                        release(socket);
> +                        release(socket, processor);
>                         if (state == SocketState.OPEN) {
>                             socket.getPoller().add(socket);
>                         }
> @@ -362,11 +374,11 @@ public class Http11NioProtocol extends A
>                 } else if (state == SocketState.OPEN){
>                     // In keep-alive but between requests. OK to recycle
>                     // processor. Continue to poll for the next request.
> -                    release(socket);
> +                    release(socket, processor);
>                     socket.getPoller().add(socket);
>                 } else {
>                     // Connection closed. OK to recycle the processor.
> -                    release(socket);
> +                    release(socket, processor);
>                 }
>                 return state;
>
>
> Modified: tomcat/trunk/webapps/docs/changelog.xml
> URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1050249&r1=1050248&r2=1050249&view=diff
> ==============================================================================
> --- tomcat/trunk/webapps/docs/changelog.xml (original)
> +++ tomcat/trunk/webapps/docs/changelog.xml Fri Dec 17 00:17:18 2010
> @@ -175,6 +175,10 @@
>         <code>Connector.stop()</code>. This fix also includes further
Lifecycle
>         refactoring for Connectors and associated components. (markt)
>       </fix>
> +      <fix>
> +        Remove a huge memory leak in the NIO connector introduced by the fix
> +        for <bug>49884</bug>. (markt)
> +      </fix>
>     </changelog>
>   </subsection>
>   <subsection name="Jasper">
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>

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


Mime
View raw message