Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IllegalArgumentException: Invalid UTF-8 char: [a] #836

Open
1 task
kavidriod opened this issue Sep 29, 2020 · 12 comments
Open
1 task

java.lang.IllegalArgumentException: Invalid UTF-8 char: [a] #836

kavidriod opened this issue Sep 29, 2020 · 12 comments

Comments

@kavidriod
Copy link

Please fill out the form below before submitting, thank you!

  • Bug exists Release Version 1.2.5 ( Master Branch)

I'm trying to connect with mosquito broker via paho client (versions used are org.eclipse.paho.client.mqttv3-1.2.5.jar and org.eclipse.paho.client.mqttv3-1.2.1.jar)

When I try to connect I'm getting:

2020-09-29 20:43:24.233 12057-12057/com.paho.mqtt W/System.err: Connection lost (32109) - java.lang.IllegalArgumentException: Invalid UTF-8 char: [a]
2020-09-29 20:43:24.233 12057-12057/com.paho.mqtt W/System.err:     at org.eclipse.paho.client.mqttv3.internal.CommsSender.handleRunException(CommsSender.java:194)
2020-09-29 20:43:24.233 12057-12057/com.paho.mqtt W/System.err:     at org.eclipse.paho.client.mqttv3.internal.CommsSender.run(CommsSender.java:171)
2020-09-29 20:43:24.233 12057-12057/com.paho.mqtt W/System.err:     at java.lang.Thread.run(Thread.java:764)
2020-09-29 20:43:24.233 12057-12057/com.paho.mqtt W/System.err: Caused by: java.lang.IllegalArgumentException: Invalid UTF-8 char: [a]
2020-09-29 20:43:24.233 12057-12057/com.paho.mqtt W/System.err:     at org.eclipse.paho.client.mqttv3.internal.wire.MqttWireMessage.validateUTF8String(MqttWireMessage.java:407)
2020-09-29 20:43:24.233 12057-12057/com.paho.mqtt W/System.err:     at org.eclipse.paho.client.mqttv3.internal.wire.MqttWireMessage.encodeUTF8(MqttWireMessage.java:327)
2020-09-29 20:43:24.233 12057-12057/com.paho.mqtt W/System.err:     at org.eclipse.paho.client.mqttv3.internal.wire.MqttConnect.getPayload(MqttConnect.java:154)
2020-09-29 20:43:24.233 12057-12057/com.paho.mqtt W/System.err:     at org.eclipse.paho.client.mqttv3.internal.wire.MqttWireMessage.getHeader(MqttWireMessage.java:142)
2020-09-29 20:43:24.233 12057-12057/com.paho.mqtt W/System.err:     at org.eclipse.paho.client.mqttv3.internal.wire.MqttOutputStream.write(MqttOutputStream.java:74)
2020-09-29 20:43:24.233 12057-12057/com.paho.mqtt W/System.err:     at org.eclipse.paho.client.mqttv3.internal.CommsSender.run(CommsSender.java:147)
2020-09-29 20:43:24.234 12057-12057/com.paho.mqtt W/System.err: 	... 1 more

But I didn't get this issue in org.eclipse.paho.client.mqttv3-1.2.0.jar

Any help to resolve this?

Thanks in advance

@mspoehr
Copy link

mspoehr commented Sep 30, 2020

I am getting this same error. Worked in version 1.1.0 (haven't tried 1.2.0).

@kavidriod
Copy link
Author

Did you find solution for these?

I have tried in both org.eclipse.paho.client.mqttv3-1.2.5.jar and org.eclipse.paho.client.mqttv3-1.2.2.jar,Same issue is there from both of the jar files

@mspoehr
Copy link

mspoehr commented Oct 6, 2020

Nope, just downgraded to 1.2.0.

@kavidriod
Copy link
Author

kavidriod commented Oct 7, 2020

Okay. I'm trying to upgrade paho client for fixing EOFException after referring to this link
#207 (comment)

But Now I feel I don't have any option to resolve my EOF exception. Any comments here ?

@kavidriod
Copy link
Author

I found reason for this exception. Actually I'm sending "X.509 open ssl certificate" as a password for Subscription. Which is having space character in the certificate. Since space is ISO character ,It is saying as "illegal Argument" from paho client 1.2.1 onwards.

From paho client 1.2.1 onwards,validateUTF8String() method is added in MqttWireMessage class.

In validateUTF8String() method if space is sent , Line number 400 -> Character.isISOControl(c) -> returns true
So whole condition itself failed.

In Below image, Left is MqttWireMessage Source of paho client 1.2.0 and right side is paho client version of 1.2.1

image

Can anyone help me to solve this issue?

@silh
Copy link
Contributor

silh commented Oct 29, 2020

Should de fixed in 818, there is a PR there but no reviews.

@kavidriod
Copy link
Author

kavidriod commented Oct 30, 2020

@silh ,Thanks for the Info. Any Idea whom to contact for the fix?

@edhn3000
Copy link

I got the same error:
java.lang.IllegalArgumentException: Invalid UTF-8 char: [d869]
mqttv3 version 1.2.4
it make mqtt client disconnect and reconnect every times, will it be fix?

@micw
Copy link

micw commented Aug 22, 2022

@rdasgupt I have seen that you are currently one of the most active members in this project. May I point you attention to this issue? It is a blocker for many users who use encryption that was introduced with 1.2.1 and which is open since then. There's even an open PR for it.

Thank you a lot,
Michael.

@rdasgupt
Copy link
Contributor

@micw Could you point me to the open PR you have referred to in your last message?

@micw
Copy link

micw commented Nov 8, 2023

@rdasgupt I did not find it, maybe it was the PR for MQTTv5 I was looking at at this time. The Issue has been fixed for MQTTv5 (as stated in the initial report) but is still open for MQTTv3.
Here is the commit that fixes it for MQTTv5: 03186cb

The PR did not contain any tests, so I cannot tell if that really fixes this issue :-(

@micw
Copy link

micw commented Nov 8, 2023

I think the PR https://github.com/eclipse/paho.mqtt.java/pull/819/files solves the issue (and also adds tests). Problem is that the last release is >3 years old and does not contain the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants