Author: markt
Date: Thu Aug 22 10:05:47 2013
New Revision: 1516405

URL: http://svn.apache.org/r1516405
Log:
Fix an issue highlighted when running the Autobahn test suite on Linux.
Don't register the socket for a read when a write event completes (may lead to 
thread starvation)

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/coyote/AbstractProtocol.java

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1432867

Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/AbstractProtocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/AbstractProtocol.java?rev=1516405&r1=1516404&r2=1516405&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/AbstractProtocol.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/AbstractProtocol.java Thu Aug 
22 10:05:47 2013
@@ -661,7 +661,14 @@ public abstract class AbstractProtocol i
                 } else if (state == SocketState.UPGRADED) {
                     // Need to keep the connection associated with the 
processor
                     connections.put(socket, processor);
-                    longPoll(wrapper, processor);
+                    // Don't add sockets back to the poller if this was a
+                    // non-blocking write otherwise the poller may trigger
+                    // multiple read events which may lead to thread starvation
+                    // in the connector. The write() method will add this this
+                    // socket to the poller if necessary.
+                    if (status != SocketStatus.OPEN_WRITE) {
+                        longPoll(wrapper, processor);
+                    }
                 } else {
                     // Connection closed. OK to recycle the processor. Upgrade
                     // processors are not recycled.



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

Reply via email to