Author: remm
Date: Thu Mar 16 14:56:50 2017
New Revision: 1787200
URL: http://svn.apache.org/viewvc?rev=1787200&view=rev
Log:
Fix Gump failure with the new NIO2 code, that wasn't related at all with the
new NIO2 code. Properly notify the input buffer when arriving at EOF (without
it, the read may block forever on EOF due to a race).
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=1787200&r1=1787199&r2=1787200&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/Stream.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/Stream.java Thu Mar 16 14:56:50
2017
@@ -398,10 +398,10 @@ class Stream extends AbstractStream impl
final void receivedEndOfStream() {
- synchronized (inputBuffer) {
- inputBuffer.notifyAll();
- }
state.receivedEndOfStream();
+ if (inputBuffer != null) {
+ inputBuffer.notifyEof();
+ }
}
@@ -683,8 +683,8 @@ class Stream extends AbstractStream impl
// Ensure that only one thread accesses inBuffer at a time
synchronized (inBuffer) {
- boolean canRead = isActive() && !isInputFinished();
- while (inBuffer.position() == 0 && canRead) {
+ boolean canRead = false;
+ while (inBuffer.position() == 0 && (canRead = isActive() &&
!isInputFinished())) {
// Need to block until some data is written
try {
if (log.isDebugEnabled()) {
@@ -812,6 +812,14 @@ class Stream extends AbstractStream impl
inBuffer.notifyAll();
}
}
+ }
+
+ private final void notifyEof() {
+ if (inBuffer != null) {
+ synchronized (inBuffer) {
+ inBuffer.notifyAll();
+ }
+ }
}
}
}
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1787200&r1=1787199&r2=1787200&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Thu Mar 16 14:56:50 2017
@@ -71,6 +71,9 @@
<fix>
Add async based IO groundwork for HTTP/2. (remm)
</fix>
+ <fix>
+ Fix HTTP/2 incorrect input unblocking on EOF. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Other">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]