hudeqi commented on PR #13348: URL: https://github.com/apache/kafka/pull/13348#issuecomment-1471374895
> Hi, I think this introduced a race condition that can cause the producer-perf-test to log a lot of exceptions to console if num records > 500000. Since the `iteration` is incremented from the callback, multiple threads may see the same value when deciding whether to update `latencies`, so it can go out of bounds when updating `latencies`. > > ``` > bin/kafka-producer-perf-test.sh --topic perf-test --throughput -1 --num-records 1000000 --producer-props acks=all bootstrap.servers=localhost:9092 --record-size 50 > ``` > > Sometimes it logs: > > ``` > [2023-03-16 15:30:57,432] ERROR Error executing user-provided callback on message for topic-partition 'perf-test-0' (org.apache.kafka.clients.producer.internals.ProducerBatch) > java.lang.ArrayIndexOutOfBoundsException: Index 500001 out of bounds for length 500001 > at org.apache.kafka.tools.ProducerPerformance$Stats.record(ProducerPerformance.java:38 > ``` > > It doesn't kill the test run but it looks alarming to see a couple of hundred errors in console. nice catch! -- 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