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

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


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

commit 3fb49e1bf771399638bbe2b47ce82584ca87a414
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 cbef335..b0e75a5 100644
--- a/java/org/apache/catalina/realm/JNDIRealm.java
+++ b/java/org/apache/catalina/realm/JNDIRealm.java
@@ -2327,6 +2327,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 00ea428..ad85d11 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 8.5.70 (schultz)" 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>
 </section>
 <section name="Tomcat 8.5.69 (schultz)" rtext="in progress">
   <subsection name="Catalina">

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

Reply via email to