Vadim Chekan created KAFKA-1405:
-----------------------------------

             Summary: Global JSON.globalNumberParser screws up other libraries
                 Key: KAFKA-1405
                 URL: https://issues.apache.org/jira/browse/KAFKA-1405
             Project: Kafka
          Issue Type: Bug
    Affects Versions: 0.8.0
            Reporter: Vadim Chekan


I'm getting exception "kafka.common.ConsumerRebalanceFailedException" but it 
only happens when I do a call to "scala/pickling" serialization library. What 
the connection you might ask? The underly exception is 

"ZookeeperConsumerConnector:76, exception during rebalance 
kafka.common.KafkaException: Failed to parse the broker info from zookeeper: 
{"jmx_port":-1,"timestamp":"1397514497053","host":"xxx","version":1,"port":9092}
Caused by: java.lang.ClassCastException: java.lang.Double cannot be cast to 
java.lang.Integer"

A little bit looking at  kafka code lead me to this line:
In 
https://github.com/apache/kafka/blob/0.8.0/core/src/main/scala/kafka/utils/Json.scala#L27

there is JSON.globalNumberParser redefined. It is terrible idea to change 
global variable. This JSON library is used by other libraries and this global 
assignment messes it up.

My 5-minutes research shows that scala's JSON library was considered almost of 
demo quality and most people prefer ligt-json implementation.
https://groups.google.com/forum/#!topic/scala-user/P7-8PEUUj6A
Also it is my understanding, that scala JSON is deprecated in scala-2.11, so 
this change is needed anyway.

If no objections to this ticket in general, I can work on a patch to use 3rd 
party JSON library usage in kafka. Pleas let me know...



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to