mirror of https://github.com/apache/kafka.git
KAFKA-6415; Use WARN log level for Metadata in system test
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 is a temporary workaround to avoid deadlocks in system tests by setting log level to WARN for `Metadata` in `VerifiableLog4jAppender`. The fix has been verified using the system tests log4j_appender_test.py which started failing when the info-level log entry was introduced. Author: Rajini Sivaram <rajinisivaram@googlemail.com> Reviewers: Ismael Juma <ismael@juma.me.uk>, Satish Duggana <satish.duggana@gmail.com>, tedyu <yuzhihong@gmail.com> Closes #4375 from rajinisivaram/KAFKA-6415-log4jappender
This commit is contained in:
parent
6869f95232
commit
3de910319e
|
@ -204,6 +204,9 @@ public class VerifiableLog4jAppender {
|
|||
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 {
|
||||
|
|
Loading…
Reference in New Issue