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

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

commit d32167ea849338021f3218777fd536e17c617be8
Author: opencode <[email protected]>
AuthorDate: Sun Oct 11 10:34:59 2026 +0200

    Guard the sender recovery trigger against a concurrent stop
    
    The multicast sender triggered a service recovery once it had hit
    recoveryCounter consecutive send failures, without re-checking the
    doRunSender flag that ReceiverThread consults before the same action.
    Since the recovery thread always recreates the socket and the
    receiver and sender threads, the last send failure of a closing
    socket could schedule a recovery that brought the membership back
    after McastService.stop() had already discarded the implementation.
    Nothing then held a reference to stop that revived implementation, so
    it kept pinging with the old unique id, leaving peers unable to
    expire the departed member, and leaked the socket and two threads.
    
    The counter increment and the recovery call now happen only while
    doRunSender is still set, exactly as in the receiver. Recovery on a
    running service is unchanged.
---
 java/org/apache/catalina/tribes/membership/McastServiceImpl.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/tribes/membership/McastServiceImpl.java 
b/java/org/apache/catalina/tribes/membership/McastServiceImpl.java
index 0f01306fd7..d9246daa1a 100644
--- a/java/org/apache/catalina/tribes/membership/McastServiceImpl.java
+++ b/java/org/apache/catalina/tribes/membership/McastServiceImpl.java
@@ -700,9 +700,11 @@ public class McastServiceImpl extends 
MembershipProviderBase {
                     } else {
                         
log.debug(sm.getString("mcastServiceImpl.send.failed"), e);
                     }
-                    if ((++errorCounter) >= recoveryCounter) {
-                        errorCounter = 0;
-                        RecoveryThread.recover(McastServiceImpl.this);
+                    if (doRunSender) {
+                        if ((++errorCounter) >= recoveryCounter) {
+                            errorCounter = 0;
+                            RecoveryThread.recover(McastServiceImpl.this);
+                        }
                     }
                 }
                 try {


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

Reply via email to