Giter Site home page Giter Site logo

nanonng's People

Contributors

alvin1221 avatar alvinwong2018 avatar casaroli avatar codypiersall avatar dehorsley avatar dependabot[bot] avatar gdamore avatar jake-ruyi avatar janjaapbos avatar jaylinyu avatar l0pital avatar liamstask avatar lilywangl avatar lkesteloot avatar neachdainn avatar odywayne avatar paddor avatar phreed avatar phsilva avatar qxsoftware avatar ranmaoyi avatar realsense3d avatar robiwano avatar shikokuchuo avatar tglane avatar unspecd avatar urkle avatar voutilad avatar wanghaemq avatar xinyi-xs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nanonng's Issues

Bridging does not respect result of AIO

Describe the bug
close a bridging connection while applying heavy throughput cause nng_panic

Expected behavior
sock is safely closed

Actual Behavior
panic with appending node

To Reproduce
???

This is a bug only happen with MQTTX

delete code in broker_tcp line 597 to 604, let broker doesnt reply PINGRESP,
start a mqttx client, no matter it is websocket or TCP.
client closed and broker crashed

nanomq: ../nanolib/mqtt_db.c:59: dbtree_ctxt_free: Assertion `ctxt != NULL && ctxt->ref > 0' failed.
Aborted (core dumped)

qos info lost when resending qos msg

Describe the bug
qos info lost when resending qos msg
qos timer is disabled

Expected behavior
broker can resend qos msg correctly

Actual Behavior
msg is lost

MQTT Keepalive backoff time

Describe the bug
client is disclosed too soon

Expected behavior
A clear and concise description of what you expected to happen.

MQTT protocol require broker to disconnect client only when backoff time has passed.

Actual Behavior
no backoff time in nanonng

Compile `iconv` error on MacOS .

Describe the bug
iconv.h not found on MacOS.

Expected behavior
remove iconv dependency from mqtt_parser.c.

Actual Behavior
remove iconv dependency from mqtt_parser.c.

To Reproduce
Build NNG on MacOS.

** Environment Details **

  • NNG version : 1.6.0
  • Operating system and version : 12.2.1 (21D62)
  • Compiler and language used : Ninja, C
  • Shared or static library: Static

Additional context

FAILED: nng/src/sp/protocol/survey0/xrespond_test 
: && /usr/bin/clang -std=c99 -Wall -Wextra -fno-omit-frame-pointer   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names  nng/src/sp/protocol/survey0/CMakeFiles/xrespond_test.dir/xrespond_test.c.o -o nng/src/sp/protocol/survey0/xrespond_test  nng/libnng_testing.a  -lpthread && :
Undefined symbols for architecture x86_64:
  "_iconv", referenced from:
      _convert_to_utf8 in libnng_testing.a(mqtt_parser.c.o)
  "_iconv_close", referenced from:
      _convert_to_utf8 in libnng_testing.a(mqtt_parser.c.o)
  "_iconv_open", referenced from:
      _convert_to_utf8 in libnng_testing.a(mqtt_parser.c.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

NanoMQ

broker does not return connack properly when recevie connect with session expiry interval

MQTT V3.1.1 client qos degration is broken

V 0.8.0 :
MQTT V3.1.1 client qos degration is broken

PUB MQTT V3.1.1 QOS 2 msg to a client sub to QOS 1 and QOS 2, all msg is altered as QOS2.
the qos level stored in mqtt_db is wrong.

ASAN crashed - Caused by nanomq-ci

AddressSanitizer:DEADLYSIGNAL

==1394288==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fc1e650b05d bp 0x7fc1e09f5950 sp 0x7fc1e09f5108 T9)
==1394288==The signal is caused by a READ memory access.
==1394288==Hint: address points to the zero page.
==1394288==WARNING: invalid path to external symbolizer!
==1394288==WARNING: Failed to use and restart external symbolizer!
#0 0x7fc1e650b05d (/lib/x86_64-linux-gnu/libc.so.6+0x19c05d)
#1 0x4476d8 (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x4476d8)
#2 0x61f109 (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x61f109)
#3 0x60ae8c (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x60ae8c)
#4 0x53a0f2 (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x53a0f2)
#5 0x55ca5d (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x55ca5d)
#6 0x559f5b (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x559f5b)
#7 0x5b4485 (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x5b4485)
#8 0x5b5add (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x5b5add)
#9 0x5bed7d (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x5bed7d)
#10 0x7fc1e6403946 (/lib/x86_64-linux-gnu/libc.so.6+0x94946)
#11 0x7fc1e6493a43 (/lib/x86_64-linux-gnu/libc.so.6+0x124a43)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libc.so.6+0x19c05d)
Thread T9 created by T0 here:
#0 0x49a5dc (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x49a5dc)
#1 0x5bebb6 (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x5bebb6)
#2 0x5b5820 (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x5b5820)
#3 0x5b418c (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x5b418c)
#4 0x5b5303 (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x5b5303)
#5 0x59bc1c (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x59bc1c)
#6 0x5bf236 (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x5bf236)
#7 0x59bc02 (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x59bc02)
#8 0x5ef06f (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x5ef06f)
#9 0x5e3858 (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x5e3858)
#10 0x55ddae (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x55ddae)
#11 0x562381 (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x562381)
#12 0x5393b2 (/home/jaylin/projects/EdgeComputing/nanomq/build/nanomq/nanomq+0x5393b2)
#13 0x7fc1e6398fcf (/lib/x86_64-linux-gnu/libc.so.6+0x29fcf)

==1394288==ABORTING

Massive qos1 messages caused heap-use-after-free.

test subscript

#!/bin/bash
for ((i = 0; i < 20000000; i++))
do
	(mosquitto_pub -u abc -q 1 -t abc -p 1884 -m "{\"x\": {\"y\": 10}, \"z\": \"str1\", \"a\": 2222}")
done
 ~/workspace/nanomq/build/   ./nanomq/nanomq broker start 
=============================================================
==3363211==ERROR: AddressSanitizer: heap-use-after-free on address 0x6110005f2c04 at pc 0x562b728fd089 bp 0x7f3922ef6b30 sp 0x7f3922ef6b20
READ of size 1 at 0x6110005f2c04 thread T9
    #0 0x562b728fd088 in nmq_tcptran_pipe_qos_send_cb /home/lee/workspace/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:432
    #1 0x562b72625425 in nni_taskq_thread /home/lee/workspace/nanomq/nng/src/core/taskq.c:50
    #2 0x562b72626716 in nni_thr_wrap /home/lee/workspace/nanomq/nng/src/core/thread.c:94
    #3 0x562b7262f17d in nni_plat_thr_main /home/lee/workspace/nanomq/nng/src/platform/posix/posix_thread.c:266
    #4 0x7f392a5d1b42 in start_thread nptl/pthread_create.c:442
    #5 0x7f392a6639ff  (/lib/x86_64-linux-gnu/libc.so.6+0x1269ff)

0x6110005f2c04 is located 4 bytes inside of 256-byte region [0x6110005f2c00,0x6110005f2d00)
freed by thread T8 here:
    #0 0x7f392a83d517 in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:127
    #1 0x562b7262abcb in nni_free /home/lee/workspace/nanomq/nng/src/platform/posix/posix_alloc.c:33
    #2 0x562b725fb503 in nng_free /home/lee/workspace/nanomq/nng/src/nng.c:77
    #3 0x562b72648ba5 in conn_param_free /home/lee/workspace/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:848
    #4 0x562b725e5839 in server_cb /home/lee/workspace/nanomq/nanomq/apps/broker.c:459
    #5 0x562b72625425 in nni_taskq_thread /home/lee/workspace/nanomq/nng/src/core/taskq.c:50
    #6 0x562b72626716 in nni_thr_wrap /home/lee/workspace/nanomq/nng/src/core/thread.c:94
    #7 0x562b7262f17d in nni_plat_thr_main /home/lee/workspace/nanomq/nng/src/platform/posix/posix_thread.c:266
    #8 0x7f392a5d1b42 in start_thread nptl/pthread_create.c:442

previously allocated by thread T6 here:
    #0 0x7f392a83d867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x562b7262ab71 in nni_alloc /home/lee/workspace/nanomq/nng/src/platform/posix/posix_alloc.c:20
    #2 0x562b725fb49d in nng_alloc /home/lee/workspace/nanomq/nng/src/nng.c:60
    #3 0x562b726487cb in conn_param_alloc /home/lee/workspace/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:817
    #4 0x562b728fc475 in tcptran_pipe_nego_cb /home/lee/workspace/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:343
    #5 0x562b72625425 in nni_taskq_thread /home/lee/workspace/nanomq/nng/src/core/taskq.c:50
    #6 0x562b72626716 in nni_thr_wrap /home/lee/workspace/nanomq/nng/src/core/thread.c:94
    #7 0x562b7262f17d in nni_plat_thr_main /home/lee/workspace/nanomq/nng/src/platform/posix/posix_thread.c:266
    #8 0x7f392a5d1b42 in start_thread nptl/pthread_create.c:442

Thread T9 created by T0 here:
    #0 0x7f392a7e1685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216
    #1 0x562b7262f2ad in nni_plat_thr_init /home/lee/workspace/nanomq/nng/src/platform/posix/posix_thread.c:279
    #2 0x562b726269c2 in nni_thr_init /home/lee/workspace/nanomq/nng/src/core/thread.c:121
    #3 0x562b72625747 in nni_taskq_init /home/lee/workspace/nanomq/nng/src/core/taskq.c:95
    #4 0x562b726263e0 in nni_taskq_sys_init /home/lee/workspace/nanomq/nng/src/core/taskq.c:294
    #5 0x562b72611281 in nni_init_helper /home/lee/workspace/nanomq/nng/src/core/init.c:35
    #6 0x562b7262f652 in nni_plat_init /home/lee/workspace/nanomq/nng/src/platform/posix/posix_thread.c:422
    #7 0x562b72611302 in nni_init /home/lee/workspace/nanomq/nng/src/core/init.c:58
    #8 0x562b7265788b in nni_proto_mqtt_open /home/lee/workspace/nanomq/nng/src/sp/protocol.c:37
    #9 0x562b72653dc9 in nng_nmq_tcp0_open /home/lee/workspace/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1268
    #10 0x562b725e7937 in broker /home/lee/workspace/nanomq/nanomq/apps/broker.c:812
    #11 0x562b725ea639 in broker_start /home/lee/workspace/nanomq/nanomq/apps/broker.c:1304
    #12 0x562b725c7403 in main /home/lee/workspace/nanomq/nanomq/nanomq.c:222
    #13 0x7f392a566d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Thread T8 created by T0 here:
    #0 0x7f392a7e1685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216
    #1 0x562b7262f2ad in nni_plat_thr_init /home/lee/workspace/nanomq/nng/src/platform/posix/posix_thread.c:279
    #2 0x562b726269c2 in nni_thr_init /home/lee/workspace/nanomq/nng/src/core/thread.c:121
    #3 0x562b72625747 in nni_taskq_init /home/lee/workspace/nanomq/nng/src/core/taskq.c:95
    #4 0x562b726263e0 in nni_taskq_sys_init /home/lee/workspace/nanomq/nng/src/core/taskq.c:294
    #5 0x562b72611281 in nni_init_helper /home/lee/workspace/nanomq/nng/src/core/init.c:35
    #6 0x562b7262f652 in nni_plat_init /home/lee/workspace/nanomq/nng/src/platform/posix/posix_thread.c:422
    #7 0x562b72611302 in nni_init /home/lee/workspace/nanomq/nng/src/core/init.c:58
    #8 0x562b7265788b in nni_proto_mqtt_open /home/lee/workspace/nanomq/nng/src/sp/protocol.c:37
    #9 0x562b72653dc9 in nng_nmq_tcp0_open /home/lee/workspace/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1268
    #10 0x562b725e7937 in broker /home/lee/workspace/nanomq/nanomq/apps/broker.c:812
    #11 0x562b725ea639 in broker_start /home/lee/workspace/nanomq/nanomq/apps/broker.c:1304
    #12 0x562b725c7403 in main /home/lee/workspace/nanomq/nanomq/nanomq.c:222
    #13 0x7f392a566d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Thread T6 created by T0 here:
    #0 0x7f392a7e1685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216
    #1 0x562b7262f2ad in nni_plat_thr_init /home/lee/workspace/nanomq/nng/src/platform/posix/posix_thread.c:279
    #2 0x562b726269c2 in nni_thr_init /home/lee/workspace/nanomq/nng/src/core/thread.c:121
    #3 0x562b72625747 in nni_taskq_init /home/lee/workspace/nanomq/nng/src/core/taskq.c:95
    #4 0x562b726263e0 in nni_taskq_sys_init /home/lee/workspace/nanomq/nng/src/core/taskq.c:294
    #5 0x562b72611281 in nni_init_helper /home/lee/workspace/nanomq/nng/src/core/init.c:35
    #6 0x562b7262f652 in nni_plat_init /home/lee/workspace/nanomq/nng/src/platform/posix/posix_thread.c:422
    #7 0x562b72611302 in nni_init /home/lee/workspace/nanomq/nng/src/core/init.c:58
    #8 0x562b7265788b in nni_proto_mqtt_open /home/lee/workspace/nanomq/nng/src/sp/protocol.c:37
    #9 0x562b72653dc9 in nng_nmq_tcp0_open /home/lee/workspace/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1268
    #10 0x562b725e7937 in broker /home/lee/workspace/nanomq/nanomq/apps/broker.c:812
    #11 0x562b725ea639 in broker_start /home/lee/workspace/nanomq/nanomq/apps/broker.c:1304
    #12 0x562b725c7403 in main /home/lee/workspace/nanomq/nanomq/nanomq.c:222
    #13 0x7f392a566d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

SUMMARY: AddressSanitizer: heap-use-after-free /home/lee/workspace/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:432 in nmq_tcptran_pipe_qos_send_cb
Shadow bytes around the buggy address:
  0x0c22800b6530: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c22800b6540: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c22800b6550: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x0c22800b6560: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c22800b6570: fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa fa
=>0x0c22800b6580:[fd]fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c22800b6590: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c22800b65a0: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x0c22800b65b0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c22800b65c0: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
  0x0c22800b65d0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==3363211==ABORTING

Build failed on posix platform with NNI_GCC_VERSION >= 40700 while calling nni_atomic_cas() and nng_atomic_swap()

Describe the bug
Build failed on linux with gcc version = 4.8.5 while calling functions calling nni_atomic_cas() and nng_atomic_swap().

To Reproduce
If possible include actual reproduction test code here.
Minimal C test cases are perferred.

** Environment Details **

  • NanoMQ version : 1.6.0-pre
  • Operating system and version : centos 7.4 & Alibaba Cloud Linux 2
  • Compiler and language used: cmake, Ninja, C , gcc-4.8.5
  • testing scenario

Client SDK
If possible include the mqtt sdk you used to connect to nanomq
Minimal C test cases are perferred.

Additional context
Add any other context about the problem here.

No new connection is accepted when multi persistence session disconnect and reconnect several times.

Run command below:

nanomq broker start
emqtt_bench sub -t abc -p 1883 -c 1000 -C false
emqtt_bench pub -t abc -p 1883 -c 500 -I 100 -L 1000000000

Disconnect and reconnect emqtt_bench sub several times will get this error.

 ~/workspace/nanomq/build/  ./nanomq/nanomq broker start 
^C
Broker exit(0).
==849880==Can't open /proc/849171/task for reading.
==849171==LeakSanitizer has encountered a fatal error.
==849171==HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1
==849171==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)

Memory leaks

Describe the bug
Memory leaks at conn_handler();

Expected behavior
Be fixed.

Actual Behavior
Describe what occurred.

To Reproduce

  • No property
  • No Client id
mqtt pub -t "topic" -m "hello" -q 0 -v -d 

then shutdown nanomq.

** Environment Details **

  • NNG version: latest
  • Operating system and version
  • Compiler and language used
  • Shared or static library

Additional context

Fri Mar 11 22:24:22 2022 tcptran_pipe_recv_cb: remain_len 0 cparam 0x61100000ff40 clientid nanomq-ce5e90ee username (null) proto 5

Fri Mar 11 22:24:22 2022 tcptran_pipe_recv_cb: The type of msg is e0
Fri Mar 11 22:24:22 2022 nni_aio_finish_sync: Hunky dory(0)
Fri Mar 11 22:24:22 2022 nano_pipe_recv_cb: ######### nano_pipe_recv_cb ############
Fri Mar 11 22:24:22 2022 nano_pipe_close:  ############## nano_pipe_close ############## 
Fri Mar 11 22:24:22 2022 nni_aio_finish_error: Object closed(7)
Fri Mar 11 22:24:22 2022 nni_aio_finish_sync: Hunky dory(0)
Fri Mar 11 22:24:22 2022 server_cb: RECV  ^^^^ ctx3 ^^^^

Fri Mar 11 22:24:22 2022 decode_pub_message: cmd: 3, retain: 0, qos: 0, dup: 0, remaining length: 112
Fri Mar 11 22:24:22 2022 decode_pub_message: topic: [$SYS/brokers/disconnected], qos: 0
Fri Mar 11 22:24:22 2022 decode_pub_message: used pos: [27]
Fri Mar 11 22:24:22 2022 decode_pub_message: payload: [{"username":"(null)","ts":1054720134,"reason_code":"0","client_id":"nanomq-ce5e90ee"}], len = 85
Fri Mar 11 22:24:22 2022 handle_pub: pipe_info size: [0]
Fri Mar 11 22:24:22 2022 server_cb: ERROR it should not happen
Fri Mar 11 22:24:22 2022 conn_param_free: destroy conn param
Fri Mar 11 22:24:22 2022 nni_aio_finish: Hunky dory(0)
Fri Mar 11 22:24:22 2022 nano_pipe_recv_cb: ERROR: pipe is closed abruptly!!
Fri Mar 11 22:24:22 2022 nano_pipe_stop:  ########## nano_pipe_stop ########## 
Fri Mar 11 22:24:22 2022 tcptran_pipe_recv_cb: end of tcptran_pipe_recv_cb: synch! 0x61300000ffc0

Fri Mar 11 22:24:22 2022 server_cb: WAIT ^^^^ ctx3 ^^^^
Fri Mar 11 22:24:22 2022 nano_pipe_fini:  ########## nano_pipe_fini ########## 
Fri Mar 11 22:24:22 2022 server_cb: total pipes: 0
Fri Mar 11 22:24:22 2022 free_pub_packet: free topic
Fri Mar 11 22:24:22 2022 free_pub_packet: free payload
Fri Mar 11 22:24:22 2022 free_pub_packet: free pub_packet
Fri Mar 11 22:24:22 2022 init_pipe_content: pub_handler: init pipe_info
Fri Mar 11 22:24:22 2022 nng_ctx_recv:  ######## nng_ctx_recv context id 3 ######## 
Fri Mar 11 22:24:22 2022 nano_ctx_recv: nano_ctx_recv start 0x6100000003b0
^C
Broker exit(0).

=================================================================
==2322825==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7f61703a6dc6 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10ddc6)
    #1 0x559f675a9e33 in nni_zalloc ../nng/src/platform/posix/posix_alloc.c:26
    #2 0x559f6757a0f2 in nng_zalloc ../nng/src/nng.c:64
    #3 0x559f675efeb8 in property_alloc ../nng/src/supplemental/mqtt/mqtt_codec.c:1939
    #4 0x559f675f0466 in property_set_value_str ../nng/src/supplemental/mqtt/mqtt_codec.c:2056
    #5 0x559f675bbc11 in conn_handler ../nng/src/sp/protocol/mqtt/mqtt_parser.c:587
    #6 0x559f6763a192 in tcptran_pipe_nego_cb ../nng/src/sp/transport/mqtt/broker_tcp.c:337
    #7 0x559f675a4412 in nni_taskq_thread ../nng/src/core/taskq.c:50
    #8 0x559f675a59ea in nni_thr_wrap ../nng/src/core/thread.c:94
    #9 0x559f675ae1e4 in nni_plat_thr_main ../nng/src/platform/posix/posix_thread.c:266
    #10 0x7f617028058f in start_thread nptl/pthread_create.c:463

SUMMARY: AddressSanitizer: 64 byte(s) leaked in 1 allocation(s).

will msg NULL

the conn_handler fun in matt_parser ignore the will msg when client is MQTT V4

Memleak detected in MQTT over WebSocket module in NanoNNG

Memleak detected when websocket client is sending massive amount of messages then disconnect abruptly:

=================================================================
==90333==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 12612264 byte(s) in 75073 object(s) allocated from:
#0 0x7f725ccd2a37 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
#1 0x563d8743cb1b in nni_zalloc ../nng/src/platform/posix/posix_alloc.c:26
#2 0x563d87426e80 in nni_msg_alloc ../nng/src/core/message.c:388
#3 0x563d87768cb9 in wstran_pipe_recv_cb ../nng/src/sp/transport/mqttws/nmq_websocket.c:224
#4 0x563d87437036 in nni_taskq_thread ../nng/src/core/taskq.c:50
#5 0x563d87438318 in nni_thr_wrap ../nng/src/core/thread.c:94
#6 0x563d87441220 in nni_plat_thr_main ../nng/src/platform/posix/posix_thread.c:266
#7 0x7f725c9af946 in start_thread nptl/pthread_create.c:435

Direct leak of 7056 byte(s) in 42 object(s) allocated from:
#0 0x7f725ccd2a37 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
#1 0x563d8743cb1b in nni_zalloc ../nng/src/platform/posix/posix_alloc.c:26
#2 0x563d87426e80 in nni_msg_alloc ../nng/src/core/message.c:388
#3 0x563d8776a734 in wstran_pipe_send_start_v4 ../nng/src/sp/transport/mqttws/nmq_websocket.c:453
#4 0x563d8776d3da in wstran_pipe_send_start ../nng/src/sp/transport/mqttws/nmq_websocket.c:875
#5 0x563d8776d520 in wstran_pipe_send ../nng/src/sp/transport/mqttws/nmq_websocket.c:900
#6 0x563d8742b519 in nni_pipe_send ../nng/src/core/pipe.c:130
#7 0x563d8745cfce in nano_ctx_send ../nng/src/sp/protocol/mqtt/nmq_mqtt.c:428
#8 0x563d8743264d in nni_ctx_send ../nng/src/core/socket.c:1354
#9 0x563d8740e3ce in nng_ctx_send ../nng/src/nng.c:401
#10 0x563d87405d18 in server_cb ../nanomq/apps/broker.c:484
#11 0x563d87437036 in nni_taskq_thread ../nng/src/core/taskq.c:50
#12 0x563d87438318 in nni_thr_wrap ../nng/src/core/thread.c:94
#13 0x563d87441220 in nni_plat_thr_main ../nng/src/platform/posix/posix_thread.c:266
#14 0x7f725c9af946 in start_thread nptl/pthread_create.c:435

Direct leak of 4872 byte(s) in 29 object(s) allocated from:
#0 0x7f725ccd2a37 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
#1 0x563d8743cb1b in nni_zalloc ../nng/src/platform/posix/posix_alloc.c:26
#2 0x563d87426e80 in nni_msg_alloc ../nng/src/core/message.c:388
#3 0x563d8776bd5a in wstran_pipe_send_start_v5 ../nng/src/sp/transport/mqttws/nmq_websocket.c:668
#4 0x563d8776d465 in wstran_pipe_send_start ../nng/src/sp/transport/mqttws/nmq_websocket.c:878
#5 0x563d8776d520 in wstran_pipe_send ../nng/src/sp/transport/mqttws/nmq_websocket.c:900
#6 0x563d8742b519 in nni_pipe_send ../nng/src/core/pipe.c:130
#7 0x563d8745cfce in nano_ctx_send ../nng/src/sp/protocol/mqtt/nmq_mqtt.c:428
#8 0x563d8743264d in nni_ctx_send ../nng/src/core/socket.c:1354
#9 0x563d8740e3ce in nng_ctx_send ../nng/src/nng.c:401
#10 0x563d87405d18 in server_cb ../nanomq/apps/broker.c:484
#11 0x563d87437036 in nni_taskq_thread ../nng/src/core/taskq.c:50
#12 0x563d87438318 in nni_thr_wrap ../nng/src/core/thread.c:94
#13 0x563d87441220 in nni_plat_thr_main ../nng/src/platform/posix/posix_thread.c:266
#14 0x7f725c9af946 in start_thread nptl/pthread_create.c:435

Direct leak of 1848 byte(s) in 11 object(s) allocated from:
#0 0x7f725ccd2a37 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
#1 0x563d8743cb1b in nni_zalloc ../nng/src/platform/posix/posix_alloc.c:26
#2 0x563d87426e80 in nni_msg_alloc ../nng/src/core/message.c:388
#3 0x563d87769478 in wstran_pipe_recv_cb ../nng/src/sp/transport/mqttws/nmq_websocket.c:298
#4 0x563d87437036 in nni_taskq_thread ../nng/src/core/taskq.c:50
#5 0x563d87438318 in nni_thr_wrap ../nng/src/core/thread.c:94
#6 0x563d87441220 in nni_plat_thr_main ../nng/src/platform/posix/posix_thread.c:266
#7 0x7f725c9af946 in start_thread nptl/pthread_create.c:435

Indirect leak of 4804672 byte(s) in 75073 object(s) allocated from:
#0 0x7f725ccd2a37 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
#1 0x563d8743cb1b in nni_zalloc ../nng/src/platform/posix/posix_alloc.c:26
#2 0x563d87425c64 in nni_chunk_grow ../nng/src/core/message.c:159
#3 0x563d87426ed0 in nni_msg_alloc ../nng/src/core/message.c:398
#4 0x563d87768cb9 in wstran_pipe_recv_cb ../nng/src/sp/transport/mqttws/nmq_websocket.c:224
#5 0x563d87437036 in nni_taskq_thread ../nng/src/core/taskq.c:50
#6 0x563d87438318 in nni_thr_wrap ../nng/src/core/thread.c:94
#7 0x563d87441220 in nni_plat_thr_main ../nng/src/platform/posix/posix_thread.c:266
#8 0x7f725c9af946 in start_thread nptl/pthread_create.c:435

Indirect leak of 3024 byte(s) in 42 object(s) allocated from:
#0 0x7f725ccd2a37 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
#1 0x563d8743cb1b in nni_zalloc ../nng/src/platform/posix/posix_alloc.c:26
#2 0x563d87425a7a in nni_chunk_grow ../nng/src/core/message.c:141
#3 0x563d8742633d in nni_chunk_append ../nng/src/core/message.c:245
#4 0x563d87427652 in nni_msg_append ../nng/src/core/message.c:525
#5 0x563d8776b4ab in wstran_pipe_send_start_v4 ../nng/src/sp/transport/mqttws/nmq_websocket.c:574
#6 0x563d8776d3da in wstran_pipe_send_start ../nng/src/sp/transport/mqttws/nmq_websocket.c:875
#7 0x563d8776d520 in wstran_pipe_send ../nng/src/sp/transport/mqttws/nmq_websocket.c:900
#8 0x563d8742b519 in nni_pipe_send ../nng/src/core/pipe.c:130
#9 0x563d8745cfce in nano_ctx_send ../nng/src/sp/protocol/mqtt/nmq_mqtt.c:428
#10 0x563d8743264d in nni_ctx_send ../nng/src/core/socket.c:1354
#11 0x563d8740e3ce in nng_ctx_send ../nng/src/nng.c:401
#12 0x563d87405d18 in server_cb ../nanomq/apps/broker.c:484
#13 0x563d87437036 in nni_taskq_thread ../nng/src/core/taskq.c:50
#14 0x563d87438318 in nni_thr_wrap ../nng/src/core/thread.c:94
#15 0x563d87441220 in nni_plat_thr_main ../nng/src/platform/posix/posix_thread.c:266
#16 0x7f725c9af946 in start_thread nptl/pthread_create.c:435

Indirect leak of 2175 byte(s) in 29 object(s) allocated from:
#0 0x7f725ccd2a37 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
#1 0x563d8743cb1b in nni_zalloc ../nng/src/platform/posix/posix_alloc.c:26
#2 0x563d87425a7a in nni_chunk_grow ../nng/src/core/message.c:141
#3 0x563d8742633d in nni_chunk_append ../nng/src/core/message.c:245
#4 0x563d87427652 in nni_msg_append ../nng/src/core/message.c:525
#5 0x563d8776ce0f in wstran_pipe_send_start_v5 ../nng/src/sp/transport/mqttws/nmq_websocket.c:815
#6 0x563d8776d465 in wstran_pipe_send_start ../nng/src/sp/transport/mqttws/nmq_websocket.c:878
#7 0x563d8776d520 in wstran_pipe_send ../nng/src/sp/transport/mqttws/nmq_websocket.c:900
#8 0x563d8742b519 in nni_pipe_send ../nng/src/core/pipe.c:130
#9 0x563d8745cfce in nano_ctx_send ../nng/src/sp/protocol/mqtt/nmq_mqtt.c:428
#10 0x563d8743264d in nni_ctx_send ../nng/src/core/socket.c:1354
#11 0x563d8740e3ce in nng_ctx_send ../nng/src/nng.c:401
#12 0x563d87405d18 in server_cb ../nanomq/apps/broker.c:484
#13 0x563d87437036 in nni_taskq_thread ../nng/src/core/taskq.c:50
#14 0x563d87438318 in nni_thr_wrap ../nng/src/core/thread.c:94
#15 0x563d87441220 in nni_plat_thr_main ../nng/src/platform/posix/posix_thread.c:266
#16 0x7f725c9af946 in start_thread nptl/pthread_create.c:435

Indirect leak of 704 byte(s) in 11 object(s) allocated from:
#0 0x7f725ccd2a37 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
#1 0x563d8743cb1b in nni_zalloc ../nng/src/platform/posix/posix_alloc.c:26
#2 0x563d87425c64 in nni_chunk_grow ../nng/src/core/message.c:159
#3 0x563d87426ed0 in nni_msg_alloc ../nng/src/core/message.c:398
#4 0x563d87769478 in wstran_pipe_recv_cb ../nng/src/sp/transport/mqttws/nmq_websocket.c:298
#5 0x563d87437036 in nni_taskq_thread ../nng/src/core/taskq.c:50
#6 0x563d87438318 in nni_thr_wrap ../nng/src/core/thread.c:94
#7 0x563d87441220 in nni_plat_thr_main ../nng/src/platform/posix/posix_thread.c:266
#8 0x7f725c9af946 in start_thread nptl/pthread_create.c:435

SUMMARY: AddressSanitizer: 17436615 byte(s) leaked in 150310 allocation(s).

quic bridging qos 2 crashed

Describe the bug
AddressSanitizer:DEADLYSIGNAL

==37150==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000198 (pc 0x562f68fe213a bp 0x7f6a359de890 sp 0x7f6a359de880 T33)
==37150==The signal is caused by a READ memory access.
==37150==Hint: address points to the zero page.
#0 0x562f68fe213a in nni_list_node_remove ../nng/src/core/list.c:170
#1 0x562f68fda719 in nni_aio_list_remove ../nng/src/core/aio.c:501
#2 0x562f69097009 in QuicStreamCallback ../nng/src/supplemental/quic/quic_api.c:329
#3 0x7f6a497565ad in QuicStreamIndicateEvent ../nng/extern/msquic/src/core/stream.c:420
#4 0x7f6a4975a2ac in QuicStreamRecvFlush ../nng/extern/msquic/src/core/stream_recv.c:846
#5 0x7f6a497a12fc in QuicConnDrainOperations ../nng/extern/msquic/src/core/connection.c:7335
#6 0x7f6a49768253 in QuicWorkerProcessConnection ../nng/extern/msquic/src/core/worker.c:510
#7 0x7f6a49769321 in QuicWorkerLoop ../nng/extern/msquic/src/core/worker.c:670
#8 0x7f6a49769aa7 in QuicWorkerThread ../nng/extern/msquic/src/core/worker.c:735
#9 0x7f6a4943e946 in start_thread nptl/pthread_create.c:435
#10 0x7f6a494cea43 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x124a43)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV ../nng/src/core/list.c:170 in nni_list_node_remove
Thread T33 created by T0 here:
#0 0x7f6a49b07685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216
#1 0x7f6a497f892a in CxPlatThreadCreate ../nng/extern/msquic/src/platform/platform_posix.c:649
#2 0x7f6a497663c4 in QuicWorkerInitialize ../nng/extern/msquic/src/core/worker.c:117
#3 0x7f6a49769d79 in QuicWorkerPoolInitialize ../nng/extern/msquic/src/core/worker.c:793
#4 0x7f6a4974b5e0 in MsQuicRegistrationOpen ../nng/extern/msquic/src/core/registration.c:162
#5 0x562f69097dab in quic_open ../nng/src/supplemental/quic/quic_api.c:553
#6 0x562f690093a3 in nng_mqtt_quic_client_open ../nng/src/mqtt/protocol/mqtt/mqtt_quic.c:1112
#7 0x562f68f997bf in bridge_quic_client ../nanomq/bridge.c:221
#8 0x562f68f99dab in bridge_client ../nanomq/bridge.c:270
#9 0x562f68fc7a1a in broker ../nanomq/apps/broker.c:939
#10 0x562f68fcae72 in broker_start ../nanomq/apps/broker.c:1549
#11 0x562f68f97d83 in main ../nanomq/nanomq.c:139
#12 0x7f6a493d3fcf in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

==37150==ABORTING

Expected behavior
A clear and concise description of what you expected to happen.

Actual Behavior
Describe what occurred.

To Reproduce
If possible include actual reproduction test code here.
Minimal C test cases are perferred.

** Environment Details **

  • NanoMQ version
  • Operating system and version
  • Compiler and language used
  • testing scenario

Client SDK
nanosdk + quic

Additional context
Add any other context about the problem here.

QUIC reconnect cause dead lock

This is a bug in developing branch

[quic_strm_send_start]: type is 0xc c0.
[quic_strm_send_start]: body len: 1 header len: 1
[QuicStreamCallback]: [strm][0x7fae50027780] Data sent
[QuicConnectionCallback]: [conn][0x559a030d85c0] Shut down by transport, 0x6e
[QuicConnectionCallback]: pipe stop
[QuicStreamCallback]: [strm][0x7fae50027780] All done
[QuicConnectionCallback]: [conn][0x559a030d85c0] All done

[QuicConnectionCallback]: [conn][0x559a030d85c0] try to resume by ticket
[quic_reconnect]: [conn] ReConnecting... 54.75.171.11 : 14567
[QuicConnectionCallback]: [conn][0x7fae5001ca90] Shut down by transport, 0x65
nanomq: pthread_mutex_lock.c:90: ___pthread_mutex_lock: Assertion `mutex->__data.__owner == 0' failed.
Aborted (core dumped)

Retain msg( tls test) can lead to nanomq error (heap use after free)

Launch nanomq with tls on, then publish a message with retain flag, and then sub will crash nanomq.

./nanomq/nanomq start --conf ../etc/nanomq.conf
mosquitto_pub -m message -p 8883 --cafile path/to/cacert.pem  --insecure -t topic -r -d
mosquitto_sub --cafile path/to/cacert.pem  -t topic -p 8883  --insecure -d
=================================================================
==99250==ERROR: AddressSanitizer: heap-use-after-free on address 0x60f00000830c at pc 0x55c8f6bb12cf bp 0x7f76145f7b90 sp 0x7f76145f7b80
WRITE of size 4 at 0x60f00000830c thread T8
    #0 0x55c8f6bb12ce in nni_atomic_dec_nv /home/lee/workspace/nanomq/nng/src/platform/posix/posix_atomic.c:120
    #1 0x55c8f6b9a7b5 in nni_msg_free /home/lee/workspace/nanomq/nng/src/core/message.c:458
    #2 0x55c8f6ecac3b in tlstran_pipe_send_cb /home/lee/workspace/nanomq/nng/src/sp/transport/mqtts/broker_tls.c:515
    #3 0x55c8f6baa70e in nni_taskq_thread /home/lee/workspace/nanomq/nng/src/core/taskq.c:50
    #4 0x55c8f6bab9ff in nni_thr_wrap /home/lee/workspace/nanomq/nng/src/core/thread.c:94
    #5 0x55c8f6bb49a6 in nni_plat_thr_main /home/lee/workspace/nanomq/nng/src/platform/posix/posix_thread.c:266
    #6 0x7f761b575b42 in start_thread nptl/pthread_create.c:442
    #7 0x7f761b6079ff  (/lib/x86_64-linux-gnu/libc.so.6+0x1269ff)

0x60f00000830c is located 124 bytes inside of 168-byte region [0x60f000008290,0x60f000008338)
freed by thread T9 here:
    #0 0x7f761b7e1517 in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:127
    #1 0x55c8f6bb0276 in nni_free /home/lee/workspace/nanomq/nng/src/platform/posix/posix_alloc.c:33
    #2 0x55c8f6b9a8a1 in nni_msg_free /home/lee/workspace/nanomq/nng/src/core/message.c:465
    #3 0x55c8f6ecac3b in tlstran_pipe_send_cb /home/lee/workspace/nanomq/nng/src/sp/transport/mqtts/broker_tls.c:515
    #4 0x55c8f6baa70e in nni_taskq_thread /home/lee/workspace/nanomq/nng/src/core/taskq.c:50
    #5 0x55c8f6bab9ff in nni_thr_wrap /home/lee/workspace/nanomq/nng/src/core/thread.c:94
    #6 0x55c8f6bb49a6 in nni_plat_thr_main /home/lee/workspace/nanomq/nng/src/platform/posix/posix_thread.c:266
    #7 0x7f761b575b42 in start_thread nptl/pthread_create.c:442

previously allocated by thread T9 here:
    #0 0x7f761b7e1a37 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x55c8f6bb024d in nni_zalloc /home/lee/workspace/nanomq/nng/src/platform/posix/posix_alloc.c:26
    #2 0x55c8f6b9a36c in nni_msg_alloc /home/lee/workspace/nanomq/nng/src/core/message.c:388
    #3 0x55c8f6ecdc7a in tlstran_pipe_send_start_v4 /home/lee/workspace/nanomq/nng/src/sp/transport/mqtts/broker_tls.c:1064
    #4 0x55c8f6ed004d in tlstran_pipe_send_start /home/lee/workspace/nanomq/nng/src/sp/transport/mqtts/broker_tls.c:1404
    #5 0x55c8f6ed01a8 in tlstran_pipe_send /home/lee/workspace/nanomq/nng/src/sp/transport/mqtts/broker_tls.c:1430
    #6 0x55c8f6b9ea35 in nni_pipe_send /home/lee/workspace/nanomq/nng/src/core/pipe.c:130
    #7 0x55c8f6bd0924 in nano_ctx_send /home/lee/workspace/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:428
    #8 0x55c8f6ba5ca7 in nni_ctx_send /home/lee/workspace/nanomq/nng/src/core/socket.c:1354
    #9 0x55c8f6b81713 in nng_ctx_send /home/lee/workspace/nanomq/nng/src/nng.c:401
    #10 0x55c8f6b77589 in server_cb /home/lee/workspace/nanomq/nanomq/apps/broker.c:330
    #11 0x55c8f6baaf06 in nni_task_exec /home/lee/workspace/nanomq/nng/src/core/taskq.c:144
    #12 0x55c8f6b8e2a3 in nni_aio_finish_impl /home/lee/workspace/nanomq/nng/src/core/aio.c:454
    #13 0x55c8f6b8e325 in nni_aio_finish_sync /home/lee/workspace/nanomq/nng/src/core/aio.c:469
    #14 0x55c8f6bd4885 in nano_pipe_recv_cb /home/lee/workspace/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1088
    #15 0x55c8f6baaf06 in nni_task_exec /home/lee/workspace/nanomq/nng/src/core/taskq.c:144
    #16 0x55c8f6b8e2a3 in nni_aio_finish_impl /home/lee/workspace/nanomq/nng/src/core/aio.c:454
    #17 0x55c8f6b8e325 in nni_aio_finish_sync /home/lee/workspace/nanomq/nng/src/core/aio.c:469
    #18 0x55c8f6ecc68e in tlstran_pipe_recv_cb /home/lee/workspace/nanomq/nng/src/sp/transport/mqtts/broker_tls.c:814
    #19 0x55c8f6baa70e in nni_taskq_thread /home/lee/workspace/nanomq/nng/src/core/taskq.c:50
    #20 0x55c8f6bab9ff in nni_thr_wrap /home/lee/workspace/nanomq/nng/src/core/thread.c:94
    #21 0x55c8f6bb49a6 in nni_plat_thr_main /home/lee/workspace/nanomq/nng/src/platform/posix/posix_thread.c:266
    #22 0x7f761b575b42 in start_thread nptl/pthread_create.c:442

Thread T8 created by T0 here:
    #0 0x7f761b785685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216
    #1 0x55c8f6bb4ad6 in nni_plat_thr_init /home/lee/workspace/nanomq/nng/src/platform/posix/posix_thread.c:279
    #2 0x55c8f6babcab in nni_thr_init /home/lee/workspace/nanomq/nng/src/core/thread.c:121
    #3 0x55c8f6baaa30 in nni_taskq_init /home/lee/workspace/nanomq/nng/src/core/taskq.c:95
    #4 0x55c8f6bab6c9 in nni_taskq_sys_init /home/lee/workspace/nanomq/nng/src/core/taskq.c:294
    #5 0x55c8f6b956cf in nni_init_helper /home/lee/workspace/nanomq/nng/src/core/init.c:35
    #6 0x55c8f6bb4e7b in nni_plat_init /home/lee/workspace/nanomq/nng/src/platform/posix/posix_thread.c:422
    #7 0x55c8f6b95750 in nni_init /home/lee/workspace/nanomq/nng/src/core/init.c:58
    #8 0x55c8f6bd8c28 in nni_proto_mqtt_open /home/lee/workspace/nanomq/nng/src/sp/protocol.c:37
    #9 0x55c8f6bd5166 in nng_nmq_tcp0_open /home/lee/workspace/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1249
    #10 0x55c8f6b7b502 in broker /home/lee/workspace/nanomq/nanomq/apps/broker.c:893
    #11 0x55c8f6b7ed57 in broker_start /home/lee/workspace/nanomq/nanomq/apps/broker.c:1531
    #12 0x55c8f6b57e9b in main /home/lee/workspace/nanomq/nanomq/nanomq.c:139
    #13 0x7f761b50ad8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Thread T9 created by T0 here:
    #0 0x7f761b785685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216
    #1 0x55c8f6bb4ad6 in nni_plat_thr_init /home/lee/workspace/nanomq/nng/src/platform/posix/posix_thread.c:279
    #2 0x55c8f6babcab in nni_thr_init /home/lee/workspace/nanomq/nng/src/core/thread.c:121
    #3 0x55c8f6baaa30 in nni_taskq_init /home/lee/workspace/nanomq/nng/src/core/taskq.c:95
    #4 0x55c8f6bab6c9 in nni_taskq_sys_init /home/lee/workspace/nanomq/nng/src/core/taskq.c:294
    #5 0x55c8f6b956cf in nni_init_helper /home/lee/workspace/nanomq/nng/src/core/init.c:35
    #6 0x55c8f6bb4e7b in nni_plat_init /home/lee/workspace/nanomq/nng/src/platform/posix/posix_thread.c:422
    #7 0x55c8f6b95750 in nni_init /home/lee/workspace/nanomq/nng/src/core/init.c:58
    #8 0x55c8f6bd8c28 in nni_proto_mqtt_open /home/lee/workspace/nanomq/nng/src/sp/protocol.c:37
    #9 0x55c8f6bd5166 in nng_nmq_tcp0_open /home/lee/workspace/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1249
    #10 0x55c8f6b7b502 in broker /home/lee/workspace/nanomq/nanomq/apps/broker.c:893
    #11 0x55c8f6b7ed57 in broker_start /home/lee/workspace/nanomq/nanomq/apps/broker.c:1531
    #12 0x55c8f6b57e9b in main /home/lee/workspace/nanomq/nanomq/nanomq.c:139
    #13 0x7f761b50ad8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

SUMMARY: AddressSanitizer: heap-use-after-free /home/lee/workspace/nanomq/nng/src/platform/posix/posix_atomic.c:120 in nni_atomic_dec_nv
Shadow bytes around the buggy address:
  0x0c1e7fff9010: fa fa fa fa fa fa fd fd fd fd fd fd fd fd fd fd
  0x0c1e7fff9020: fd fd fd fd fd fd fd fd fd fd fd fa fa fa fa fa
  0x0c1e7fff9030: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c1e7fff9040: 00 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa
  0x0c1e7fff9050: fa fa fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x0c1e7fff9060: fd[fd]fd fd fd fd fd fa fa fa fa fa fa fa fa fa
  0x0c1e7fff9070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1e7fff9080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1e7fff9090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1e7fff90a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1e7fff90b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==99250==ABORTING

Message compatibility

the nni_msg structure of nanonng and nanosdk should be compatible for each other. It means we gonna move all fields that broker oriented into proto_data.

quic bridge: qos 1 msg halted

Describe the bug
use mqtt over quic bridge cause broker halted, perhaps this is the consequence of incorrect bridging between msquic and nng' aio

The conf object gets used before it is set

Describe the bug
client keeps connect-pub-disconnect in a high rate.
no client sub

Expected behavior
nothing happens

Actual Behavior
broker crashed V0.8.3
AddressSanitizer:DEADLYSIGNAL

==255182==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000060 (pc 0x56338b1c819c bp 0x7f59f30f7a10 sp 0x7f59f30f79f0 T8)
==255182==The signal is caused by a READ memory access.
==255182==Hint: address points to the zero page.
#0 0x56338b1c819c in tcptran_pipe_init ../nng/src/sp/transport/mqtt/broker_tcp.c:163
#1 0x56338b12a177 in pipe_create ../nng/src/core/pipe.c:287
#2 0x56338b12a628 in nni_pipe_create_listener ../nng/src/core/pipe.c:329
#3 0x56338b13173c in nni_listener_add_pipe ../nng/src/core/socket.c:1581
#4 0x56338b12318b in listener_accept_cb ../nng/src/core/listener.c:357
#5 0x56338b134f63 in nni_taskq_thread ../nng/src/core/taskq.c:50
#6 0x56338b136245 in nni_thr_wrap ../nng/src/core/thread.c:94
#7 0x56338b13ec16 in nni_plat_thr_main ../nng/src/platform/posix/posix_thread.c:266
#8 0x7f59fa1f8946 in start_thread nptl/pthread_create.c:435
#9 0x7f59fa288a43 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x124a43)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV ../nng/src/sp/transport/mqtt/broker_tcp.c:163 in tcptran_pipe_init
Thread T8 created by T0 here:
#0 0x7f59fa408685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216
#1 0x56338b13ed46 in nni_plat_thr_init ../nng/src/platform/posix/posix_thread.c:279
#2 0x56338b1364ee in nni_thr_init ../nng/src/core/thread.c:121
#3 0x56338b135282 in nni_taskq_init ../nng/src/core/taskq.c:95
#4 0x56338b135f15 in nni_taskq_sys_init ../nng/src/core/taskq.c:294
#5 0x56338b121112 in nni_init_helper ../nng/src/core/init.c:35
#6 0x56338b13f09a in nni_plat_init ../nng/src/platform/posix/posix_thread.c:422
#7 0x56338b121190 in nni_init ../nng/src/core/init.c:58
#8 0x56338b166ed0 in nni_proto_mqtt_open ../nng/src/sp/protocol.c:37
#9 0x56338b1634c2 in nng_nmq_tcp0_open ../nng/src/sp/protocol/mqtt/nmq_mqtt.c:1322
#10 0x56338b0f7d9d in broker ../nanomq/apps/broker.c:813
#11 0x56338b0faa03 in broker_start ../nanomq/apps/broker.c:1303
#12 0x56338b0d93e7 in main ../nanomq/nanomq.c:222
#13 0x7f59fa18dfcf in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

==255182==ABORTING

Client SDK
Mosquitto

Additional context
free

QUIC bridging blocks NNG thread

Describe the bug
start nanomq in offline mode with quic bridging enabled
Then broker hangs forever

Expected behavior
broker start successfully and reconnects when network is restored

Actual Behavior
It hangs....

To Reproduce
start nanomq in offline mode with quic bridging enabled

** Environment Details **

  • NanoMQ version 0.11

Client SDK
not related

Additional context
it awaits connect msg being sent

SQLite ver cause msg leak when clean start = 1

Describe the bug
memleak happend when pub qos 1/2 msg with sqlite enabled

Expected behavior
no memleak

Actual Behavior
msg does not get freed

To Reproduce
just pub and sub qos 2 msg

** Environment Details **
no particular

Additional context
Add any other context about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.