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

cadonna pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 811761707c1 MINOR: Downgrade log messages of swallowed exception to 
warnings (#19185)
811761707c1 is described below

commit 811761707c17243e47771b89e825509f71d56157
Author: Bruno Cadonna <[email protected]>
AuthorDate: Tue Mar 11 16:43:04 2025 +0100

    MINOR: Downgrade log messages of swallowed exception to warnings (#19185)
    
    Exceptions that are caught during closing a task dirty are swallowed.
    The corresponding log messages are on error level which is misleading
    since the exceptions do not cause any special handling or crash.
    
    This commit downgrades the log messages of swallowed exceptions to
    warnings and explains in the log messages that the exceptions are
    swallowed.
    
    Reviewers: Bill Bejeck <[email protected]>
---
 .../streams/processor/internals/TaskManager.java     | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git 
a/streams/src/main/java/org/apache/kafka/streams/processor/internals/TaskManager.java
 
b/streams/src/main/java/org/apache/kafka/streams/processor/internals/TaskManager.java
index 037ff941105..102e1d07036 100644
--- 
a/streams/src/main/java/org/apache/kafka/streams/processor/internals/TaskManager.java
+++ 
b/streams/src/main/java/org/apache/kafka/streams/processor/internals/TaskManager.java
@@ -280,7 +280,9 @@ public class TaskManager {
                     // closing the topology
                     task.prepareCommit();
                 } catch (final RuntimeException swallow) {
-                    log.error("Error flushing cache for corrupted task {} ", 
task.id(), swallow);
+                    log.warn("Error flushing cache for corrupted task {}. " +
+                        "Since the task is closing dirty, the following 
exception is swallowed: {}",
+                        task.id(), swallow.getMessage());
                 }
 
                 try {
@@ -291,7 +293,9 @@ public class TaskManager {
                         task.postCommit(true);
                     }
                 } catch (final RuntimeException swallow) {
-                    log.error("Error suspending corrupted task {} ", 
task.id(), swallow);
+                    log.warn("Error suspending corrupted task {}. " +
+                        "Since the task is closing dirty, the following 
exception is swallowed: {}",
+                        task.id(), swallow.getMessage());
                 }
                 task.closeDirty();
             }
@@ -1473,13 +1477,17 @@ public class TaskManager {
             // before suspending and closing the topology
             task.prepareCommit();
         } catch (final RuntimeException swallow) {
-            log.error("Error flushing caches of dirty task {}", task.id(), 
swallow);
+            log.warn("Error flushing cache of dirty task {}. " +
+                "Since the task is closing dirty, the following exception is 
swallowed: {}",
+                task.id(), swallow.getMessage());
         }
 
         try {
             task.suspend();
         } catch (final RuntimeException swallow) {
-            log.error("Error suspending dirty task {}: {}", task.id(), 
swallow.getMessage());
+            log.warn("Error suspending dirty task {}. " +
+                "Since the task is closing dirty, the following exception is 
swallowed: {}",
+                task.id(), swallow.getMessage());
         }
 
         task.closeDirty();
@@ -1489,7 +1497,9 @@ public class TaskManager {
                 tasks.removeTask(task);
             }
         } catch (final RuntimeException swallow) {
-            log.error("Error removing dirty task {}: {}", task.id(), 
swallow.getMessage());
+            log.warn("Error removing dirty task {}. " +
+                "Since the task is closing dirty, the following exception is 
swallowed: {}",
+                task.id(), swallow);
         }
     }
 

Reply via email to