This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 1013a74011 Make asynchronous error handling more robust.
1013a74011 is described below
commit 1013a74011fcc381df66426c4d6cb5f3909e5c2f
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Jan 24 14:55:06 2024 +0000
Make asynchronous error handling more robust.
Ensure that once a connection is marked to be closed, further
asynchronous processing cannot change that.
---
java/org/apache/coyote/AbstractProcessorLight.java | 7 ++++++-
webapps/docs/changelog.xml | 5 +++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/coyote/AbstractProcessorLight.java
b/java/org/apache/coyote/AbstractProcessorLight.java
index f86fbc41a5..5a60dd2a54 100644
--- a/java/org/apache/coyote/AbstractProcessorLight.java
+++ b/java/org/apache/coyote/AbstractProcessorLight.java
@@ -74,7 +74,12 @@ public abstract class AbstractProcessorLight implements
Processor {
"Socket: [" + socketWrapper + "], Status in: [" +
status + "], State out: [" + state + "]");
}
- if (isAsync()) {
+ /*
+ * If state is already CLOSED don't call asyncPostProcess() as
that will likely change the the state to some
+ * other value causing processing to continue when it should
cease. The AsyncStateMachine will be recycled
+ * as part of the Processor clean-up on CLOSED so it doesn't
matter what state it is left in at this point.
+ */
+ if (isAsync() && state != SocketState.CLOSED) {
state = asyncPostProcess();
if (getLog().isDebugEnabled()) {
getLog().debug(
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 1366e546f5..756b40a1b7 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -137,6 +137,11 @@
Optimize state handling for OpenSSL context callbacks with the FFM API.
(remm)
</fix>
+ <fix>
+ Make asynchronous error handling more robust. Ensure that once a
+ connection is marked to be closed, further asynchronous processing
+ cannot change that. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]