eclipse / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
8.62k stars 2.33k forks source link

Specifying max_qos before a listener instantiates the implicit listener, result in two listeners on the same port #2991

Open jr1221 opened 5 months ago

jr1221 commented 5 months ago

When max_qos is specified before listener 1883: Conf:

max_qos 1
listener 1883

Result:

1706999194: mosquitto version 2.0.18 starting
1706999194: Config loaded from ./test.conf.
1706999194: Loading plugin: /usr/lib/mosquitto/mosquitto_message_timestamp.so
1706999194: Opening ipv4 listen socket on port 1883.
1706999194: Opening ipv4 listen socket on port 1883.
1706999194: Error: Address already in use

When max_qos is specified after listener 1883 (not the default in the conf file): Conf:

listener 1883
max_qos 1

Result (intended):

1706999106: mosquitto version 2.0.18 starting
1706999106: Config loaded from ./test.conf.
1706999106: Loading plugin: /usr/lib/mosquitto/mosquitto_message_timestamp.so
1706999106: Opening ipv4 listen socket on port 1883.
1706999106: mosquitto version 2.0.18 running

Mosquitto version 2.0.18 built from source via buildroot, for aarch64. I assume this is a bug but I wanted to be sure, it is annoying because you have to move max_qos to below the listener block if you start with the default conf, but not really a problem. If anyone needs anything to debug this lmk.

jr1221 commented 5 months ago

2497 looks like this, and I feel like this is a bug because the per_listener setting is false.

MattBrittan commented 4 months ago

It appears this might be caused by any per_listener config line placed before a listener; as per this stack overflow question where the issue was password_file. The current behaviour is confusing, and not as per the documentation, so I also feel that it's a bug. Duplicated with 2.0.11 and 2.0.18.