This is an automated email from the ASF dual-hosted git repository. markt-asf pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 2801453495ccb302168fb2be9284d92219a1d29f 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 71e600fcf6..0b7c79dcb8 100644 --- a/java/org/apache/tomcat/util/net/SocketWrapperBase.java +++ b/java/org/apache/tomcat/util/net/SocketWrapperBase.java @@ -49,7 +49,7 @@ public abstract class SocketWrapperBase<E> { /** String manager for this class. */ protected static final StringManager sm = StringManager.getManager(SocketWrapperBase.class); - private E socket; + private volatile E socket; private final AbstractEndpoint<E,?> endpoint; private final Lock lock = new ReentrantLock(); diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 6379a110ee..e40dd3e1dc 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -229,6 +229,10 @@ Improve the handling of operations on an NIO2 socket that is being closed. (markt) </fix> + <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]
