You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/11/08 20:01:04 UTC
[tomcat] branch 8.5.x updated: Fix logic that meant AJP was not
always non-blocking between requests
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push:
new 420c883 Fix logic that meant AJP was not always non-blocking between requests
420c883 is described below
commit 420c88325879cc192a044f18ad8c4a98d63d980e
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Nov 8 19:57:00 2019 +0000
Fix logic that meant AJP was not always non-blocking between requests
---
java/org/apache/coyote/ajp/AjpProcessor.java | 11 +++++++----
webapps/docs/changelog.xml | 6 ++++++
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java b/java/org/apache/coyote/ajp/AjpProcessor.java
index 912d509..81ab0b7 100644
--- a/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -395,20 +395,24 @@ public class AjpProcessor extends AbstractProcessor {
int soTimeout = endpoint.getConnectionTimeout();
boolean cping = false;
-
- boolean keptAlive = false;
+ // Expected to block on the first read as there should be at least one
+ // AJP message to read.
+ boolean firstRead = true;
while (!getErrorState().isError() && !endpoint.isPaused()) {
// Parsing the request header
try {
// Get first message of the request
- if (!readMessage(requestHeaderMessage, !keptAlive)) {
+ if (!readMessage(requestHeaderMessage, firstRead)) {
break;
}
+ firstRead = false;
+
// Set back timeout if keep alive timeout is enabled
if (keepAliveTimeout > 0) {
socketWrapper.setReadTimeout(soTimeout);
}
+
// Check message type, process right away and break if
// not regular request processing
int type = requestHeaderMessage.getByte();
@@ -435,7 +439,6 @@ public class AjpProcessor extends AbstractProcessor {
setErrorState(ErrorState.CLOSE_CONNECTION_NOW, null);
break;
}
- keptAlive = true;
request.setStartTime(System.currentTimeMillis());
} catch (IOException e) {
setErrorState(ErrorState.CLOSE_CONNECTION_NOW, e);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 2f9c2c7..7e38941 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -115,6 +115,12 @@
<code>certificateVerificationDepth</code> are correctly passed to the
OpenSSL based SSLEngine implementation. (remm/markt)
</fix>
+ <fix>
+ Do not perform a blocking read after a <code>CPING</code> message is
+ received by the AJP connector because, if the JK Connector is configured
+ with <code>ping_mode="I"</code>, the <code>CPING</code>
+ message will not always be followed by the start of a request. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org