You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/04/03 08:23:14 UTC

[tomcat] 01/04: Log exceptions when closing the server socket and don't re-throw

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

commit 89db08869ba51ad608c5c4dcb924e0bde7b2fc6b
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Apr 2 21:23:51 2020 +0100

    Log exceptions when closing the server socket and don't re-throw
    
    Running the unit tests on MacOS I saw a test failure caused by an
    exception as this point. I've never seen an exception here before. It
    certainly isn't repeatable. On balance, logging the exception and
    completing the rest of the Connector shutdown cleanly looks to be the
    better option.
---
 java/org/apache/tomcat/util/net/NioEndpoint.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 3e82123..9f6654f 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -332,7 +332,11 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel>
         if (running) {
             stop();
         }
-        doCloseServerSocket();
+        try {
+            doCloseServerSocket();
+        } catch (IOException ioe) {
+            getLog().warn(sm.getString("endpoint.serverSocket.closeFailed", getName()), ioe);
+        }
         destroySsl();
         super.unbind();
         if (getHandler() != null ) {


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org