I have been troubleshooting a bug preventing mosquitto from booting because it attempts to listen twice to the same port. I finally tracked it down to the socket_domain option.
Here is the simplest reproducible example which fails to start.
cat /etc/mosquitto/test.conf
listener 1885 localhost
socket_domain ipv4
mosquitto -c /etc/mosquitto/test.conf -v
1719099713: mosquitto version 2.0.18 starting
1719099713: Config loaded from /etc/mosquitto/test.conf.
1719099713: Opening ipv4 listen socket on port 1885.
1719099713: Opening ipv4 listen socket on port 1885.
1719099713: Error: Address already in use
And no, I definitely do NOT have another instance running. I can reproduce the issue on any random port.
1719100410: mosquitto version 2.0.18 starting
1719100410: Config loaded from /etc/mosquitto/test.conf.
1719100410: Opening ipv4 listen socket on port 12345.
1719100410: Opening ipv4 listen socket on port 12345.
1719100410: Error: Address already in use
If I remove the "socket_domain" option, I get the expected behaviour:
mosquitto -c /etc/mosquitto/test.conf -v
1719100163: mosquitto version 2.0.18 starting
1719100163: Config loaded from /etc/mosquitto/test.conf.
1719100163: Opening ipv6 listen socket on port 1885.
1719100163: Opening ipv4 listen socket on port 1885.
1719100163: mosquitto version 2.0.18 running
I have been troubleshooting a bug preventing mosquitto from booting because it attempts to listen twice to the same port. I finally tracked it down to the socket_domain option.
Here is the simplest reproducible example which fails to start.
cat /etc/mosquitto/test.conf
mosquitto -c /etc/mosquitto/test.conf -v
And no, I definitely do NOT have another instance running. I can reproduce the issue on any random port.
If I remove the "socket_domain" option, I get the expected behaviour: