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:26:30 UTC

[tomcat] 01/05: 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 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 650cb85ad2871a108c142be7ebf2de67687fe887
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 4e67f7e..a50b721 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -330,7 +330,11 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel> {
         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