Author: remm Date: Wed Mar 8 09:13:25 2017 New Revision: 1785935 URL: http://svn.apache.org/viewvc?rev=1785935&view=rev Log: Prevent a blocking read after a stream exception.
Modified: tomcat/trunk/java/org/apache/coyote/http2/Stream.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/coyote/http2/Stream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Stream.java?rev=1785935&r1=1785934&r2=1785935&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http2/Stream.java (original) +++ tomcat/trunk/java/org/apache/coyote/http2/Stream.java Wed Mar 8 09:13:25 2017 @@ -683,7 +683,8 @@ class Stream extends AbstractStream impl // Ensure that only one thread accesses inBuffer at a time synchronized (inBuffer) { - while (inBuffer.position() == 0 && !isInputFinished()) { + boolean canRead = isActive() && !isInputFinished(); + while (inBuffer.position() == 0 && canRead) { // Need to block until some data is written try { if (log.isDebugEnabled()) { @@ -712,7 +713,7 @@ class Stream extends AbstractStream impl } inBuffer.get(outBuffer, 0, written); inBuffer.clear(); - } else if (isInputFinished()) { + } else if (!canRead) { return -1; } else { // Should never happen Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1785935&r1=1785934&r2=1785935&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Wed Mar 8 09:13:25 2017 @@ -232,6 +232,10 @@ <code>NioEndpoint.stopLatch</code> to make the class easier to extend. (markt) </fix> + <fix> + Prevent blocking reads after a stream exception occurs with HTTP/2. + (remm) + </fix> </changelog> </subsection> <subsection name="Jasper"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org