Description
The following exception is thrown from the Kafka server when an AlterConfigsRequest API request is made via the binary protocol where the CONFIG_ENTRY's CONFIG_VALUE is set to null:
[2018-07-26 15:53:01,487] ERROR [Admin Manager on Broker 1000]: Error processing alter configs request for resource Resource(type=TOPIC, name='foo'}, config org.apache.kafka.common.requests.AlterConfigsRequest$Config@692d8300 (kafka.server.AdminManager) java.lang.NullPointerException at java.util.Hashtable.put(Hashtable.java:459) at java.util.Properties.setProperty(Properties.java:166) at kafka.server.AdminManager$$anonfun$alterConfigs$1$$anonfun$apply$18.apply(AdminManager.scala:357) at kafka.server.AdminManager$$anonfun$alterConfigs$1$$anonfun$apply$18.apply(AdminManager.scala:356) at scala.collection.Iterator$class.foreach(Iterator.scala:891) at scala.collection.AbstractIterator.foreach(Iterator.scala:1334) at scala.collection.IterableLike$class.foreach(IterableLike.scala:72) at scala.collection.AbstractIterable.foreach(Iterable.scala:54) at kafka.server.AdminManager$$anonfun$alterConfigs$1.apply(AdminManager.scala:356) at kafka.server.AdminManager$$anonfun$alterConfigs$1.apply(AdminManager.scala:339) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234) at scala.collection.Iterator$class.foreach(Iterator.scala:891) at scala.collection.AbstractIterator.foreach(Iterator.scala:1334) at scala.collection.IterableLike$class.foreach(IterableLike.scala:72) at scala.collection.AbstractIterable.foreach(Iterable.scala:54) at scala.collection.TraversableLike$class.map(TraversableLike.scala:234) at scala.collection.AbstractTraversable.map(Traversable.scala:104) at kafka.server.AdminManager.alterConfigs(AdminManager.scala:339) at kafka.server.KafkaApis.handleAlterConfigsRequest(KafkaApis.scala:1994) at kafka.server.KafkaApis.handle(KafkaApis.scala:143) at kafka.server.KafkaRequestHandler.run(KafkaRequestHandler.scala:69) at java.lang.Thread.run(Thread.java:745)
As a first guess, I'd say the issue is happening here, since HashTable/Property can't take a null value.
The reason I'm sending a null for the configuration value is I assumed that since the API documentation says that the value is nullable (see here and here), this meant the (override) configuration itself would be deleted when a null value was received.
Contradictory to that, I did notice null checks throughout the code, like here.
If null is in fact not meant to be accepted by the binary API, this probably needs to be addressed at the protocol level. Further to that, can someone show me how to then remove a configuration override via the binary API?
For clarity sake, here's what my request looked like (pseudo/Rust):
AlterConfigsRequest { resources: [ Resource { resource_type: 2, resource_name: "foo", config_entries: [ ConfigEntry { config_name: "file.delete.delay.ms", config_value: None // serialized as a 16-bit '-1' } ] } ], validate_only: false }