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.02: When max_queued_messages is set to 0 then QOS 0 messages are not received #1956

Closed
nduhme opened this issue Dec 16, 2020 · 2 comments
Milestone

Comments

@nduhme
Copy link

nduhme commented Dec 16, 2020

Hello,

there seems to be a bug when setting "max_queued_messages" is set to "0" in the configuration file.

I have tested running Mosquitto broker 2.02 on Ubuntu 18.04.5 LTS and Windows 10 with the setting "max_queued_messages 0" in the configuration file. When i do this both publisher and subscriber seem to have be at least QOS 1 for messages to be received. As soon as one or both of then are set to QOS 0 no messages are recevied. When i set "max_queued_messages" to any other positive value or remove the setting with a "#" i can again recevie messages of QOS 0.
So while there is an easy workaround is to just use a very high number as max_queued_messages you might want to take a look at that.

@sectokia
Copy link

sectokia commented Dec 17, 2020

So the logic in the code at the moment for QOS0 is:
-If max_queued_messages is zero, then the decision to drop is made based on max_queued_bytes.
-Otherwise, if max_queued_bytes is zero, then the decision to drop is made on max_queued_messages.

This means if you set max_queued_messages to zero, since max_queued_bytes defaults to 0, everything over 0 bytes will be dropped.

Fix is probably to add this:

if((db.config->max_queued_messages == 0) && (db.config->max_queued_bytes == 0)) return true;

before:

		if(db.config->max_queued_messages == 0){
			return valid_bytes;
		}
		if(db.config->max_queued_bytes == 0){
			return valid_count;
		}

in db__ready_for_flight()

In the mean time for 2.0.2 you can get around this by setting max_queued_bytes to something really big.

@ralight
Copy link
Contributor

ralight commented Dec 17, 2020

That's now fixed and will be in 2.0.3 shortly. Thanks for your help.

@ralight ralight added this to the 2.0.3 milestone Dec 17, 2020
fAuernigg pushed a commit to fAuernigg/mosquitto that referenced this issue Jan 4, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2022
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

3 participants