Prime Minister of Funhavistan created KAFKA-14164: -----------------------------------------------------
Summary: Enabling JMX on one Service Breaks kafka-run-class Shell Script for All Key: KAFKA-14164 URL: https://issues.apache.org/jira/browse/KAFKA-14164 Project: Kafka Issue Type: Improvement Components: packaging Affects Versions: 3.2.1 Reporter: Prime Minister of Funhavistan Step 1: On a server running kafka using the kafka-server-start script and KAFKA_JMX_OPTS populated to turn on JMX. Kafka broker starts with a jmx listener. Step 2: Use another script like bin/kafka-topics, the shell script always fails because the call to kafka-run-class always triggers starting a jmx listener on the same port in the environment variables. Expected behavior: Be able to use a script like kafka-topics without error on a host that already has JMX environment variables. Actual behavior: bin/kafka-topics errors out trying to start another jmx listener on the same port in KAFKA_JMX_OPTS. When kafka-topics shell script pass arguments to kafka-run-class, kafka-run-class tries and fails to initialize a jmx listener because, in this example, the kafka-server-start already started one. A proposed solution is editing the kafka-run-class file. # add a variable declaration NO_JMX="true" # Add the following to the case statement in kafka-run-class.sh {{ kafka.Kafka|org.apache.kafka.connect.cli.ConnectDistributed) NO_JMX="false"}} {{ shift}} {{ ;;}} # {{{}Add an elif at the end of kafka-run-class.sh{}}}{{{}elif [ "$NO_JMX" = "true" ] ; then exec "$JAVA" $KAFKA_HEAP_OPTS $KAFKA_JVM_PERFORMANCE_OPTS $KAFKA_GC_LOG_OPTS $KAFKA_LOG4J_OPTS -cp "$CLASSPATH" $KAFKA_OPTS "$@"{}}}{{{}{}}} -- This message was sent by Atlassian Jira (v8.20.10#820010)