This is an automated email from the ASF dual-hosted git repository. rmaucher pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit a6e177dd11bdcedb046358550a7102a8072e1d99 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 dd682c1d0b..5fdfb9de87 100644 --- a/java/org/apache/catalina/tribes/membership/McastServiceImpl.java +++ b/java/org/apache/catalina/tribes/membership/McastServiceImpl.java @@ -699,9 +699,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]
