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
mosquitto seg. fault during client connection (websockets / TLS) #406
Comments
Could you confirm which exact versions of mosquitto, openssl and libwebsockets you are using please? |
mosquitto 1.4.11 libwebsocket 2.2.0 compiled
LWS_WITH_STATIC = ON
openssl version |
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://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> |
mehrdad <notifications@github.com> wrote:
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
`mod_websocket_mosquitto` module on Apache server to prevent
other websocket port conflict, however problem not resolved
error
```
1491637310: New connection from 192.168.1.101 on port 1883.
1491637310: Socket error on client <unknown>, disconnecting.
```
html page
```html
<html xmlns="http://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");
here's your problem. 1883 is the mqtt port. you need a websockets
port that understands mqtt inside websockets. Do you have a
websockets listener configured?
|
I configure this /etc/mosquitto/conf.d/mosquitto.conf file to enable websocket on 9001 as well , and just follow couple of example across of internet , but I'm not sure where other place should configure websockets listener? are you saying I should open websocket port in my page ? |
I am also having the same issue with the following installations. Server: Extract from journalctl: Please help |
mosquitto ungracefully exits SIGSEGV on websockets TLS connection, seems to work OK with websockets without TLS. Crash appears to be during TLS handshake. I have never been able to successfully connect and run with TLS websockets though using the same certificates and Python (paho) client code, with only the port/transport change from the TCP MQTT connection. I can't say that it crashes mosquitto every time, but the inability to connect seems to be consistent. FreeBSD 11.1-RELEASE-p6
(all other ports have their options unchanged from FreeBSD defaults) DNS does not supply an IPv6 address for the mosquitto host and Edit: Disabling HTTP2 in
|
I'm fairly certain that the issue here is something to do with libwebsockets. Version 2.4.0 is the first version I'm happy to recommend, and this is before that and now well out of date, so I'm going to close this issue. If it's still a problem with more recent versions of lws, please reopen. |
Hi All,
I got the following seg. fault when a client is trying to connect to the broker using the TLS over websockets:
root@peamicms-vm:/tmp# gdb mosquitto
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Reading symbols from /usr/local/sbin/mosquitto...(no debugging symbols found)...done.
(gdb) r -c /etc/mosquitto/mosquitto.conf
Starting program: /usr/local/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/i686/cmov/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0xb7d6508f in lws_ssl_server_name_cb () from /usr/local/lib/libwebsockets.so.10
(gdb) bt
#0 0xb7d6508f in lws_ssl_server_name_cb () from /usr/local/lib/libwebsockets.so.10
#1 0xb7f67b97 in ?? () from /usr/lib/i386-linux-gnu/i686/cmov/libssl.so.1.0.0
#2 0xb7f4f744 in ?? () from /usr/lib/i386-linux-gnu/i686/cmov/libssl.so.1.0.0
#3 0xb7f545b1 in ?? () from /usr/lib/i386-linux-gnu/i686/cmov/libssl.so.1.0.0
#4 0xb7f7b5ea in SSL_accept () from /usr/lib/i386-linux-gnu/i686/cmov/libssl.so.1.0.0
#5 0xb7f6399e in ?? () from /usr/lib/i386-linux-gnu/i686/cmov/libssl.so.1.0.0
#6 0xb7f642e2 in ?? () from /usr/lib/i386-linux-gnu/i686/cmov/libssl.so.1.0.0
#7 0xb7f7b5ea in SSL_accept () from /usr/lib/i386-linux-gnu/i686/cmov/libssl.so.1.0.0
#8 0xb7d64bfe in lws_server_socket_service_ssl () from /usr/local/lib/libwebsockets.so.10
#9 0xb7d692f1 in lws_adopt_descriptor_vhost () from /usr/local/lib/libwebsockets.so.10
#10 0xb7d693cb in lws_adopt_socket_vhost () from /usr/local/lib/libwebsockets.so.10
#11 0xb7d6966a in lws_server_socket_service () from /usr/local/lib/libwebsockets.so.10
#12 0xb7d5a0c0 in lws_service_fd_tsi () from /usr/local/lib/libwebsockets.so.10
#13 0xb7d67386 in _lws_plat_service_tsi () from /usr/local/lib/libwebsockets.so.10
#14 0xb7d675cb in lws_plat_service () from /usr/local/lib/libwebsockets.so.10
#15 0xb7d5a653 in lws_service () from /usr/local/lib/libwebsockets.so.10
#16 0x0805553b in ?? ()
#17 0x0804bd9c in ?? ()
#18 0xb7bfee46 in __libc_start_main () from /lib/i386-linux-gnu/i686/cmov/libc.so.6
#19 0x0804bfd9 in ?? ()
Mosquitto compiled with the following libraries:
root@peamicms-vm:/tmp# ldd /usr/local/sbin/mosquitto
linux-gate.so.1 => (0xb76fd000)
libdl.so.2 => /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0xb76ed000)
libm.so.6 => /lib/i386-linux-gnu/i686/cmov/libm.so.6 (0xb76c7000)
librt.so.1 => /lib/i386-linux-gnu/i686/cmov/librt.so.1 (0xb76bd000)
libanl.so.1 => /lib/i386-linux-gnu/i686/cmov/libanl.so.1 (0xb76b9000)
libssl.so.1.0.0 => /usr/lib/i386-linux-gnu/i686/cmov/libssl.so.1.0.0 (0xb765e000)
libcrypto.so.1.0.0 => /usr/lib/i386-linux-gnu/i686/cmov/libcrypto.so.1.0.0 (0xb749c000)
libuuid.so.1 => /lib/i386-linux-gnu/libuuid.so.1 (0xb7496000)
libwebsockets.so.10 => /usr/local/lib/libwebsockets.so.10 (0xb746c000)
libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xb7304000)
/lib/ld-linux.so.2 (0xb76fe000)
libpthread.so.0 => /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 (0xb72eb000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb72d2000)
on a debian 7.11
Thanks in advance,
Gianluca
The text was updated successfully, but these errors were encountered: