websockets on Freebsd 13.1 connects then immediately disconnects
Mosquitto built from ports after tweaks to the libwebsockets port (added LWS_WITH_EXTERNAL_POLL LWS_CALLBACK_ADD_POLL_FD) to Makefile. Both ports build without errors. Issue confirmed with several clients. Once the client connects it immediately disconnects. It appears to happen in websockets.c in the callback_mqtt() function case statement for LWS_CALLBACK_CLOSED. I added a log_printf statement make this assumption. Here is the log file output:
1676606750: New client connected from 10.0.0.193:53052 as mqttjs_a375c484 (p2, c1, k60). 1676606750: Client gonna be disconnected because 'LWS_CALLBACK_CLOSED'. 1676606750: Client mqttjs_a375c484 closed its connection.
mosquitto works perfectly with MQTT protocol. I suspect this is caused by the libwebsockets port (which has no maintainer).
Any help/suggestion to diagnose the root cause is welcome.
Would you care to try out the develop branch? That removes the need for libwebsockets, which simplifies things greatly and improves websockets performance as well. It would be good to have some feedback on it from the freebsd perspective.
Roger, I'll give it a try this week.
On Sat, 1 Apr 2023, 5:41 am Roger Light, @.***> wrote:
Would you care to try out the develop branch? That removes the need for libwebsockets, which simplifies things greatly and improves websockets performance as well. It would be good to have some feedback on it from the freebsd perspective.
— Reply to this email directly, view it on GitHub https://github.com/eclipse/mosquitto/issues/2755#issuecomment-1492894659, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOOIJVMTMPOI2NZZ63VEDW3W67Z45ANCNFSM6AAAAAAU67JPWY . You are receiving this because you authored the thread.Message ID: @.***>
Would you care to try out the
developbranch? That removes the need for libwebsockets, which simplifies things greatly and improves websockets performance as well. It would be good to have some feedback on it from the freebsd perspective.
develop branch doesn't compile on the latest FreeBSD-13.2 :
[ 4%] Building C object lib/CMakeFiles/libmosquitto.dir/options.c.o
/usr/local/src/mosquitto/mosquitto/lib/options.c:353:8: error: use of undeclared identifier 'MOSQ_OPT_HTTP_PATH'
case MOSQ_OPT_HTTP_PATH:
^
/usr/local/src/mosquitto/mosquitto/lib/options.c:439:8: error: use of undeclared identifier 'MOSQ_OPT_DISABLE_SOCKETPAIR'
case MOSQ_OPT_DISABLE_SOCKETPAIR:
^
/usr/local/src/mosquitto/mosquitto/lib/options.c:513:8: error: use of undeclared identifier 'MOSQ_OPT_TRANSPORT'
case MOSQ_OPT_TRANSPORT:
^
/usr/local/src/mosquitto/mosquitto/lib/options.c:525:8: error: use of undeclared identifier 'MOSQ_OPT_HTTP_HEADER_SIZE'
case MOSQ_OPT_HTTP_HEADER_SIZE:
^
4 errors generated.
*** Error code 1
Stop.
env:
# cmake .. -DDOCUMENTATION=no
-- The C compiler identification is Clang 14.0.5
-- The CXX compiler identification is Clang 14.0.5
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenSSL: /usr/lib/libcrypto.so (found version "1.1.1t")
-- Found SQLite3: /usr/local/include (found version "3.41.2")
-- WITH_DLT = OFF
-- Found cJSON: /usr/local/include
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Looking for include file sys/event.h
-- Looking for include file sys/event.h - found
-- Looking for getaddrinfo_a in anl
-- Looking for getaddrinfo_a in anl - not found
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "1.8.1")
-- Found CUnit: /usr/local/lib/libcunit.so
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/src/mosquitto/mosquitto/build
Roger,
Finally back with time to work on this. Where can I download the development branch. Specifically for FreeBSD since the websockets library doesn't work on FreeBSD.
Rod
On Sat, Apr 1, 2023 at 8:38 AM Rod Morgan @.***> wrote:
Roger, I'll give it a try this week.
On Sat, 1 Apr 2023, 5:41 am Roger Light, @.***> wrote:
Would you care to try out the develop branch? That removes the need for libwebsockets, which simplifies things greatly and improves websockets performance as well. It would be good to have some feedback on it from the freebsd perspective.
— Reply to this email directly, view it on GitHub https://github.com/eclipse/mosquitto/issues/2755#issuecomment-1492894659, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOOIJVMTMPOI2NZZ63VEDW3W67Z45ANCNFSM6AAAAAAU67JPWY . You are receiving this because you authored the thread.Message ID: @.***>
@rodneygmorgan https://github.com/eclipse/mosquitto/tree/develop is what you're looking for
Seems like it's fixed in dev branch https://forums.freebsd.org/threads/mosquitto-and-websockets-disconnect-after-initial-packets.89633/#post-634112