You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2019/05/06 14:11:12 UTC
[tomcat] branch master updated: Filter out some cases of incorrect
HTTP/2 connection timeout
This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push:
new a7656eb Filter out some cases of incorrect HTTP/2 connection timeout
a7656eb is described below
commit a7656eb8e031d28c5a3bedd3d7459d06b4ae6c3a
Author: remm <re...@apache.org>
AuthorDate: Mon May 6 16:11:01 2019 +0200
Filter out some cases of incorrect HTTP/2 connection timeout
Avoid using the timeout code when there is no timeout. Also make sure,
since System.currentTimeMillis is not accurate, that the time waited is
decreased.
---
.../apache/coyote/http2/Http2UpgradeHandler.java | 34 +++++++++++-----------
webapps/docs/changelog.xml | 3 ++
2 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index 97644c4..2db837a 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -810,24 +810,24 @@ class Http2UpgradeHandler extends AbstractStream implements InternalHttpUpgradeH
} else {
long t1 = System.currentTimeMillis();
stream.wait(writeTimeout);
- writeTimeout -= (System.currentTimeMillis() - t1);
- }
- // Has this stream been granted an allocation
- // Note: If the stream in not in this Map then the
- // requested write has been fully allocated
- int[] value = backLogStreams.get(stream);
- if (writeTimeout <= 0 && value != null && value[1] == 0) {
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("upgradeHandler.noAllocation",
- connectionId));
+ writeTimeout -= (System.currentTimeMillis() + 1 - t1);
+ // Has this stream been granted an allocation
+ // Note: If the stream in not in this Map then the
+ // requested write has been fully allocated
+ int[] value = backLogStreams.get(stream);
+ if (writeTimeout <= 0 && value != null && value[1] == 0) {
+ if (log.isDebugEnabled()) {
+ log.debug(sm.getString("upgradeHandler.noAllocation",
+ connectionId));
+ }
+ // No allocation
+ // Close the connection. Do this first since
+ // closing the stream will raise an exception
+ close();
+ // Close the stream (in app code so need to
+ // signal to app stream is closing)
+ stream.doWriteTimeout();
}
- // No allocation
- // Close the connection. Do this first since
- // closing the stream will raise an exception
- close();
- // Close the stream (in app code so need to
- // signal to app stream is closing)
- stream.doWriteTimeout();
}
} catch (InterruptedException e) {
throw new IOException(sm.getString(
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 74743a0..be3a473 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -59,6 +59,9 @@
CI test failures. Add sync when processing async operation to avoid
this. (remm)
</fix>
+ <fix>
+ Filter out some cases of incorrect HTTP/2 connection timeout. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Other">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org