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

markt-asf 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 04b638d186 Review "Fix recovery after write failures in JULI 
FileHandler"
04b638d186 is described below

commit 04b638d1864cc6cd7cc0e5a533300878f17815bc
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Nov 6 15:04:23 2026 +0000

    Review "Fix recovery after write failures in JULI FileHandler"
    
    Fix a potential deadlock
---
 java/org/apache/juli/FileHandler.java | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/java/org/apache/juli/FileHandler.java 
b/java/org/apache/juli/FileHandler.java
index 2bc787e4d0..a08ccbfd41 100644
--- a/java/org/apache/juli/FileHandler.java
+++ b/java/org/apache/juli/FileHandler.java
@@ -237,6 +237,14 @@ public class FileHandler extends Handler {
             tsDate = "";
         }
 
+        String result;
+        try {
+            result = getFormatter().format(record);
+        } catch (Exception e) {
+            reportError(null, e, ErrorManager.FORMAT_FAILURE);
+            return;
+        }
+
         writerLock.readLock().lock();
         try {
             // If the date has changed, switch log files
@@ -260,14 +268,6 @@ public class FileHandler extends Handler {
                 }
             }
 
-            String result;
-            try {
-                result = getFormatter().format(record);
-            } catch (Exception e) {
-                reportError(null, e, ErrorManager.FORMAT_FAILURE);
-                return;
-            }
-
             try {
                 if (writer != null) {
                     writer.write(result);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to