You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2010/06/07 06:34:09 UTC

svn commit: r952090 - in /tomcat/tc6.0.x/trunk: STATUS.txt java/org/apache/tomcat/util/net/AprEndpoint.java webapps/docs/changelog.xml

Author: kkolinko
Date: Mon Jun  7 04:34:08 2010
New Revision: 952090

URL: http://svn.apache.org/viewvc?rev=952090&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49095
AprEndpoint does not wakeup accepts with deferred accept or BSD filters
Based on a patch provided by Ruediger Pluem

Modified:
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=952090&r1=952089&r2=952090&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Mon Jun  7 04:34:08 2010
@@ -140,13 +140,6 @@ PATCHES PROPOSED TO BACKPORT:
   +1: kkolinko, markt, rjung
   -1:
 
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49095
-  AprEndpoint does not wakeup accepts with deferred accept or BSD filters
-  Based on a patch provided by Ruediger Pluem
-  https://issues.apache.org/bugzilla/attachment.cgi?id=25510
-  +1: kkolinko, rjung, markt
-  -1:
-
 * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49343
   When ChannelException is thrown, remove listener from channel.
   http://svn.apache.org/viewvc?view=revision&revision=948402

Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=952090&r1=952089&r2=952090&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Mon Jun  7 04:34:08 2010
@@ -17,6 +17,7 @@
 
 package org.apache.tomcat.util.net;
 
+import java.io.OutputStreamWriter;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.util.ArrayList;
@@ -906,6 +907,19 @@ public class AprEndpoint {
                 log.debug("About to unlock socket for: " + saddr);
             }
             s.connect(saddr, unlockTimeout);
+            /*
+             * In the case of a deferred accept / accept filters we need to
+             * send data to wake up the accept. Send OPTIONS * to bypass even
+             * BSD accept filters. The Acceptor will discard it.
+             */
+            if (deferAccept) {
+                OutputStreamWriter sw;
+
+                sw = new OutputStreamWriter(s.getOutputStream(), "ISO-8859-1");
+                sw.write("OPTIONS * HTTP/1.0\r\n"
+                        + "User-Agent: Tomcat wakeup connection\r\n\r\n");
+                sw.flush();
+            }
         } catch(Exception e) {
             if (log.isDebugEnabled()) {
                 log.debug(sm.getString("endpoint.debug.unlock", "" + port), e);
@@ -1153,6 +1167,15 @@ public class AprEndpoint {
                 try {
                     // Accept the next incoming connection from the server socket
                     long socket = Socket.accept(serverSock);
+                    /*
+                     * In the case of a deferred accept unlockAccept needs to
+                     * send data. This data will be rubbish, so destroy the
+                     * socket and don't process it.
+                     */
+                    if (deferAccept && (paused || !running)) {
+                        Socket.destroy(socket);
+                        continue;
+                    }
                     // Hand this socket off to an appropriate processor
                     if (!processSocketWithOptions(socket)) {
                         // Close socket and pool right away

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=952090&r1=952089&r2=952090&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Mon Jun  7 04:34:08 2010
@@ -166,6 +166,11 @@
         <bug>48917</bug>: Correct name of mod_jk module in ApacheConfig. Patch
         provided by Todd Hicks. (markt)
       </fix>
+      <fix>
+        <bug>49095</bug>: AprEndpoint did not wakeup acceptors during shutdown
+        when deferAccept option was enabled. Based on a patch provided by
+        Ruediger Pluem. (kkolinko)
+      </fix>
       <add>
         Use chunked encoding for http 1.1 requests with no content-length
         (regardless of keep-alive) so client can differentiate between complete



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