Open mukkchir opened 1 year ago
@mukkchir thanks for the detailed report. Is it possible that your default charset is set to something different to UTF-8?
Please could you try this build that I have prepared, with a possible fix.
Let me know how it goes.
@davidsloan you are really a lifesaver and huge kudos to you for giving me a quick fix. It's working! I'm now able to connect to the stream successfully. I would like to keep this ticket open for a few more days as I'm doing some tests on kafka and the connector you provided. I will report back to this thread in case of any errors/exceptions.
@davidsloan The connector is constantly looping over "error handling message on topic" and re-subscribing to topic with error description below:
2023-05-15 08:24:04,304 DEBUG [mqtt-hm-source-connector|task-0] Message received on topic [TOPIC_NAME]. Message id =[3] , isDuplicate=false, payload=ENCRYPTED_DATA (com.datamountaineer.streamreactor.connect.mqtt.source.MqttManager) [MQTT Call: afaf2189-2fc7-4288-8ed4-0c90846c5ef3]
2023-05-15 08:24:04,304 ERROR [mqtt-hm-source-connector|task-0] Error handling message with id:3 on topic:TOPIC_NAME (com.datamountaineer.streamreactor.connect.mqtt.source.MqttManager) [MQTT Call: afaf2189-2fc7-4288-8ed4-0c90846c5ef3]
org.apache.kafka.connect.errors.DataException: Struct schemas do not match.
at org.apache.kafka.connect.data.ConnectSchema.validateValue(ConnectSchema.java:249)
at org.apache.kafka.connect.data.ConnectSchema.validateValue(ConnectSchema.java:213)
at org.apache.kafka.connect.data.ConnectSchema.validateValue(ConnectSchema.java:255)
at org.apache.kafka.connect.data.Struct.put(Struct.java:216)
at org.apache.kafka.connect.data.Struct.put(Struct.java:203)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter$.$anonfun$handleObject$2(JsonSimpleConverter.scala:142)
at scala.collection.immutable.Map$Map1.foreach(Map.scala:258)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter$.handleObject(JsonSimpleConverter.scala:142)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter$.convert(JsonSimpleConverter.scala:117)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter$.$anonfun$handleObject$1(JsonSimpleConverter.scala:135)
at scala.collection.immutable.List.map(List.scala:246)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter$.handleObject(JsonSimpleConverter.scala:133)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter$.convert(JsonSimpleConverter.scala:117)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter$.$anonfun$handleObject$1(JsonSimpleConverter.scala:135)
at scala.collection.immutable.List.map(List.scala:246)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter$.handleObject(JsonSimpleConverter.scala:133)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter$.convert(JsonSimpleConverter.scala:117)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter$.convert(JsonSimpleConverter.scala:98)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter.convert(JsonSimpleConverter.scala:46)
at com.datamountaineer.streamreactor.connect.mqtt.source.MqttManager.messageArrived(MqttManager.scala:122)
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.deliverMessage(CommsCallback.java:519)
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:417)
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:214)
at java.base/java.lang.Thread.run(Thread.java:833)
2023-05-15 08:24:04,305 WARN [mqtt-hm-source-connector|task-0] Connection lost. Re-connecting is set to true (com.datamountaineer.streamreactor.connect.mqtt.source.MqttManager) [MQTT Call: afaf2189-2fc7-4288-8ed4-0c90846c5ef3]
MqttException (0) - org.apache.kafka.connect.errors.DataException: Struct schemas do not match.
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:228)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.apache.kafka.connect.errors.DataException: Struct schemas do not match.
at org.apache.kafka.connect.data.ConnectSchema.validateValue(ConnectSchema.java:249)
at org.apache.kafka.connect.data.ConnectSchema.validateValue(ConnectSchema.java:213)
at org.apache.kafka.connect.data.ConnectSchema.validateValue(ConnectSchema.java:255)
at org.apache.kafka.connect.data.Struct.put(Struct.java:216)
at org.apache.kafka.connect.data.Struct.put(Struct.java:203)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter$.$anonfun$handleObject$2(JsonSimpleConverter.scala:142)
at scala.collection.immutable.Map$Map1.foreach(Map.scala:258)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter$.handleObject(JsonSimpleConverter.scala:142)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter$.convert(JsonSimpleConverter.scala:117)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter$.$anonfun$handleObject$1(JsonSimpleConverter.scala:135)
at scala.collection.immutable.List.map(List.scala:246)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter$.handleObject(JsonSimpleConverter.scala:133)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter$.convert(JsonSimpleConverter.scala:117)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter$.$anonfun$handleObject$1(JsonSimpleConverter.scala:135)
at scala.collection.immutable.List.map(List.scala:246)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter$.handleObject(JsonSimpleConverter.scala:133)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter$.convert(JsonSimpleConverter.scala:117)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter$.convert(JsonSimpleConverter.scala:98)
at com.datamountaineer.streamreactor.connect.converters.source.JsonSimpleConverter.convert(JsonSimpleConverter.scala:46)
at com.datamountaineer.streamreactor.connect.mqtt.source.MqttManager.messageArrived(MqttManager.scala:122)
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.deliverMessage(CommsCallback.java:519)
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:417)
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:214)
... 1 more
Not sure what is happening. How to properly handle this in the connector config? Also, what happens if the task.max is set to 2 or more?
Not sure what is happening. How to properly handle this in the connector config? Also, what happens if the task.max is set to 2 or more?
@mukkchir are you able to send me some samples of your data? This would help troubleshooting this issue. You can find me on our community slack if you are not comfortable sending it on here. It is not obvious to me what the problem is without more information.
@davidsloan Sure! Here is the sample data on which the error is occurring:
{
"_id":{
"$oid":"VARCHAR"
},
"capability":"diagnostics",
"data":{
"diagnostics":{
"tire_pressures":[
{
"data":{
"location":"front_left",
"pressure":{
"unit":"kilopascals",
"value":{
"$numberDouble":"230.0"
}
}
},
"timestamp":"2022-11-17T12:33:22.000Z"
},
{
"data":{
"location":"front_right",
"pressure":{
"unit":"kilopascals",
"value":{
"$numberDouble":"230.0"
}
}
},
"timestamp":"2022-11-17T12:33:19.000Z"
},
{
"data":{
"location":"rear_left",
"pressure":{
"unit":"kilopascals",
"value":{
"$numberDouble":"257.5"
}
}
},
"timestamp":"2022-11-17T12:33:50.000Z"
},
{
"data":{
"location":"rear_right",
"pressure":{
"unit":"kilopascals",
"value":{
"$numberDouble":"252.5"
}
}
},
"timestamp":"2022-11-17T12:33:10.000Z"
}
]
}
},
"message_id":"VARCHAR",
"property":"tire_pressures",
"version":{
"$numberInt":"1"
},
"num":"VARCHAR"
}
I'm sorry I'm not seeing a problem with this input
I've put together a quick test here which you can see is working: https://github.com/lensesio/stream-reactor/pull/942
Is this message any different from previous messages? Is there any schema change, missing/added fields etc here since the preceding message?
@davidsloan This is just the sample data. Since the data is encrypted, I'm working on decrypting it. I will post the actual data soon. Is there a config where I can move to next message if the previous message is faulty?
@davidsloan I've got the same issue with the jms source connector. When can we expect a release with the fix included? Thank you very much :pray:.
@davidsloan seems like its the same data which I posted here.
@mukkchir this is message id 3, correct? Are message id 1 & 2 any different?
@mukkchir it seems like the issue might be that a different charset encoding is being configured by default. Please can you try setting this environment variable in the Connect container:
LC_ALL=en_US.UTF-8
And let me know how you get on.
Hey,
@davidsloan I was getting the exact same error with MalfromedInputException using strimzi and AKS deployment. Your uploaded package fix the issue for me so thanks a lot for that, waiting for an update for official release.
I tried the AC_ALL=en_US.UTF-8 but it was ignore by the bash at the beginning of the connect: "bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)"
Thanks.
Hi @davidsloan, I'm now using the "sink connector" and I have the same problem with the malformed input. Is your fix handling only the source connector? Any idea if an official release will be soon with those fixes?
Thanks a lot, Erez.
Im using mqtt connector inside debezium kafka connect docker, the issue was solved by adding LANG=en_US.UTF-8 variable to docker container
Hi,
I have deployed Strimzi kafka clusters in azure k8s. After deploying the MQTT source connector, I get the following error upon
kubectl describe kctr -n kafka
-Error Trace
MQTT source connector config
Strimzi kafka config
Steps to reproduce in azure k8s
Previously used versions
Currently used versions
In both of these versions, the same error above persisted. I think I'm missing some config but not sure what it is. Any guidance will be greatly helpful.