You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2021/06/30 13:09:28 UTC

[tomcat] branch 9.0.x updated: Always close the connection when an uncaught NamingException occurs

This is an automated email from the ASF dual-hosted git repository.

remm 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 a695dc3  Always close the connection when an uncaught NamingException occurs
a695dc3 is described below

commit a695dc3b549e5643b1afe15c1c3d663bedeeb4ad
Author: remm <re...@apache.org>
AuthorDate: Wed Jun 30 14:57:40 2021 +0200

    Always close the connection when an uncaught NamingException occurs
    
    65411: Avoids possible connection locking. And this is safer anyway.
    Submitted by Ole Ostergaard.
---
 java/org/apache/catalina/realm/JNDIRealm.java | 4 ++++
 webapps/docs/changelog.xml                    | 9 +++++++++
 2 files changed, 13 insertions(+)

diff --git a/java/org/apache/catalina/realm/JNDIRealm.java b/java/org/apache/catalina/realm/JNDIRealm.java
index 7f72ae3..dd43c0c 100644
--- a/java/org/apache/catalina/realm/JNDIRealm.java
+++ b/java/org/apache/catalina/realm/JNDIRealm.java
@@ -2312,6 +2312,10 @@ public class JNDIRealm extends RealmBase {
             // Log the problem for posterity
             containerLog.error(sm.getString("jndiRealm.exception"), e);
 
+            // close the connection so we know it will be reopened.
+            close(connection);
+            closePooledConnections();
+
             // Return "not authenticated" for this request
             return null;
         }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 5102b40..9c19ee9 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -105,6 +105,15 @@
   issues do not "pop up" wrt. others).
 -->
 <section name="Tomcat 9.0.51 (remm)" rtext="in development">
+  <subsection name="Catalina">
+    <changelog>
+      <fix>
+        <bug>65411</bug>: Always close the connection when an uncaught
+        <code>NamingException</code> occurs to avoid connection locking.
+        Submitted by Ole Ostergaard. (remm)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="Coyote">
     <changelog>
       <fix>

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