This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 8749df7 Improve error handling
8749df7 is described below
commit 8749df70de9a096b33faffe699e1008a9a696219
Author: Mark Thomas <[email protected]>
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 ace5cd9..3a3aa0b 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -803,6 +803,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 2ea791b..ddee7bb 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: [email protected]
For additional commands, e-mail: [email protected]