Author: markt
Date: Tue Feb 10 15:43:46 2015
New Revision: 1658734

URL: http://svn.apache.org/r1658734
Log:
Ensure that a dropped connection does not leave references to the 
UpgradeProcessor

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties
    tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeProcessor.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties?rev=1658734&r1=1658733&r2=1658734&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties 
Tue Feb 10 15:43:46 2015
@@ -14,6 +14,8 @@
 # limitations under the License.
 
 upgradeProcessor.isCloseFail=Failed to close input stream associated with 
upgraded connection
+upgradeProcessor.onDataAvailableFail=Failed to process data available event
+upgradeProcessor.onWritePossibleFail=Failed to process write possible event
 upgradeProcessor.osCloseFail=Failed to close output stream associated with 
upgraded connection
 
 upgrade.sis.isFinished.ise=It is illegal to call isFinished() when the 
ServletInputStream is not in non-blocking mode (i.e. setReadListener() must be 
called first)

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeProcessor.java?rev=1658734&r1=1658733&r2=1658734&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeProcessor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeProcessor.java 
Tue Feb 10 15:43:46 2015
@@ -98,10 +98,24 @@ public class UpgradeProcessor implements
     @Override
     public final SocketState upgradeDispatch(SocketStatus status) throws 
IOException {
         if (status == SocketStatus.OPEN_READ) {
-            upgradeServletInputStream.onDataAvailable();
-            upgradeServletOutputStream.checkWriteDispatch();
+            try {
+                upgradeServletInputStream.onDataAvailable();
+                upgradeServletOutputStream.checkWriteDispatch();
+            } catch (IOException ioe) {
+                // The error handling within the ServletInputStream should have
+                // marked the stream for closure which will get picked up 
below,
+                // triggering the clean-up of this processor.
+                
log.debug(sm.getString("upgradeProcessor.onDataAvailableFail"), ioe);
+            }
         } else if (status == SocketStatus.OPEN_WRITE) {
-            upgradeServletOutputStream.onWritePossible();
+            try {
+                upgradeServletOutputStream.onWritePossible();
+            } catch (IOException ioe) {
+                // The error handling within the ServletOutputStream should 
have
+                // marked the stream for closure which will get picked up 
below,
+                // triggering the clean-up of this processor.
+                
log.debug(sm.getString("upgradeProcessor.onWritePossibleFail"), ioe);
+            }
         } else if (status == SocketStatus.STOP) {
             try {
                 upgradeServletInputStream.close();



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

Reply via email to