This is an automated email from the ASF dual-hosted git repository.
markt-asf 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 f8e17ffa5a Make the wrapped socket field volatile
f8e17ffa5a is described below
commit f8e17ffa5a87ebb9043c541e0597d2ded9ae54f6
Author: Mark Thomas <[email protected]>
AuthorDate: Sat Nov 28 09:28:39 2026 +0000
Make the wrapped socket field volatile
Ensure that replacing the socket, such as when a connection is closed,
is
visible to all threads using the socket wrapper.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
---
java/org/apache/tomcat/util/net/SocketWrapperBase.java | 2 +-
webapps/docs/changelog.xml | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/tomcat/util/net/SocketWrapperBase.java
b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
index 16f23699b0..57ad4baf19 100644
--- a/java/org/apache/tomcat/util/net/SocketWrapperBase.java
+++ b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
@@ -61,7 +61,7 @@ public abstract class SocketWrapperBase<E> {
*/
private static final AtomicLong connectionIdGenerator = new AtomicLong(0);
- private E socket;
+ private volatile E socket;
private final AbstractEndpoint<E,?> endpoint;
private final ReentrantLock lock = new ReentrantLock();
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 93ecd8cfe2..a8c78a721a 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -355,6 +355,10 @@
Remove support for HTTP 0.9. (markt)
</update>
<!-- Entries for backport and removal before 12.0.0-M1 below this line
-->
+ <fix>
+ Ensure that a change to the socket wrapped by a socket wrapper is
+ visible to all threads. (markt)
+ </fix>
<fix>
<bug>70287</bug>: Restore the keep-alive timeout after a sendfile
write.
Patch provided by Artur Shellunts. (markt)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]