Kevin Lu created KAFKA-7218:
-------------------------------

             Summary: Log thread names & ids when KafkaConsumer throws 
ConcurrentModificationException
                 Key: KAFKA-7218
                 URL: https://issues.apache.org/jira/browse/KAFKA-7218
             Project: Kafka
          Issue Type: Improvement
          Components: consumer, log
            Reporter: Kevin Lu
            Assignee: Kevin Lu


KafkaConsumer does not support multi-threaded usage and any access by a thread 
that does not have the lock will cause ConcurrentModificationException to be 
thrown.

For some users leveraging frameworks on top of Kafka that abstract the actual 
KafkaConsumer class/calls, it can be hard to identify user and/or framework 
bugs when this exception is thrown.

It would be incredibly helpful to log both the thread name and the thread ID of 
the thread that has acquired the lock, and the current thread that is 
attempting to obtain the lock in the exception message.

 

KafkaConsumer currently only tracks the id of the thread that has acquired the 
lock. Additionally, we should also keep track of the thread name.

An example of the exception message: "KafkaConsumer is not safe for 
multi-threaded access: acquiredThreadName=acquiredThread, acquiredThreadId=1, 
currentThreadName=rejectedThread, currentThreadId=2"



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to