This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.0.x by this push: new a932b6f Improve error handling a932b6f is described below commit a932b6f13374893013d2df756621c88ba7f22f2e Author: Mark Thomas <ma...@apache.org> AuthorDate: Wed Nov 10 18:15:39 2021 +0000 Improve error handling I'm not entirely convinced this code path is possible but as we are still seeing JVM crashes in Buildbot, the check seems reasonable. --- java/org/apache/tomcat/util/net/AprEndpoint.java | 3 +++ java/org/apache/tomcat/util/net/LocalStrings.properties | 1 + webapps/docs/changelog.xml | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java index 546666d..b3fbf22 100644 --- a/java/org/apache/tomcat/util/net/AprEndpoint.java +++ b/java/org/apache/tomcat/util/net/AprEndpoint.java @@ -807,6 +807,9 @@ public class AprEndpoint extends AbstractEndpoint<Long,Long> implements SNICallB @Override protected Long serverSocketAccept() throws Exception { long socket = Socket.accept(serverSock); + if (socket == 0) { + throw new IOException(sm.getString("endpoint.err.accept", getName())); + } if (log.isDebugEnabled()) { long sa = Address.get(Socket.APR_REMOTE, socket); Sockaddr addr = Address.getInfo(sa); diff --git a/java/org/apache/tomcat/util/net/LocalStrings.properties b/java/org/apache/tomcat/util/net/LocalStrings.properties index 5d8652c..3e306ec 100644 --- a/java/org/apache/tomcat/util/net/LocalStrings.properties +++ b/java/org/apache/tomcat/util/net/LocalStrings.properties @@ -79,6 +79,7 @@ endpoint.debug.unlock.fail=Caught exception trying to unlock accept on port [{0} endpoint.debug.unlock.localFail=Unable to determine local address for [{0}] endpoint.debug.unlock.localNone=Failed to unlock acceptor for [{0}] because the local address was not available endpoint.duplicateSslHostName=Multiple SSLHostConfig elements were provided for the host name [{0}]. Host names must be unique. +endpoint.err.accept=Failed to accept socket for end point [{0}] endpoint.err.attach=Failed to attach SSLContext to socket - error [{0}] endpoint.err.close=Caught exception trying to close socket endpoint.err.handshake=Handshake failed diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 4b233d6..a6663f5 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -111,6 +111,10 @@ Improve error handling if APR/Native fails to attach TLS capabilities to a TLS enabled client connection. (markt) </fix> + <fix> + Improve error handling if APR/Native fails to accept an incoming + connection. (markt) + </fix> </changelog> </subsection> </section> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org