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 6132be9430 Handle spurious wake-ups during sending of messages by 
RpcChannel
6132be9430 is described below

commit 6132be9430b4d07145c761962e06fc10aadbd8ac
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Sat Aug 30 17:04:43 2025 +0100

    Handle spurious wake-ups during sending of messages by RpcChannel
---
 java/org/apache/catalina/tribes/group/RpcChannel.java | 6 +++++-
 res/spotbugs/filter-false-positives.xml               | 5 -----
 webapps/docs/changelog.xml                            | 4 ++++
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/catalina/tribes/group/RpcChannel.java 
b/java/org/apache/catalina/tribes/group/RpcChannel.java
index 19b68f32f0..46297c7c7b 100644
--- a/java/org/apache/catalina/tribes/group/RpcChannel.java
+++ b/java/org/apache/catalina/tribes/group/RpcChannel.java
@@ -100,7 +100,11 @@ public class RpcChannel implements ChannelListener {
                 RpcMessage rmsg = new RpcMessage(rpcId, key.id, message);
                 channel.send(destination, rmsg, sendOptions);
                 if (rpcOptions != NO_REPLY) {
-                    collector.wait(timeout);
+                    long timeoutExpiry = System.nanoTime() + timeout * 
1_000_000;
+                    while (collector.isComplete() && timeout > 0) {
+                        collector.wait(timeout);
+                        timeout = (timeoutExpiry - System.nanoTime()) / 
1_000_000;
+                    }
                 }
             }
         } catch (InterruptedException ix) {
diff --git a/res/spotbugs/filter-false-positives.xml 
b/res/spotbugs/filter-false-positives.xml
index 000827a625..ea8b3e26bd 100644
--- a/res/spotbugs/filter-false-positives.xml
+++ b/res/spotbugs/filter-false-positives.xml
@@ -658,11 +658,6 @@
     <Field name="utilityExecutor" />
     <Bug pattern="IS2_INCONSISTENT_SYNC" />
   </Match>
-  <Match>
-    <Class name="org.apache.catalina.tribes.group.RpcChannel"/>
-    <Method name="send"/>
-    <Bug pattern="WA_NOT_IN_LOOP"/>
-  </Match>
   <Match>
     <!-- Class lock is not an instance lock -->
     <Class name="org.apache.catalina.tribes.io.BufferPool" />
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 11c6cd159b..40b6db093f 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -267,6 +267,10 @@
         Handle spurious wake-ups during leader election for
         <code>NonBlockingCoordinator</code>. (markt)
       </fix>
+      <fix>
+        Handle spurious wake-ups during sending of messages by
+        <code>RpcChannel</code>. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="WebSocket">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to