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 2020/03/05 14:42:18 UTC
[tomcat] 01/02: Differentiate between error conditions and clean
shutdown.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit bc168d584e1bbf5cd6d476ec3e5dace0dcb39cd6
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Mar 5 13:36:50 2020 +0000
Differentiate between error conditions and clean shutdown.
Allow an async request to complete cleanly if the Connector is paused
before complete() is called on a Container thread.
---
java/org/apache/coyote/AbstractProcessorLight.java | 2 +-
java/org/apache/coyote/ajp/AjpProcessor.java | 6 +++++-
java/org/apache/coyote/http11/Http11Processor.java | 4 ++--
webapps/docs/changelog.xml | 4 ++++
4 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/java/org/apache/coyote/AbstractProcessorLight.java b/java/org/apache/coyote/AbstractProcessorLight.java
index b26b41f..709530d 100644
--- a/java/org/apache/coyote/AbstractProcessorLight.java
+++ b/java/org/apache/coyote/AbstractProcessorLight.java
@@ -77,7 +77,7 @@ public abstract class AbstractProcessorLight implements Processor {
"], State out: [" + state + "]");
}
- if (state != SocketState.CLOSED && isAsync()) {
+ if (isAsync()) {
state = asyncPostProcess();
if (getLog().isDebugEnabled()) {
getLog().debug("Socket: [" + socketWrapper +
diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java b/java/org/apache/coyote/ajp/AjpProcessor.java
index 9788b6e..650df25 100644
--- a/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -328,7 +328,11 @@ public class AjpProcessor extends AbstractProcessor {
// Set keep alive timeout for next request
socketWrapper.setReadTimeout(protocol.getKeepAliveTimeout());
recycle();
- return SocketState.OPEN;
+ if (protocol.isPaused()) {
+ return SocketState.CLOSED;
+ } else {
+ return SocketState.OPEN;
+ }
}
diff --git a/java/org/apache/coyote/http11/Http11Processor.java b/java/org/apache/coyote/http11/Http11Processor.java
index e790d95..15ff7ed 100644
--- a/java/org/apache/coyote/http11/Http11Processor.java
+++ b/java/org/apache/coyote/http11/Http11Processor.java
@@ -438,7 +438,7 @@ public class Http11Processor extends AbstractProcessor {
rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
- if (getErrorState().isError() || protocol.isPaused()) {
+ if (getErrorState().isError() || (protocol.isPaused() && !isAsync())) {
return SocketState.CLOSED;
} else if (isAsync()) {
return SocketState.LONG;
@@ -1045,7 +1045,7 @@ public class Http11Processor extends AbstractProcessor {
@Override
protected SocketState dispatchEndRequest() {
- if (!keepAlive) {
+ if (!keepAlive || protocol.isPaused()) {
return SocketState.CLOSED;
} else {
endRequest();
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index a90c1a9..1a88774 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -143,6 +143,10 @@
<bug>64195</bug>: Revert simplification of NIO block read and write,
deferred to Tomcat 10. (remm)
</fix>
+ <fix>
+ Allow async requests to complete cleanly when the Connector is paused
+ before <code>complete()</code> is called on a container thread. (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