[ 
https://issues.apache.org/jira/browse/KAFKA-6415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16310133#comment-16310133
 ] 

ASF GitHub Bot commented on KAFKA-6415:
---------------------------------------

rajinisivaram closed pull request #4375: KAFKA-6415: Use WARN log level for 
Metadata in system test
URL: https://github.com/apache/kafka/pull/4375
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/tools/src/main/java/org/apache/kafka/tools/VerifiableLog4jAppender.java 
b/tools/src/main/java/org/apache/kafka/tools/VerifiableLog4jAppender.java
index 4dd7bee9791..9533f6e58aa 100644
--- a/tools/src/main/java/org/apache/kafka/tools/VerifiableLog4jAppender.java
+++ b/tools/src/main/java/org/apache/kafka/tools/VerifiableLog4jAppender.java
@@ -204,6 +204,9 @@ public static VerifiableLog4jAppender 
createFromArgs(String[] args) {
                 props.setProperty("log4j.appender.KAFKA.kerb5ConfPath", 
res.getString("kerb5ConfPath"));
             }
             props.setProperty("log4j.logger.kafka.log4j", "INFO, KAFKA");
+            // Changing log level from INFO to WARN as a temporary workaround 
for KAFKA-6415. This is to
+            // avoid deadlock in system tests when producer network thread 
appends to log while updating metadata.
+            
props.setProperty("log4j.logger.org.apache.kafka.clients.Metadata", "WARN, 
KAFKA");
 
             if (configFile != null) {
                 try {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> KafkaLog4jAppender deadlocks when logging from producer network thread
> ----------------------------------------------------------------------
>
>                 Key: KAFKA-6415
>                 URL: https://issues.apache.org/jira/browse/KAFKA-6415
>             Project: Kafka
>          Issue Type: Bug
>          Components: log
>            Reporter: Rajini Sivaram
>            Assignee: Rajini Sivaram
>             Fix For: 1.1.0
>
>
> When a log entry is appended to a Kafka topic using KafkaLog4jAppender, the 
> producer.send operation may block waiting for metadata. This can result in 
> deadlocks in a couple of scenarios if a log entry from the producer network 
> thread is also at a log level that results in the entry being appended to a 
> Kafka topic.
> 1. Producer's network thread will attempt to send data to a Kafka topic and 
> this is unsafe since producer.send may block waiting for metadata, causing a 
> deadlock since the thread will not process the metadata request/response.
> 2. KafkaLog4jAppender#append is invoked while holding the lock of the logger. 
> So the thread waiting for metadata in the initial send will be holding the 
> logger lock. If the producer network thread has.a log entry that needs to be 
> appended, it will attempt to acquire the logger lock and deadlock.
> This was probably the case right from the beginning when KafkaLog4jAppender 
> was introduced, but did not cause any issues so far since there were only 
> debug log entries in that path which were not logged to a Kafka topic by any 
> of the tests. A recent info level log entry introduced by the commit 
> https://github.com/apache/kafka/commit/a3aea3cf4dbedb293f2d7859e0298bebc8e2185f
>  is causing system test failures in log4j_appender_test.py due to the 
> deadlock.
> The asynchronous append case can be fixed by moving all send operations to a 
> separate thread. But KafkaLog4jAppender also has a syncSend option which 
> blocks append while holding the logger lock until the send completes. Not 
> sure how this can be fixed if we want to support log appends from the 
> producer network thread.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to