Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upCrash of mosquitto broker on Windows when client disconnects from websocket connection #1137
Comments
ralight
added this to the 1.5.6 milestone
Feb 2, 2019
This comment has been minimized.
This comment has been minimized.
Thanks, that's fixed in my local branch and will be pushed as part of 1.5.6 shortly. |
ralight
closed this
Feb 2, 2019
added a commit
that referenced
this issue
Feb 8, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
krismattheus commentedFeb 1, 2019
There is a bug in the callback_mqtt function in websockets.c, that causes a crash of the mosquitto broker on Windows when a client closes its websocket connection.
mosquitto/src/websockets.c
Line 249 in 19fbbd8
if((int)mosq->sock > 0){
or
if(mosq->sock != INVALID_SOCKET){
A socket on Windows is an unsigned int, so this test succeeds even when the value is INVALID_SOCKET.
This invalid test causes the HASH_DELETE to be called again when the socket is already closed. This causes the crash. After changing the code the crash no longer happens.
Some extra info:
We use mosquitto version 1.5.5 and libwebsockets 3.0.1