[GitHub] [kafka] pierDipi commented on a diff in pull request #13325: KAFKA-14771: Include threads info in ConcurrentModificationException message
pierDipi commented on code in PR #13325: URL: https://github.com/apache/kafka/pull/13325#discussion_r1155728488 ## clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java: ## @@ -2547,9 +2547,13 @@ private void acquireAndEnsureOpen() { * @throws ConcurrentModificationException if another thread already has the lock */ private void acquire() { -long threadId = Thread.currentThread().getId(); +final Thread thread = Thread.currentThread(); +final long threadId = thread.getId(); if (threadId != currentThread.get() && !currentThread.compareAndSet(NO_CURRENT_THREAD, threadId)) -throw new ConcurrentModificationException("KafkaConsumer is not safe for multi-threaded access"); +throw new ConcurrentModificationException("KafkaConsumer is not safe for multi-threaded access. " + +"currentThread(name: " + thread.getName() + ", id: " + thread.getId() + ")" + Review Comment: ```suggestion "currentThread(name: " + thread.getName() + ", id: " + threadId + ")" + ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [kafka] pierDipi commented on a diff in pull request #13325: KAFKA-14771: Include threads info in ConcurrentModificationException message
pierDipi commented on code in PR #13325: URL: https://github.com/apache/kafka/pull/13325#discussion_r1150758939 ## clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java: ## @@ -2547,9 +2547,10 @@ private void acquireAndEnsureOpen() { * @throws ConcurrentModificationException if another thread already has the lock */ private void acquire() { -long threadId = Thread.currentThread().getId(); +final Thread thread = Thread.currentThread(); +final long threadId = thread.getId(); if (threadId != currentThread.get() && !currentThread.compareAndSet(NO_CURRENT_THREAD, threadId)) -throw new ConcurrentModificationException("KafkaConsumer is not safe for multi-threaded access"); +throw new ConcurrentModificationException("KafkaConsumer is not safe for multi-threaded access. currentThread(name: " + thread.getName() + ", id: " + thread.getId() + ") otherThread(id: " + currentThread.get() + ")"); Review Comment: @mimaison done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [kafka] pierDipi commented on a diff in pull request #13325: KAFKA-14771: Include threads info in ConcurrentModificationException message
pierDipi commented on code in PR #13325: URL: https://github.com/apache/kafka/pull/13325#discussion_r1149221534 ## clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java: ## @@ -2547,9 +2547,10 @@ private void acquireAndEnsureOpen() { * @throws ConcurrentModificationException if another thread already has the lock */ private void acquire() { -long threadId = Thread.currentThread().getId(); +final Thread thread = Thread.currentThread(); +final long threadId = thread.getId(); if (threadId != currentThread.get() && !currentThread.compareAndSet(NO_CURRENT_THREAD, threadId)) -throw new ConcurrentModificationException("KafkaConsumer is not safe for multi-threaded access"); +throw new ConcurrentModificationException("KafkaConsumer is not safe for multi-threaded access. currentThread(name: " + thread.getName() + ", id: " + thread.getId() + ") otherThread(id: " + currentThread.get() + ")"); Review Comment: Sure -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org