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

Keep alive 0 results in 'identifier rejected' #2309

Closed
Daedaluz opened this issue Sep 10, 2021 · 5 comments
Closed

Keep alive 0 results in 'identifier rejected' #2309

Daedaluz opened this issue Sep 10, 2021 · 5 comments

Comments

@Daedaluz
Copy link
Contributor

Daedaluz commented Sep 10, 2021

I just did an upgrade from 2.0.11 to 2.0.12 and noticed that some of my clients started to get "identifier rejected".
After some tracing i managed to narrow it down to this check.

if(db.config->max_keepalive &&
(context->keepalive > db.config->max_keepalive || context->keepalive == 0)){

And only for v3 clients it looks like.

Apparently some of my clients have the maximum keep alive interval, so the check fails and throws them out.

I'm wondering if the check technically shouldn't be a >= ?

Of course. I'll just reconfigure my clients to use a lower keep alive since i can't put a higher max keep alive in config.
It's an edge case since it's probably better to use a lower keep alive anyway, but felt it was a good idea to point it out.

Edit:
Sorry, was thinking too fast.
Found other clients with keep alive interval 0 which results in 'identifier rejected'.

Looks like the spec has something to say about this:

A Keep Alive value of zero (0) has the effect of turning off the keep alive mechanism. This means that, in this case, the Server is not required to disconnect the Client on the grounds of inactivity.
Note that a Server is permitted to disconnect a Client that it determines to be inactive or non-responsive at any time, regardless of the Keep Alive value provided by that Client.

With further digging i found #2117.

@Daedaluz Daedaluz changed the title Keep alive 65535 results in 'identifier rejected' Keep alive 0 results in 'identifier rejected' Sep 10, 2021
@rukechen
Copy link

I face the same issue while integrating with Telegraf mqtt output plugin.
If mosquitto version is changed to 1.5.11, everything is working well. If mosquitto version is changed to 2.0.12, I will get error code 'identifier rejected'. According to the https://github.com/influxdata/telegraf/blob/v1.19.3/plugins/outputs/mqtt/mqtt.go, KeepAlive is set to zero.

image

@ralight
Copy link
Contributor

ralight commented Sep 22, 2021

This is a duplicate of #2117 which is now fixed in the fixes branch. I'm going to leave it open until the next release so others can find it more easily.

@Daedaluz
Copy link
Contributor Author

I'm not so sure about that.
Looks like the bug is still present in fixes branch. (unless you haven't pushed yet of course)

I think that the change that was prompted by #2117 introduced another bug for v3 protocol.

If I'm not mistaken, current code will still prevent any v3 client from connecting with 0 keep alive.

@Daedaluz
Copy link
Contributor Author

Daedaluz commented Sep 22, 2021

or is the point here that you should set "max_keepalive" to 0 in the config file to allow clients disabling the functionality?

  • Got it!

@Daedaluz
Copy link
Contributor Author

closing this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants