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
Socket error on client, disconnecting. 1.4.8 on OSX. #7
Comments
I am, unfortunately, experiencing this same problem. I've installed Mosquitto on my Mac using Home-brew (version 1.4.8). Any update on the fix? Thanks. |
same problem here. 1.4.8 installed from home-brew |
I apologise, this fell through the cracks for 1.4.9. I've pushed a fix that will be in the next release. |
I got a same problem version 1.4.9 on OS X. LEE-SOHAENGui-MacBook-Pro:~ sohaenglee$ /usr/local/sbin/mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf 1470667782: Socket error on client mosqpub/16520-LEE-SOHAE, disconnecting.sub : mosquitto_sub -h 127.0.0.1 -t topic/state |
This is fixed in the |
very thanks ralight~ |
I am running 1.4.11 and I am still experiencing this problem. # Program that listens for SET messages and replies with a status messages indicated that the action was successful.
SET_TOPIC = '/test_switch/set'
STATUS_TOPIC = '/test_switch'
import paho.mqtt.publish as mqtt
import paho.mqtt.client as mqtt_client
# The callback for when the client receives a CONNACK response from the server.
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc))
# Subscribing in on_connect() means that if we lose the connection and
# reconnect then subscriptions will be renewed.
client.subscribe("$SYS/#")
# The callback for when a PUBLISH message is received from the server.
def on_message(client, userdata, msg):
# print(msg.topic)
if SET_TOPIC == msg.topic:
print(msg.topic + " " + str(msg.payload))
mqtt.single(STATUS_TOPIC, "ON")
client = mqtt_client.Client()
client.on_connect = on_connect
client.on_message = on_message
client.username_pw_set('hassbian', '3435')
client.connect("192.168.178.58", 1883)
client.subscribe(SET_TOPIC, 1)
# Blocking call that processes network traffic, dispatches callbacks and
# handles reconnecting.
# Other loop*() functions are available that give a threaded interface and a
# manual interface.
client.loop_forever() |
after last system update my mosquitto also stopped working via WebSocket
now working mqtt protocol only |
@flexiti Could you please open a separate issue? This one is not about websockets nor ubuntu. |
@danobot The original issue is "running the broker on a mac, any client will have problems connecting". If you're saying it is only the python client that has problems it doesn't sound quite the same. The Python code does look ok though. |
@ralight |
I'm experiencing the same issue intermittently. To reproduce I ran a broker: I started a subscriber: I published several times:
The first 5 publishes were fine. They looked like this on the broker:
The last publish looked like this (note the socket error):
|
I have same problem , I've installed last version of mosquitto on my raspberry pi Jessi , I have no problem to pub/sub either through terminal in raspberry pi or MQTT.fx 1.3.1 on my windows but when I use following paho mqtt client js it throw disconnected error , I might add I disable
html page <html xmlns="http:https://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="mqttws31.js"></script>
<script type="text/javascript">
var client;
var form = document.getElementById("tutorial");
var host =location.hostname;
function doConnect() {
client = new Paho.MQTT.Client(host, 1883, "ClientId");
client.onConnect = onConnect;
client.onMessageArrived = onMessageArrived;
client.onConnectionLost = onConnectionLost;
client.connect({onSuccess:onConnect});
}
function doSubscribe() {
client.subscribe("/World");
}
function doSend() {
message = new Paho.MQTT.Message("Hello");
message.destinationName = "/World";
client.send(message);
}
function doDisconnect() {
client.disconnect();
}
// Web Messaging API callbacks
function onConnect() {
var form = document.getElementById("example");
form.connected.checked= true;
}
function onConnectionLost(responseObject) {
var form = document.getElementById("example");
form.connected.checked= false;
if (responseObject.errorCode !== 0)
alert(client.clientId+"\n"+responseObject.errorCode);
}
function onMessageArrived(message) {
var form = document.getElementById("example");
form.receiveMsg.value = message.payloadString;
}
</script>
</head>
<body>
<h1>Example Web Messaging web page.</h1>
<form id="example">
<fieldset>
<legend id="Connect" > Connect </legend>
Make a connection to the server, and set up a call back used if a
message arrives for this client.
<br>
<input type="button" value="Connect" onClick="doConnect(this.form)" name="Connect"/>
<input type="checkbox" name="connected" disabled="disabled"/>
</fieldset>
<fieldset>
<legend id="Subscribe" > Subscribe </legend>
Make a subscription to topic "/World".
<br> <input type="button" value="Subscribe" onClick="doSubscribe(this.form)"/>
</fieldset>
<fieldset>
<legend id="Send" > Send </legend>
Create a Message object containing the word "Hello" and then publish it at
the server.
<br>
<input type="button" value="Send" onClick="doSend(this.form)"/>
</fieldset>
<fieldset>
<legend id="Receive" > Receive </legend>
A copy of the published Message is received in the callback we created earlier.
<textarea name="receiveMsg" rows="1" cols="40" disabled="disabled"></textarea>
</fieldset>
<fieldset>
<legend id="Disconnect" > Disconnect </legend>
Now disconnect this client from the server.
<br> <input type="button" value="Disconnect" onClick="doDisconnect()"/>
</fieldset>
</form>
<!-- /body>
</html> |
I seem to be getting this "Socket error on client" issue on version 1.4.8-1build1. Will attempt to update further but would appreciate some sort of pointer in the right direction if anyone has any ideas. |
@samuel235 I've already use last 1.4.11 version |
i have faced the same issue ,doesn't occure with qos set to 0 ,Only happens when qos is 2 |
how to connect clients (publisher & subscriber ) on mqtt mosquitto |
debug level is extracted from jeedom Added Qos parameters for daemons (not working on docker due to a bug (clients disconnection: might be related to eclipse/mosquitto#7)
This problem is still present in 1.5.3, 23113bb does not fix it for unencrypted connections. Reproduced in the same way as described in the original post. When a client sends a PUBLISH, then a DISCONNECT, then closes the connection in quick enough succession that the three events arrive in the same poll notification on the server, the server will process the PUBLISH, then notice the disconnection and treat it as an abnormal one, and ignore the DISCONNECT. That appears to be because (near the end of loop.c) |
A simple fix seems to be diff --git a/src/loop.c b/src/loop.c
index 9714720..44c37c5 100644
--- a/src/loop.c
+++ b/src/loop.c
@@ -812,6 +812,7 @@ static void loop_handle_reads_writes(struct mosquitto_db *db, struct pollfd *pol
}
}while(SSL_DATA_PENDING(context));
}
+ else
#ifdef WITH_EPOLL
if(events & (EPOLLERR | EPOLLHUP)){
#else but I have not checked if it is correct in all cases. |
That looks like a good way of addressing the problem, thanks for the suggestion. |
migrated from Bugzilla #488633
status ASSIGNED severity normal in component Mosquitto for 1.4
Reported in version 1.4 on platform PC
Assigned to: Roger Light
On 2016-02-27 19:02:59 -0500, James Lewis wrote:
On 2016-03-07 17:28:25 -0500, Roger Light wrote:
The text was updated successfully, but these errors were encountered: