Description
AclCommand.AclCommandService uses withAdminClient(opts: AclCommandOptions)(f: Admin => Unit) to abstract the execution of an action using an AdminClient instance. Unfortunately the use of this method in implemeting addAcls() and removeAcls() calls listAcls(). This causes the creation of a second AdminClient instance. When the --command-config option has been used to specify a client.id for the Admin client, the second instance fails to register an MBean, resulting in a warning being logged.
./bin/kafka-acls.sh --bootstrap-server localhost:9092 --command-config config/broker_connection.conf.reproducing --add --allow-principal User:alice --operation Describe --topic 'test' --resource-pattern-type prefixed Adding ACLs for resource `ResourcePattern(resourceType=TOPIC, name=test, patternType=PREFIXED)`: (principal=User:alice, host=*, operation=DESCRIBE, permissionType=ALLOW) [2020-06-03 18:43:12,190] WARN Error registering AppInfo mbean (org.apache.kafka.common.utils.AppInfoParser) javax.management.InstanceAlreadyExistsException: kafka.admin.client:type=app-info,id=administrator_data at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1898) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:966) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324) at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522) at org.apache.kafka.common.utils.AppInfoParser.registerAppInfo(AppInfoParser.java:64) at org.apache.kafka.clients.admin.KafkaAdminClient.<init>(KafkaAdminClient.java:500) at org.apache.kafka.clients.admin.KafkaAdminClient.createInternal(KafkaAdminClient.java:444) at org.apache.kafka.clients.admin.Admin.create(Admin.java:59) at org.apache.kafka.clients.admin.AdminClient.create(AdminClient.java:39) at kafka.admin.AclCommand$AdminClientService.withAdminClient(AclCommand.scala:105) at kafka.admin.AclCommand$AdminClientService.listAcls(AclCommand.scala:146) at kafka.admin.AclCommand$AdminClientService.$anonfun$addAcls$1(AclCommand.scala:123) at kafka.admin.AclCommand$AdminClientService.$anonfun$addAcls$1$adapted(AclCommand.scala:116) at kafka.admin.AclCommand$AdminClientService.withAdminClient(AclCommand.scala:108) at kafka.admin.AclCommand$AdminClientService.addAcls(AclCommand.scala:116) at kafka.admin.AclCommand$.main(AclCommand.scala:78) at kafka.admin.AclCommand.main(AclCommand.scala) Current ACLs for resource `ResourcePattern(resourceType=TOPIC, name=test, patternType=PREFIXED)`: (principal=User:alice, host=*, operation=DESCRIBE, permissionType=ALLOW)
Attachments
Issue Links
- links to