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
No keepalive (0) still allowed with max_keepalive set #2117
Comments
Agreed, it should apply to keepalive=0 as well. |
I'm not sure if what I'm seeing is related to this, but I'll report my observations anyway. With mosquitto 2.0.11 my C++ clients connect without errors. But with mosquitto 2.0.12 or 2.0.13 I am getting error 2: identifier rejected, and no connection established. Rolling back to 2.0.11 makes it all start working.
Note: I came across this in a |
I'm still working my way through this, trying to figure out where the problem lies. It is not clear to me what should happen when a client tries to connect with keep-alive = 0. Can someone please explain the expected behaviour? Is this a bug with mosquitto or new behaviour that requires all clients to conform? I am using 2.0.13 with mqtt_cpp (commit 29f93bc0c0cb82979840318e49fcce710f07ec88) and if I set the client keep-alive to a non-zero value, I can get a basic connection, but if I set it to zero (which is also the library's default), the connection is rejected with |
For anyone else coming across this: Mosquitto 2.0.12 is broken for connections from clients that specify a keepalive of zero. This may be the case with many third-party clients, although most of the popular ones use a value of 30 or 60 or something similar. For some clients, the default value of 0 will not connect and you'll get an "identifier rejected" response from the broker. This is fixed in 2.0.13, but you'll still get the same response from the broker until you change the mosquitto configuration to allow such clients. In the default
Previous versions have stated "Do not set [max_keepalive] below 10", which may be confusing if you have an older config file and haven't seen the new comment! Therefore, if you want your clients to be able to connect to 2.0.13 with a keepalive of 0, then you will need to set Hopefully this summary will save at least one other person a couple of days of bewilderment. |
It's been a while since I read the spec, but I'm a bit surprised to hear that keepalive 0 leads to connections being rejected. Shouldn't the broker just send the configured max_timeout as server keepalive in CONNACK (and then disconnect the client later if this is not respected)? Or is this a v3 vs. v5 issue? |
@dnadlinger sorry if I was unclear. What I'm saying is that if There are two possible ways around this - either set the client's keepalive to non-zero, or set I'm not sure about v3 vs v5. I'm using a v3.1.1 client. |
Even if max_keepalive is set in the config file, clients are still allowed to connect using
0
(i.e. no keepalive) without a Server Keep Alive being sent in the connect ack.I'm not sure whether this is a bug, but it was certainly unexpected behaviour to me after reading the v5 spec and mosquitto documentation.
The text was updated successfully, but these errors were encountered: