This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/11.0.x by this push:
     new 57eaa3b9ca Handle spurious wake-ups during sending of messages by 
RpcChannel
57eaa3b9ca is described below

commit 57eaa3b9caa2152754b85cff2a9b2309ece658ca
Author: Mark Thomas <[email protected]>
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 9d6ac30455..4c9bee9e9b 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 78fef52b86..40382e0c09 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -153,6 +153,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 = "Other">


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to