On Wed, May 27, 2026 at 6:54 PM <[email protected]> wrote: > > This is an automated email from the ASF dual-hosted git repository. > > markt-asf 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 7b8ac34e50 Restore short-circuit behaviour where required. > 7b8ac34e50 is described below > > commit 7b8ac34e50742b147ff98f38c4c0ec8947a45dbe > Author: Mark Thomas <[email protected]> > AuthorDate: Wed May 27 17:53:24 2026 +0100 > > Restore short-circuit behaviour where required. > --- > java/org/apache/catalina/tribes/transport/PooledSender.java | 3 ++- > java/org/apache/tomcat/util/net/NioEndpoint.java | 3 ++- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/java/org/apache/catalina/tribes/transport/PooledSender.java > b/java/org/apache/catalina/tribes/transport/PooledSender.java > index 6a3a832f1f..1f25b99083 100644 > --- a/java/org/apache/catalina/tribes/transport/PooledSender.java > +++ b/java/org/apache/catalina/tribes/transport/PooledSender.java > @@ -196,7 +196,8 @@ public abstract class PooledSender extends AbstractSender > implements MultiPointS > DataSender[] list = notinuse.toArray(new DataSender[0]); > boolean result = false; > for (DataSender dataSender : list) { > - result = result || dataSender.keepalive(); > + // Do not short-circuit. dataSender.keepalive() does real, > required work for all senders. > + result = result | dataSender.keepalive(); > } > return result; > } > diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java > b/java/org/apache/tomcat/util/net/NioEndpoint.java > index 0c55f89af1..34cb4d2a69 100644 > --- a/java/org/apache/tomcat/util/net/NioEndpoint.java > +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java > @@ -925,7 +925,8 @@ public class NioEndpoint extends > AbstractNetworkChannelEndpoint<NioChannel,Socke > } > // Either we timed out or we woke up, process events > first > if (keyCount == 0) { > - hasEvents = (hasEvents || events()); > + // Non-shorrt-circuit OR since events() always needs > to run here. > + hasEvents = (hasEvents | events()); > } > } catch (Throwable x) { > ExceptionUtils.handleThrowable(x);
Good thing you caught this one. I see the trick was added 20 years ago, and I never really paid attention to it. This does not seem to be something that my model understands very well, it's likely not used too much around. Shouldn't we rewrite it as "hasEvents = events() ? : true : hasEvents" or something like that ? Rémy --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
