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

Mosquitto >= 2.0.12 results in "Connection failed, ClientIdentifierNotValid", Mosquitto 2.0.11 works fine. #2383

Closed
renkei opened this issue Nov 13, 2021 · 1 comment

Comments

@renkei
Copy link

renkei commented Nov 13, 2021

  1. With npm package MQTT.js there are no issues with any version of Mosquitto
  2. With Nuget package MQTTnet I cannot create a client connection to my broker anymore after I upgraded Mosquitto from 2.0.11 to 2.0.12, the same is true for 2.0.13.

My configuration of the broker is very simple, I've modified only two options in the configuration file

listener 1883
allow_anonymous true

Works fine for months. I've tested the Mosquitto broker 2.0.13 on serveral machines (Raspberry Pi2 ARMv7 32bit, Raspberry Pi 4 ARMv8 64bit, Windows 64bit with 32bit and 64bit binaries of the broker). The result is always the same, while everything works as expected with MQTT.js I get the following exception with MQTTnet:

MQTTnet.Adapter.MqttConnectingFailedException: Connecting with MQTT server failed (ClientIdentifierNotValid).
    at MQTTnet.Client.MqttClient.AuthenticateAsync(IMqttChannelAdapter channelAdapter, MqttApplicationMessage willApplicationMessage, CancellationToken cancellationToken)
    at MQTTnet.Client.MqttClient.ConnectAsync(IMqttClientOptions options, CancellationToken cancellationToken)
    at MQTTnet.Client.MqttClient.ConnectAsync(IMqttClientOptions options, CancellationToken cancellationToken)`

The client ID is not set by me but by MQTTnet internally (MqttClientOptions.cs, Line16) with

Guid.NewGuid().ToString("N");

Even if I set the ClientID manually it doesn't help. The only thing that works for me is to downgrade Mosquitto to version 2.0.11 again. This is easy on Windows but a problem on my rolling release Linux distribution Arch Linux.

Because I'm unsure if this is a bug in Mosquitto or MQTTnet I've opened an issue there as well: #1290

@renkei
Copy link
Author

renkei commented Nov 13, 2021

I've found #2309. Setting KeepAlive to another value than TimeSpan.Zero fixes the connection problem.

@renkei renkei closed this as completed Feb 14, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant