mosquitto 1.4 - once running with ACL enabled, gets "Socket error on client <unknown>, disconnecting"

LeoXu picture LeoXu · Apr 24, 2015 · Viewed 14.7k times · Source

following instructions from Jeremy Gooch, see http://goochgooch.co.uk/2014/08/01/building-mosquitto-1-4/, i installed mosquitto over websockets on RPi. i can sub/pub messages to test site http://test.mosquitto.org/ws.html

from that point, i enabled user and topic access control in mosquitto.conf for more tests, but the strange point is that when i start mosquitto again, i see socket errors per second...

sudo /usr/local/sbin/mosquitto -v -c /etc/mosquitto/mosquitto.conf

 1429857948: mosquitto version 1.4 (build date 2015-04-20 22:04:51+0800) starting
1429857948: Config loaded from /etc/mosquitto/mosquitto.conf.
1429857948: Opening ipv4 listen socket on port 1883.
1429857948: Opening ipv6 listen socket on port 1883.
1429857948: Warning: Address family not supported by protocol
1429857949: New connection from 127.0.0.1 on port 1883.
1429857949: Sending CONNACK to 127.0.0.1 (0, 5)
1429857949: Socket error on client <unknown>, disconnecting.
1429857950: New connection from 127.0.0.1 on port 1883.
1429857950: Sending CONNACK to 127.0.0.1 (0, 5)
...

i modify the config file to enable ACL only, comment out all others, the socket errors are still there. config file looks now:

sudo nano /etc/mosquitto/mosquitto.conf

autosave_interval 1800
persistence true
persistence_file m2.db
persistence_location /var/tmp/
connection_messages true
log_timestamp true
log_dest stderr
log_type error
log_type warning
log_type debug

allow_anonymous false
password_file /etc/mosquitto/mqtt.pw
acl_file /etc/mosquitto/mqtt.acl

port 1883
protocol mqtt

i even test to use the sample password_file and acl_file, but same error. searched on google, also no result, could anyone help on this? thanks.

Answer

ralight picture ralight · Apr 24, 2015

1429857949: Sending CONNACK to 127.0.0.1 (0, 5)

CONNACK return code of 5 means the connection was not authorised. If it works with allow_anonymous=true, then it sounds like your client isn't sending a username / or isn't sending a correct username&password.

It looks like you have a Paho Python client running.