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

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new a533203  Always close the connection when an uncaught NamingException 
occurs
a533203 is described below

commit a53320349d2510af657cf0d3581bc56173b5efc4
Author: remm <r...@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 ed5b4bd..6e2a305 100644
--- a/java/org/apache/catalina/realm/JNDIRealm.java
+++ b/java/org/apache/catalina/realm/JNDIRealm.java
@@ -2311,6 +2311,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 3d75a8e..dce18b3 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 10.1.0-M3 (markt)" 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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to