running mosquitto 1.4 with ACL enabled, gets “Socket error on client <unknown>, disconnecting”

Asked by leo

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.

Question information

Language:
English Edit question
Status:
Solved
For:
mosquitto Edit question
Assignee:
No assignee Edit question
Solved by:
Roger Light
Solved:
Last query:
Last reply:
Revision history for this message
leo (chleoxu99) said :
#1

debug further:
when i comment out “allow_anonymous false” in the config file, the result turns to be:

1429879177: mosquitto version 1.4 (build date 2015-04-20 22:04:51+0800) starting
1429879177: Config loaded from /etc/mosquitto/mosquitto.conf.
1429879177: Opening ipv4 listen socket on port 8883.
1429879177: Opening ipv6 listen socket on port 8883.
1429879177: Warning: Address family not supported by protocol
1429879177: Opening websockets listen socket on port 9001.
Enter PEM pass phrase:
1429879180: Opening ipv4 listen socket on port 1883.
1429879180: Opening ipv6 listen socket on port 1883.
1429879180: Warning: Address family not supported by protocol
1429879181: New connection from 127.0.0.1 on port 1883.
1429879181: New client connected from 127.0.0.1 as paho/75CA8C7DEF44E69793 (c1, k60).
1429879181: Sending CONNACK to paho/75CA8C7DEF44E69793 (0, 0)
1429879241: Received PINGREQ from paho/75CA8C7DEF44E69793
1429879241: Sending PINGRESP to paho/75CA8C7DEF44E69793

any hints of that?

Revision history for this message
Roger Light (roger.light) said :
#2

> 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.

Revision history for this message
leo (chleoxu99) said :
#3

thanks for your reply, Roger.
yes, once using allow_anonymous = true, i see the "socket error on client <unknown>" is actually PINGREQ / PINGRESP with "paho/75CA8C7DEF44E69793".
but i don't understand where comes this client? i didn't run any mqtt clients, the only command i ran was "sudo mosquitto -v -c ..."

how to set this "client" to send the username and pwd in password_file and acl_file?

thanks again

Revision history for this message
Best Roger Light (roger.light) said :
#4

I think you've got a client running on your system. Have you been doing any work with the Paho Python client?

Revision history for this message
leo (chleoxu99) said :
#5

i am sure i ran the broker only, i didn't run other python client.
at the moment when i saw this "error", it popped up per 1 or 2 sec, yesterday i noticed it turned to be every 3 or 5 mins, then in the evening it suddenly disappeared. i don't know i should be happy or not...

Revision history for this message
leo (chleoxu99) said :
#6

Thanks Roger Light, that solved my question.