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 80d221b8f2 Correct a regression in the fix for BZ 66508
80d221b8f2 is described below
commit 80d221b8f20ea0022564e770ca7af95040065973
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Jan 18 18:43:07 2024 +0000
Correct a regression in the fix for BZ 66508
It could could cause an UpgradeProcessor leak in some circumstances
https://bz.apache.org/bugzilla/show_bug.cgi?id=66508
---
.../tomcat/websocket/server/WsRemoteEndpointImplServer.java | 9 +++++++--
webapps/docs/changelog.xml | 8 ++++++++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git
a/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
b/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
index b520f394af..f1a3a6e6fd 100644
--- a/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
+++ b/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
@@ -103,8 +103,13 @@ public class WsRemoteEndpointImplServer extends
WsRemoteEndpointImplBase {
protected boolean acquireMessagePartInProgressSemaphore(byte opCode, long
timeoutExpiry)
throws InterruptedException {
- // Only close requires special handling.
- if (opCode != Constants.OPCODE_CLOSE) {
+ /*
+ * Special handling is required only when all of the following are
true:
+ * - A close message is being sent
+ * - This thread currently holds the socketWrapper lock (i.e. the
thread is current processing a socket event)
+ */
+ if (!(opCode == Constants.OPCODE_CLOSE &&
socketWrapper.getLock().isHeldByCurrentThread())) {
+ // Skip special handling
return super.acquireMessagePartInProgressSemaphore(opCode,
timeoutExpiry);
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index fbda5cdec1..1366e546f5 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -147,6 +147,14 @@
</fix>
</changelog>
</subsection>
+ <subsection name="WebSocket">
+ <changelog>
+ <fix>
+ Correct a regression in the fix for <bug>66508</bug> that could cause
an
+ <code>UpgradeProcessor</code> leak in some circumstances. (markt)
+ </fix>
+ </changelog>
+ </subsection>
</section>
<section name="Tomcat 11.0.0-M16 (markt)" rtext="2024-01-09">
<subsection name="Catalina">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]