issue_owner_repo
listlengths
2
2
issue_body
stringlengths
0
261k
issue_title
stringlengths
1
925
issue_comments_url
stringlengths
56
81
issue_comments_count
int64
0
2.5k
issue_created_at
stringlengths
20
20
issue_updated_at
stringlengths
20
20
issue_html_url
stringlengths
37
62
issue_github_id
int64
387k
2.46B
issue_number
int64
1
127k
[ "emqx", "nanomq" ]
**Describe the bug** A clear and concise description of what the bug is. Does nanomq support the session expiry interval set ? how to set it ? **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 0.19.5 - Operating system and version - Compiler and language used - 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.
How to set "session expiry interval"?
https://api.github.com/repos/nanomq/nanomq/issues/1461/comments
1
2023-09-25T06:01:36Z
2023-09-28T03:14:16Z
https://github.com/nanomq/nanomq/issues/1461
1,910,729,342
1,461
[ "emqx", "nanomq" ]
**Describe the bug** When I disconnect the bridge through shutting down access to the EMQX broker the clients that I have connected to the Nano broker disconnect as well. **Expected behavior** When the connection between the Nano & EMQX broker is disrupted clients connected to the Nano broker will remain connected and publishing data to the Nano broker. That data will buffer on the Nano broker and transmit when the connection to EMQX is established again. **Actual Behavior** I am working on testing various options for data persistence in the case of a failure to push to the cloud EMQX broker over the bridge. When I interrupt the connection between Nano and EMQX the clients that I have are disconnecting from the Nano broker itself. It should be noted that I have a HAProxy load balancer in front of the EQMX broker cluster. The behavior is seen in the clients themselves. The logs on the Nano broker indicate that the clients are still connected however the client will indicate it is disconnected and enter into the mode to attempt reconnects. **To Reproduce** Establish and EQMX broker with a HAProxy load balancer Establish a Nano broker on another server and connect a bridge to EMQX Establish a connection to the Nano broker via MQTTX Establish a subscription to the EQMX broker Publish from your MQTTX client to the Nano broker and verify the sub receives a message Next find a way to break the connection on the bridge (I have tried shutting down HAProxy, closing listeners on EMQX, shutting down ports - all exhibit the same behavior of the bug) Check your MQTTX client that is connected to Nano and see that it is disconnected Check Nano logs and see it thinks the client is still there ** Environment Details ** - NanoMQ - nanomq-0.19.5-linux-arm64-sqlite.deb on Debain 12 on an AWS EC2 - EQMX - 5.1.6 - on Ubuntu 22 on AWS EC2 - HAProxy - 2.8.3 - on Ubuntu 22 on AWS EC2 - MQTTX - 1.9.6 - on my local machine **Client SDK** I am using the MQTTX client
Nano clients disconnect when EMQX bridge disconnects
https://api.github.com/repos/nanomq/nanomq/issues/1460/comments
4
2023-09-22T13:36:35Z
2024-02-05T04:01:20Z
https://github.com/nanomq/nanomq/issues/1460
1,908,926,749
1,460
[ "emqx", "nanomq" ]
**Describe the bug** crash while using rest api to reload bridge conf. **Expected behavior** Do not crash at any circumstance. **To Reproduce** Start NanoMQ with bridge feature on. And enable will topics in bridge configuration. Then using rest api "PUT /api/v4/bridges/{bridge_name}". The example request which no configuration about will topic is set will crash NanoMQ immediately. ** Environment Details ** - NanoMQ version : main branch latest - Operating system and version: Ubuntu 22.04
crash while using rest api to reload bridge conf
https://api.github.com/repos/nanomq/nanomq/issues/1458/comments
1
2023-09-22T05:20:42Z
2023-09-22T09:54:44Z
https://github.com/nanomq/nanomq/issues/1458
1,908,199,692
1,458
[ "emqx", "nanomq" ]
**Describe the bug** NanoMQ crashes with the wrong configuration file. **Expected behavior** Do not crash at any circumstance. **To Reproduce** Bridge configured in the old way, using "topic", not "remote_topic" and "local_topic". NanoMQ start with this conf file, it will soon crash. ** Environment Details ** - NanoMQ version: latest main branch - Operating system and version: Ubuntu 22.04
crashes with the wrong configuration file
https://api.github.com/repos/nanomq/nanomq/issues/1457/comments
0
2023-09-22T04:09:52Z
2023-09-25T01:28:21Z
https://github.com/nanomq/nanomq/issues/1457
1,908,148,712
1,457
[ "emqx", "nanomq" ]
**Describe the bug** There will be memleaks using certain rest apis. **To Reproduce** Start NanoMQ with http server feature on; use mosquitto_sub to sub a topic; use rest api like "GET /api/v4/clients"; then you will get a memleak. There are other rest apia can also cause memleak like "GET /api/v4/subscriptions/{clientid}", "GET /api/v4/subscriptions", "GET /api/v4/clients/username/{username}", "GET /api/v4/clients/{clientid}", "GET /api/v4/prometheus". ** Environment Details ** - NanoMQ version: latest main branch - Operating system and version: Ubuntu 22.04
memleak in rest api
https://api.github.com/repos/nanomq/nanomq/issues/1454/comments
1
2023-09-21T06:54:32Z
2023-09-21T08:09:29Z
https://github.com/nanomq/nanomq/issues/1454
1,906,244,754
1,454
[ "emqx", "nanomq" ]
**Describe the bug** $SYS event online/offline msgs are incomplete; the message is truncated after reaching 255 bytes **Expected behavior** complete $SYS event msg **Actual Behavior** $SYS event online/offline message is truncated after reaching 255 bytes **To Reproduce** If possible include actual reproduction test code here. Minimal C test cases are perferred. ** Environment Details ** - NanoMQ version 0.19.5 - Operating system and version linux-arm7 - Compiler and language used - testing scenario
$SYS event msgs (online/offline) are incomplete
https://api.github.com/repos/nanomq/nanomq/issues/1445/comments
8
2023-09-18T06:09:53Z
2023-11-16T10:43:52Z
https://github.com/nanomq/nanomq/issues/1445
1,900,235,903
1,445
[ "emqx", "nanomq" ]
Your documentation on "Enable Multi-Stream Bridging + QoS Prioritization" mentions the following statement: "In the meantime, QoS 1/2 packets shares higher priority than QoS 0, which means NanoMQ can assure the more important messages get first seat in limited network bandwidth situation. Therefore users can get best usage of ther network capacity and prevent non-critical messages causing congestion." It seems that you assume here that QoS equals send priority. This is however not always preferred. I am working on a use-case in Energy control that requires both real-time data (QoS 0) and telemetry data (QoS 1). The telemetry data stream should be focused on data consistency over latency. The real-time data should be focused on low latency only and does not require absolute consistency, hence QoS 0. For this we would like to be able to give priority to the real-time traffic with QoS 0. It is also OK to do prioritization topic based as long as we can give the real-time data priority over telemetry.
Separate QOS and Send Priority
https://api.github.com/repos/nanomq/nanomq/issues/1444/comments
7
2023-09-15T12:52:17Z
2023-10-15T11:35:55Z
https://github.com/nanomq/nanomq/issues/1444
1,898,378,487
1,444
[ "emqx", "nanomq" ]
**Describe the bug** I'm running version v0.19.5-2 on an Ubuntu 20.04.6 LTS installed from apt. when i start nanomq with the flag -d to run as deamon it stops in about 20 hours without any external command or interruption. **Expected behavior** When i run nanomq as demon it keeps running until its being manually stopped. **Actual Behavior** nanomq deamon stops after about 20 hours without any external command or interruption. **To Reproduce** If possible include actual reproduction test code here. Minimal C test cases are perferred. ** Environment Details ** - NanoMQ version v0.19.5-2 - Operating system and version Ubuntu 20.04.6 LTS **Client SDK** using [pubsubclient](https://github.com/knolleary/pubsubclient) library on ESP8266 **Additional context** end of the log file is like this: ``` 2023-09-09 21:37:38 [61136] WARN /home/runner/work/nanomq/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:302: nego aio error: Connection shutdown 2023-09-09 21:42:38 [61136] WARN /home/runner/work/nanomq/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:302: nego aio error: Connection shutdown 2023-09-09 21:45:19 [61135] WARN /home/runner/work/nanomq/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:612: nni aio recv error!! Object closed 2023-09-09 21:45:19 [61135] WARN /home/runner/work/nanomq/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:880: tcptran_pipe_recv_cb: parse error rv: 139 2023-09-09 21:45:19 [61135] WARN /home/runner/work/nanomq/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:612: nni aio recv error!! Object closed 2023-09-09 21:45:19 [61135] WARN /home/runner/work/nanomq/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:880: tcptran_pipe_recv_cb: parse error rv: 139 2023-09-09 21:45:19 [61138] WARN /home/runner/work/nanomq/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:612: nni aio recv error!! Object closed 2023-09-09 21:45:19 [61138] WARN /home/runner/work/nanomq/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:880: tcptran_pipe_recv_cb: parse error rv: 139 2023-09-09 21:45:19 [61135] WARN /home/runner/work/nanomq/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:612: nni aio recv error!! Object closed 2023-09-09 21:45:19 [61137] WARN /home/runner/work/nanomq/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:612: nni aio recv error!! Object closed 2023-09-09 21:45:19 [61137] WARN /home/runner/work/nanomq/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:880: tcptran_pipe_recv_cb: parse error rv: 139 2023-09-09 21:45:19 [61135] WARN /home/runner/work/nanomq/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:880: tcptran_pipe_recv_cb: parse error rv: 139 2023-09-09 21:45:19 [61135] WARN /home/runner/work/nanomq/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:612: nni aio recv error!! Object closed 2023-09-09 21:45:19 [61135] WARN /home/runner/work/nanomq/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:880: tcptran_pipe_recv_cb: parse error rv: 139 2023-09-09 21:45:19 [61135] WARN /home/runner/work/nanomq/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:612: nni aio recv error!! Object closed 2023-09-09 21:45:19 [61135] WARN /home/runner/work/nanomq/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:880: tcptran_pipe_recv_cb: parse error rv: 139 ```
nanomq deamon automatically stops without any external triggers.
https://api.github.com/repos/nanomq/nanomq/issues/1436/comments
4
2023-09-09T20:00:05Z
2023-10-11T17:34:57Z
https://github.com/nanomq/nanomq/issues/1436
1,888,859,028
1,436
[ "emqx", "nanomq" ]
**Describe the bug** nanomq启动时,报tls证书读取异常: ERROR /home/runner/work/nanomq/nanomq/nng/src/supplemental/nanolib/conf_ver2.c:382 conf_tls_parse_ver2_base: Read keyfile /etc/certs/server.key.pem failed! 证书是自签名的pem编码证书。 **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:nanomq-0.19.5-linux-armhf-msquic - Operating system and version:linux - Compiler and language used - 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.
tls证书读取异常
https://api.github.com/repos/nanomq/nanomq/issues/1432/comments
0
2023-09-06T07:43:04Z
2023-09-06T08:37:12Z
https://github.com/nanomq/nanomq/issues/1432
1,883,441,681
1,432
[ "emqx", "nanomq" ]
Hi, We've selected NanoMQ for our IoT telemetry recever. In our design, multiple devices will connect to a single NanoMQ instance. What we want is a way to create a realtime data processor for each connected device. ![image](https://github.com/emqx/nanomq/assets/3267533/e0a38d1b-19c4-459a-8996-ea25068fd4ef) Using the Python Paho Mqtt connector, we have a single handler for on_message. ``` client = mqtt.Client() client.on_connect = on_connect client.on_message = on_message client.connect(NANOMQ_HOST, NANOMQ_PORT, 60) ``` This implies that all messages for all devices will funnel through the same on_message() handler. What we want are separate on_message() events for each connected device, each handled by a thread/task. Is this practical to do with the MQTT connector, or would the ZeroMQ connector be more efficient, possibly with a topic filter matching the device? Thank you for any help.
Recommended pattern for multiple realtime stream processors for multiple connected clients
https://api.github.com/repos/nanomq/nanomq/issues/1421/comments
3
2023-08-24T07:08:56Z
2024-04-18T08:12:08Z
https://github.com/nanomq/nanomq/issues/1421
1,864,545,987
1,421
[ "emqx", "nanomq" ]
**Describe the bug** EMQX WebSocket client failed to connect to nanomq WebSocket port **Expected behavior** EMQX WebSocket client connect to nanomq WebSocket port successfully **Actual Behavior** EMQX WebSocket client failed to connect to nanomq WebSocket port. ![image](https://github.com/emqx/nanomq/assets/16575896/392f732f-944c-497b-8192-382fa06a185b) ![image](https://github.com/emqx/nanomq/assets/16575896/aa0682ee-8be4-458f-9c05-4dc233568834) **To Reproduce** Use emqx WebSocket client to connect to nanomq ** Environment Details ** - NanoMQ version: master - Operating system and version: ubuntu 22.04 - Compiler and language used - 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.
EMQX WebSocket client failed to connect to nanomq WebSocket port
https://api.github.com/repos/nanomq/nanomq/issues/1420/comments
2
2023-08-22T06:47:21Z
2023-08-24T12:12:26Z
https://github.com/nanomq/nanomq/issues/1420
1,860,719,411
1,420
[ "emqx", "nanomq" ]
**Describe the bug** While fuzzing the broker with my self-written fuzzer it quickly crashes with this end output: **Expected behavior** The broker should not crash upon receiving any message. **Actual Behavior** The Broker crashes. Here is the last output to console after crashing: ``` Warning: close pipe & kick client due to KeepAlive timeout!panic: pthread_mutex_lock: Invalid argumentThis message is indicative of a BUG.Report this at https://github.com/emqx/nanomqnanomq(nni_panic+0x117) [0x559ef6e85757]nanomq(nni_task_wait+0x21) [0x559ef6e8ac01]nanomq(+0x59ef5) [0x559ef6e99ef5]nanomq(+0x4583b) [0x559ef6e8583b]nanomq(+0x4639a) [0x559ef6e8639a]nanomq(+0x4afeb) [0x559ef6e8afeb]nanomq(+0x4d8a6) [0x559ef6e8d8a6]/usr/lib/libc.so.6(+0x8c9eb) [0x7f0db3e8c9eb]/usr/lib/libc.so.6(+0x11123c) [0x7f0db3f1123c] ``` **To Reproduce** This is where it gets a bit funky. Since it is a locking bug it is not guaranteed to be reproducible on every run of the program. But when fuzzing i've always gotten it so far and with replaying it happens 6 times out of 10. Here are two logs reproducing the behaviour(the second one with log_level debug): https://gist.github.com/Nereuxofficial/2aef73e8403a6445cca91e6c34d3b296 [And here is another log with fuzz mode from my server](https://gist.github.com/Nereuxofficial/2efc6c792ee74fbc2fab7bc3fff7ffcc) Should be noted that last stdout and last stderr is the complete output of the broker. I've just forgotten to update the logging. I would like to do a small C program here but due to this requiring to rewrite the fuzzer in C this is not an option. The easiest way to reproduce this is with the fuzzer: After making sure your system nanomq is the newest version do this: 1. [Install Rust](https://rustup.rs) 2. Clone [rusty-FUME](https://github.com/MCloudTT/rusty-FUME) and checkout [repro_nanomq_mutex_lock](https://github.com/MCloudTT/rusty-FUME/tree/repro_nanomq_mutex_lock) via: ```bash git clone https://github.com/MCloudTT/rusty-FUME cd rusty-FUME git checkout repro_nanomq_mutex_lock ``` 3. Run: `cargo run -r -- --broker-command "nanomq start" replay` (Here you can also attach a log_level, though in my experience the crash rate was lower this way...) If 3 doesn't work like on my server try to find the bug again using fuzzing: 3. Run: `cargo run -r -- --broker-command "nanomq start" fuzz` ** Environment Details ** - NanoMQ version: NanoMQ Messaging Engine for Edge Computing & Messaging bus v0.19.5-2 (latest git) - Operating system and version: Garuda Linux with Linux 6.4.8-zen1-1-zen - Compiler and language used: GCC as built with [nanomq-git](https://aur.archlinux.org/packages/nanomq-git) - Fuzzing with the process described above **Additional context** If you run into problems with reproducing or using the fuzzer feel free to ask me for help and also if you have suggestions for improvements to the fuzzer. Also I'd be really interested in the fix and what caused it so it would be nice to know what caused this under what circumstances.(Also if you happen to stumble on other bugs with this)
[NNG]: reap woker reaps `nni_pipe` twice.
https://api.github.com/repos/nanomq/nanomq/issues/1411/comments
22
2023-08-07T13:42:25Z
2023-10-25T01:02:27Z
https://github.com/nanomq/nanomq/issues/1411
1,839,486,428
1,411
[ "emqx", "nanomq" ]
null
Introduce DCO checks into NanoMQ CI
https://api.github.com/repos/nanomq/nanomq/issues/1402/comments
1
2023-07-31T15:07:51Z
2023-08-01T04:06:14Z
https://github.com/nanomq/nanomq/issues/1402
1,829,417,945
1,402
[ "emqx", "nanomq" ]
File: [/docs/zh_CN/access-control/http.md](https://nanomq.io/docs/zh/latest/access-control/http.html) ![image](https://github.com/emqx/nanomq/assets/58539745/dcf8352e-68ae-4e6d-b316-ec37e9be09dd) password value is %P not %p ![image](https://github.com/emqx/nanomq/assets/58539745/da15e104-e3aa-4ce7-a132-39eeb92fd0f8)
There is an error in the auth configuration description
https://api.github.com/repos/nanomq/nanomq/issues/1400/comments
1
2023-07-30T14:51:55Z
2023-08-05T09:05:08Z
https://github.com/nanomq/nanomq/issues/1400
1,827,963,392
1,400
[ "emqx", "nanomq" ]
File: [/docs/zh_CN/README.md](https://nanomq.io/docs/zh/latest/) 原文:这些问题都对边缘消息总线提出了新的要挑战。 建议更改为:这些问题都对边缘消息总线提出了新的要求与挑战。
首页 NanoMQ 介绍语病
https://api.github.com/repos/nanomq/nanomq/issues/1390/comments
1
2023-07-20T03:00:39Z
2023-07-20T05:41:50Z
https://github.com/nanomq/nanomq/issues/1390
1,813,054,890
1,390
[ "emqx", "nanomq" ]
**Describe the bug** ``` ================================================================= ==65495==ERROR: LeakSanitizer: detected memory leaks Direct leak of 848 byte(s) in 1 object(s) allocated from: #0 0xffff9388e500 in malloc (/lib64/libasan.so.8+0xae500) #1 0xffff9356f794 in CxPlatAlloc /root/nanomq/nng/extern/msquic/src/platform/platform_posix.c:263 #2 0xffff9356d7a0 in CxPlatPoolAlloc /root/nanomq/nng/extern/msquic/src/inc/quic_platform_posix.h:531 #3 0xffff934fa914 in QuicStreamInitialize /root/nanomq/nng/extern/msquic/src/core/stream.c:35 #4 0xffff93511fe4 in MsQuicStreamOpen /root/nanomq/nng/extern/msquic/src/core/api.c:661 #5 0x5a6d6c in quic_pipe_open /root/nanomq/nng/src/supplemental/quic/quic_api.c:1398 #6 0x4e8b4c in quic_mqtt_stream_init /root/nanomq/nng/src/mqtt/protocol/mqtt/mqttv5_quic.c:1465 #7 0x5a1f38 in quic_connection_cb /root/nanomq/nng/src/supplemental/quic/quic_api.c:595 #8 0xffff9351cd00 in QuicConnIndicateEvent /root/nanomq/nng/extern/msquic/src/core/connection.c:749 #9 0xffff935376dc in QuicCryptoProcessTlsCompletion /root/nanomq/nng/extern/msquic/src/core/crypto.c:1643 #10 0xffff9353860c in QuicCryptoProcessDataComplete /root/nanomq/nng/extern/msquic/src/core/crypto.c:1691 #11 0xffff93538848 in QuicCryptoProcessData /root/nanomq/nng/extern/msquic/src/core/crypto.c:1845 #12 0xffff935398e8 in QuicCryptoProcessFrame /root/nanomq/nng/extern/msquic/src/core/crypto.c:1319 #13 0xffff93529d78 in QuicConnRecvFrames /root/nanomq/nng/extern/msquic/src/core/connection.c:4528 #14 0xffff9352c5ec in QuicConnRecvDatagramBatch /root/nanomq/nng/extern/msquic/src/core/connection.c:5454 #15 0xffff9352d7b4 in QuicConnRecvDatagrams /root/nanomq/nng/extern/msquic/src/core/connection.c:5633 #16 0xffff9352e160 in QuicConnFlushRecv /root/nanomq/nng/extern/msquic/src/core/connection.c:5784 #17 0xffff93532df4 in QuicConnDrainOperations /root/nanomq/nng/extern/msquic/src/core/connection.c:7442 #18 0xffff935089e8 in QuicWorkerProcessConnection /root/nanomq/nng/extern/msquic/src/core/worker.c:510 #19 0xffff93509004 in QuicWorkerLoop /root/nanomq/nng/extern/msquic/src/core/worker.c:667 #20 0xffff9356b0c4 in CxPlatRunExecutionContexts /root/nanomq/nng/extern/msquic/src/platform/platform_worker.c:369 #21 0xffff9356b834 in CxPlatWorkerThread /root/nanomq/nng/extern/msquic/src/platform/platform_worker.c:454 #22 0xffff933309a4 in start_thread (/lib64/libc.so.6+0x809a4) #23 0xffff9339bd18 in thread_start (/lib64/libc.so.6+0xebd18) Indirect leak of 4096 byte(s) in 1 object(s) allocated from: #0 0xffff9388e500 in malloc (/lib64/libasan.so.8+0xae500) #1 0xffff9356f794 in CxPlatAlloc /root/nanomq/nng/extern/msquic/src/platform/platform_posix.c:263 #2 0xffff9356d7a0 in CxPlatPoolAlloc /root/nanomq/nng/extern/msquic/src/inc/quic_platform_posix.h:531 #3 0xffff934faeec in QuicStreamInitialize /root/nanomq/nng/extern/msquic/src/core/stream.c:104 #4 0xffff93511fe4 in MsQuicStreamOpen /root/nanomq/nng/extern/msquic/src/core/api.c:661 #5 0x5a6d6c in quic_pipe_open /root/nanomq/nng/src/supplemental/quic/quic_api.c:1398 #6 0x4e8b4c in quic_mqtt_stream_init /root/nanomq/nng/src/mqtt/protocol/mqtt/mqttv5_quic.c:1465 #7 0x5a1f38 in quic_connection_cb /root/nanomq/nng/src/supplemental/quic/quic_api.c:595 #8 0xffff9351cd00 in QuicConnIndicateEvent /root/nanomq/nng/extern/msquic/src/core/connection.c:749 #9 0xffff935376dc in QuicCryptoProcessTlsCompletion /root/nanomq/nng/extern/msquic/src/core/crypto.c:1643 #10 0xffff9353860c in QuicCryptoProcessDataComplete /root/nanomq/nng/extern/msquic/src/core/crypto.c:1691 #11 0xffff93538848 in QuicCryptoProcessData /root/nanomq/nng/extern/msquic/src/core/crypto.c:1845 #12 0xffff935398e8 in QuicCryptoProcessFrame /root/nanomq/nng/extern/msquic/src/core/crypto.c:1319 #13 0xffff93529d78 in QuicConnRecvFrames /root/nanomq/nng/extern/msquic/src/core/connection.c:4528 #14 0xffff9352c5ec in QuicConnRecvDatagramBatch /root/nanomq/nng/extern/msquic/src/core/connection.c:5454 #15 0xffff9352d7b4 in QuicConnRecvDatagrams /root/nanomq/nng/extern/msquic/src/core/connection.c:5633 #16 0xffff9352e160 in QuicConnFlushRecv /root/nanomq/nng/extern/msquic/src/core/connection.c:5784 #17 0xffff93532df4 in QuicConnDrainOperations /root/nanomq/nng/extern/msquic/src/core/connection.c:7442 #18 0xffff935089e8 in QuicWorkerProcessConnection /root/nanomq/nng/extern/msquic/src/core/worker.c:510 #19 0xffff93509004 in QuicWorkerLoop /root/nanomq/nng/extern/msquic/src/core/worker.c:667 #20 0xffff9356b0c4 in CxPlatRunExecutionContexts /root/nanomq/nng/extern/msquic/src/platform/platform_worker.c:369 #21 0xffff9356b834 in CxPlatWorkerThread /root/nanomq/nng/extern/msquic/src/platform/platform_worker.c:454 #22 0xffff933309a4 in start_thread (/lib64/libc.so.6+0x809a4) #23 0xffff9339bd18 in thread_start (/lib64/libc.so.6+0xebd18) Indirect leak of 784 byte(s) in 1 object(s) allocated from: #0 0xffff9388e500 in malloc (/lib64/libasan.so.8+0xae500) #1 0x4cd0d8 in nni_alloc /root/nanomq/nng/src/platform/posix/posix_alloc.c:20 #2 0x498b7c in nng_alloc /root/nanomq/nng/src/nng.c:60 #3 0x5a6cc0 in quic_pipe_open /root/nanomq/nng/src/supplemental/quic/quic_api.c:1389 #4 0x4e8b4c in quic_mqtt_stream_init /root/nanomq/nng/src/mqtt/protocol/mqtt/mqttv5_quic.c:1465 #5 0x5a1f38 in quic_connection_cb /root/nanomq/nng/src/supplemental/quic/quic_api.c:595 #6 0xffff9351cd00 in QuicConnIndicateEvent /root/nanomq/nng/extern/msquic/src/core/connection.c:749 #7 0xffff935376dc in QuicCryptoProcessTlsCompletion /root/nanomq/nng/extern/msquic/src/core/crypto.c:1643 #8 0xffff9353860c in QuicCryptoProcessDataComplete /root/nanomq/nng/extern/msquic/src/core/crypto.c:1691 #9 0xffff93538848 in QuicCryptoProcessData /root/nanomq/nng/extern/msquic/src/core/crypto.c:1845 #10 0xffff935398e8 in QuicCryptoProcessFrame /root/nanomq/nng/extern/msquic/src/core/crypto.c:1319 #11 0xffff93529d78 in QuicConnRecvFrames /root/nanomq/nng/extern/msquic/src/core/connection.c:4528 #12 0xffff9352c5ec in QuicConnRecvDatagramBatch /root/nanomq/nng/extern/msquic/src/core/connection.c:5454 #13 0xffff9352d7b4 in QuicConnRecvDatagrams /root/nanomq/nng/extern/msquic/src/core/connection.c:5633 #14 0xffff9352e160 in QuicConnFlushRecv /root/nanomq/nng/extern/msquic/src/core/connection.c:5784 #15 0xffff93532df4 in QuicConnDrainOperations /root/nanomq/nng/extern/msquic/src/core/connection.c:7442 #16 0xffff935089e8 in QuicWorkerProcessConnection /root/nanomq/nng/extern/msquic/src/core/worker.c:510 #17 0xffff93509004 in QuicWorkerLoop /root/nanomq/nng/extern/msquic/src/core/worker.c:667 #18 0xffff9356b0c4 in CxPlatRunExecutionContexts /root/nanomq/nng/extern/msquic/src/platform/platform_worker.c:369 #19 0xffff9356b834 in CxPlatWorkerThread /root/nanomq/nng/extern/msquic/src/platform/platform_worker.c:454 #20 0xffff933309a4 in start_thread (/lib64/libc.so.6+0x809a4) #21 0xffff9339bd18 in thread_start (/lib64/libc.so.6+0xebd18) Indirect leak of 128 byte(s) in 1 object(s) allocated from: #0 0xffff9388e500 in malloc (/lib64/libasan.so.8+0xae500) #1 0x4cd0d8 in nni_alloc /root/nanomq/nng/src/platform/posix/posix_alloc.c:20 #2 0x4b3d0c in nni_lmq_resize /root/nanomq/nng/src/core/lmq.c:132 #3 0x4b344c in nni_lmq_init /root/nanomq/nng/src/core/lmq.c:33 #4 0x5a03e8 in quic_strm_init /root/nanomq/nng/src/supplemental/quic/quic_api.c:355 #5 0x5a6ce4 in quic_pipe_open /root/nanomq/nng/src/supplemental/quic/quic_api.c:1392 #6 0x4e8b4c in quic_mqtt_stream_init /root/nanomq/nng/src/mqtt/protocol/mqtt/mqttv5_quic.c:1465 #7 0x5a1f38 in quic_connection_cb /root/nanomq/nng/src/supplemental/quic/quic_api.c:595 #8 0xffff9351cd00 in QuicConnIndicateEvent /root/nanomq/nng/extern/msquic/src/core/connection.c:749 #9 0xffff935376dc in QuicCryptoProcessTlsCompletion /root/nanomq/nng/extern/msquic/src/core/crypto.c:1643 #10 0xffff9353860c in QuicCryptoProcessDataComplete /root/nanomq/nng/extern/msquic/src/core/crypto.c:1691 #11 0xffff93538848 in QuicCryptoProcessData /root/nanomq/nng/extern/msquic/src/core/crypto.c:1845 #12 0xffff935398e8 in QuicCryptoProcessFrame /root/nanomq/nng/extern/msquic/src/core/crypto.c:1319 #13 0xffff93529d78 in QuicConnRecvFrames /root/nanomq/nng/extern/msquic/src/core/connection.c:4528 #14 0xffff9352c5ec in QuicConnRecvDatagramBatch /root/nanomq/nng/extern/msquic/src/core/connection.c:5454 #15 0xffff9352d7b4 in QuicConnRecvDatagrams /root/nanomq/nng/extern/msquic/src/core/connection.c:5633 #16 0xffff9352e160 in QuicConnFlushRecv /root/nanomq/nng/extern/msquic/src/core/connection.c:5784 #17 0xffff93532df4 in QuicConnDrainOperations /root/nanomq/nng/extern/msquic/src/core/connection.c:7442 #18 0xffff935089e8 in QuicWorkerProcessConnection /root/nanomq/nng/extern/msquic/src/core/worker.c:510 #19 0xffff93509004 in QuicWorkerLoop /root/nanomq/nng/extern/msquic/src/core/worker.c:667 #20 0xffff9356b0c4 in CxPlatRunExecutionContexts /root/nanomq/nng/extern/msquic/src/platform/platform_worker.c:369 #21 0xffff9356b834 in CxPlatWorkerThread /root/nanomq/nng/extern/msquic/src/platform/platform_worker.c:454 #22 0xffff933309a4 in start_thread (/lib64/libc.so.6+0x809a4) #23 0xffff9339bd18 in thread_start (/lib64/libc.so.6+0xebd18) Indirect leak of 128 byte(s) in 1 object(s) allocated from: #0 0xffff9388e500 in malloc (/lib64/libasan.so.8+0xae500) #1 0x4cd0d8 in nni_alloc /root/nanomq/nng/src/platform/posix/posix_alloc.c:20 #2 0x4b3d0c in nni_lmq_resize /root/nanomq/nng/src/core/lmq.c:132 #3 0x4b344c in nni_lmq_init /root/nanomq/nng/src/core/lmq.c:33 #4 0x5a03f8 in quic_strm_init /root/nanomq/nng/src/supplemental/quic/quic_api.c:356 #5 0x5a6ce4 in quic_pipe_open /root/nanomq/nng/src/supplemental/quic/quic_api.c:1392 #6 0x4e8b4c in quic_mqtt_stream_init /root/nanomq/nng/src/mqtt/protocol/mqtt/mqttv5_quic.c:1465 #7 0x5a1f38 in quic_connection_cb /root/nanomq/nng/src/supplemental/quic/quic_api.c:595 #8 0xffff9351cd00 in QuicConnIndicateEvent /root/nanomq/nng/extern/msquic/src/core/connection.c:749 #9 0xffff935376dc in QuicCryptoProcessTlsCompletion /root/nanomq/nng/extern/msquic/src/core/crypto.c:1643 #10 0xffff9353860c in QuicCryptoProcessDataComplete /root/nanomq/nng/extern/msquic/src/core/crypto.c:1691 #11 0xffff93538848 in QuicCryptoProcessData /root/nanomq/nng/extern/msquic/src/core/crypto.c:1845 #12 0xffff935398e8 in QuicCryptoProcessFrame /root/nanomq/nng/extern/msquic/src/core/crypto.c:1319 #13 0xffff93529d78 in QuicConnRecvFrames /root/nanomq/nng/extern/msquic/src/core/connection.c:4528 #14 0xffff9352c5ec in QuicConnRecvDatagramBatch /root/nanomq/nng/extern/msquic/src/core/connection.c:5454 #15 0xffff9352d7b4 in QuicConnRecvDatagrams /root/nanomq/nng/extern/msquic/src/core/connection.c:5633 #16 0xffff9352e160 in QuicConnFlushRecv /root/nanomq/nng/extern/msquic/src/core/connection.c:5784 #17 0xffff93532df4 in QuicConnDrainOperations /root/nanomq/nng/extern/msquic/src/core/connection.c:7442 #18 0xffff935089e8 in QuicWorkerProcessConnection /root/nanomq/nng/extern/msquic/src/core/worker.c:510 #19 0xffff93509004 in QuicWorkerLoop /root/nanomq/nng/extern/msquic/src/core/worker.c:667 #20 0xffff9356b0c4 in CxPlatRunExecutionContexts /root/nanomq/nng/extern/msquic/src/platform/platform_worker.c:369 #21 0xffff9356b834 in CxPlatWorkerThread /root/nanomq/nng/extern/msquic/src/platform/platform_worker.c:454 #22 0xffff933309a4 in start_thread (/lib64/libc.so.6+0x809a4) #23 0xffff9339bd18 in thread_start (/lib64/libc.so.6+0xebd18) Indirect leak of 56 byte(s) in 1 object(s) allocated from: #0 0xffff9388e500 in malloc (/lib64/libasan.so.8+0xae500) #1 0xffff9356f794 in CxPlatAlloc /root/nanomq/nng/extern/msquic/src/platform/platform_posix.c:263 #2 0xffff9356d7a0 in CxPlatPoolAlloc /root/nanomq/nng/extern/msquic/src/inc/quic_platform_posix.h:531 #3 0xffff9354e71c in QuicOperationAlloc /root/nanomq/nng/extern/msquic/src/core/operation.c:69 #4 0xffff93513334 in MsQuicStreamReceiveSetEnabled /root/nanomq/nng/extern/msquic/src/core/api.c:1187 #5 0x5a4c20 in quic_pipe_recv_start /root/nanomq/nng/src/supplemental/quic/quic_api.c:1061 #6 0x5a6a3c in quic_pipe_recv /root/nanomq/nng/src/supplemental/quic/quic_api.c:1344 #7 0x4e95b8 in quic_mqtt_stream_start /root/nanomq/nng/src/mqtt/protocol/mqtt/mqttv5_quic.c:1596 #8 0x5a1f94 in quic_connection_cb /root/nanomq/nng/src/supplemental/quic/quic_api.c:598 #9 0xffff9351cd00 in QuicConnIndicateEvent /root/nanomq/nng/extern/msquic/src/core/connection.c:749 #10 0xffff935376dc in QuicCryptoProcessTlsCompletion /root/nanomq/nng/extern/msquic/src/core/crypto.c:1643 #11 0xffff9353860c in QuicCryptoProcessDataComplete /root/nanomq/nng/extern/msquic/src/core/crypto.c:1691 #12 0xffff93538848 in QuicCryptoProcessData /root/nanomq/nng/extern/msquic/src/core/crypto.c:1845 #13 0xffff935398e8 in QuicCryptoProcessFrame /root/nanomq/nng/extern/msquic/src/core/crypto.c:1319 #14 0xffff93529d78 in QuicConnRecvFrames /root/nanomq/nng/extern/msquic/src/core/connection.c:4528 #15 0xffff9352c5ec in QuicConnRecvDatagramBatch /root/nanomq/nng/extern/msquic/src/core/connection.c:5454 #16 0xffff9352d7b4 in QuicConnRecvDatagrams /root/nanomq/nng/extern/msquic/src/core/connection.c:5633 #17 0xffff9352e160 in QuicConnFlushRecv /root/nanomq/nng/extern/msquic/src/core/connection.c:5784 #18 0xffff93532df4 in QuicConnDrainOperations /root/nanomq/nng/extern/msquic/src/core/connection.c:7442 #19 0xffff935089e8 in QuicWorkerProcessConnection /root/nanomq/nng/extern/msquic/src/core/worker.c:510 #20 0xffff93509004 in QuicWorkerLoop /root/nanomq/nng/extern/msquic/src/core/worker.c:667 #21 0xffff9356b0c4 in CxPlatRunExecutionContexts /root/nanomq/nng/extern/msquic/src/platform/platform_worker.c:369 #22 0xffff9356b834 in CxPlatWorkerThread /root/nanomq/nng/extern/msquic/src/platform/platform_worker.c:454 #23 0xffff933309a4 in start_thread (/lib64/libc.so.6+0x809a4) #24 0xffff9339bd18 in thread_start (/lib64/libc.so.6+0xebd18) Indirect leak of 56 byte(s) in 1 object(s) allocated from: #0 0xffff9388e500 in malloc (/lib64/libasan.so.8+0xae500) #1 0xffff9356f794 in CxPlatAlloc /root/nanomq/nng/extern/msquic/src/platform/platform_posix.c:263 #2 0xffff9356d7a0 in CxPlatPoolAlloc /root/nanomq/nng/extern/msquic/src/inc/quic_platform_posix.h:531 #3 0xffff9354e684 in QuicOperationAlloc /root/nanomq/nng/extern/msquic/src/core/operation.c:59 #4 0xffff93513334 in MsQuicStreamReceiveSetEnabled /root/nanomq/nng/extern/msquic/src/core/api.c:1187 #5 0x5a4c20 in quic_pipe_recv_start /root/nanomq/nng/src/supplemental/quic/quic_api.c:1061 #6 0x5a6a3c in quic_pipe_recv /root/nanomq/nng/src/supplemental/quic/quic_api.c:1344 #7 0x4e95b8 in quic_mqtt_stream_start /root/nanomq/nng/src/mqtt/protocol/mqtt/mqttv5_quic.c:1596 #8 0x5a1f94 in quic_connection_cb /root/nanomq/nng/src/supplemental/quic/quic_api.c:598 #9 0xffff9351cd00 in QuicConnIndicateEvent /root/nanomq/nng/extern/msquic/src/core/connection.c:749 #10 0xffff935376dc in QuicCryptoProcessTlsCompletion /root/nanomq/nng/extern/msquic/src/core/crypto.c:1643 #11 0xffff9353860c in QuicCryptoProcessDataComplete /root/nanomq/nng/extern/msquic/src/core/crypto.c:1691 #12 0xffff93538848 in QuicCryptoProcessData /root/nanomq/nng/extern/msquic/src/core/crypto.c:1845 #13 0xffff935398e8 in QuicCryptoProcessFrame /root/nanomq/nng/extern/msquic/src/core/crypto.c:1319 #14 0xffff93529d78 in QuicConnRecvFrames /root/nanomq/nng/extern/msquic/src/core/connection.c:4528 #15 0xffff9352c5ec in QuicConnRecvDatagramBatch /root/nanomq/nng/extern/msquic/src/core/connection.c:5454 #16 0xffff9352d7b4 in QuicConnRecvDatagrams /root/nanomq/nng/extern/msquic/src/core/connection.c:5633 #17 0xffff9352e160 in QuicConnFlushRecv /root/nanomq/nng/extern/msquic/src/core/connection.c:5784 #18 0xffff93532df4 in QuicConnDrainOperations /root/nanomq/nng/extern/msquic/src/core/connection.c:7442 #19 0xffff935089e8 in QuicWorkerProcessConnection /root/nanomq/nng/extern/msquic/src/core/worker.c:510 #20 0xffff93509004 in QuicWorkerLoop /root/nanomq/nng/extern/msquic/src/core/worker.c:667 #21 0xffff9356b0c4 in CxPlatRunExecutionContexts /root/nanomq/nng/extern/msquic/src/platform/platform_worker.c:369 #22 0xffff9356b834 in CxPlatWorkerThread /root/nanomq/nng/extern/msquic/src/platform/platform_worker.c:454 #23 0xffff933309a4 in start_thread (/lib64/libc.so.6+0x809a4) #24 0xffff9339bd18 in thread_start (/lib64/libc.so.6+0xebd18) Indirect leak of 48 byte(s) in 1 object(s) allocated from: #0 0xffff9388d538 in __interceptor_realloc.part.0 (/lib64/libasan.so.8+0xad538) #1 0x5a0fe8 in quic_strm_cb /root/nanomq/nng/src/supplemental/quic/quic_api.c:472 #2 0xffff934fb664 in QuicStreamIndicateEvent /root/nanomq/nng/extern/msquic/src/core/stream.c:438 #3 0xffff934feac8 in QuicStreamRecvFlush /root/nanomq/nng/extern/msquic/src/core/stream_recv.c:867 #4 0xffff93532e2c in QuicConnDrainOperations /root/nanomq/nng/extern/msquic/src/core/connection.c:7459 #5 0xffff935089e8 in QuicWorkerProcessConnection /root/nanomq/nng/extern/msquic/src/core/worker.c:510 #6 0xffff93509004 in QuicWorkerLoop /root/nanomq/nng/extern/msquic/src/core/worker.c:667 #7 0xffff9356b0c4 in CxPlatRunExecutionContexts /root/nanomq/nng/extern/msquic/src/platform/platform_worker.c:369 #8 0xffff9356b834 in CxPlatWorkerThread /root/nanomq/nng/extern/msquic/src/platform/platform_worker.c:454 #9 0xffff933309a4 in start_thread (/lib64/libc.so.6+0x809a4) #10 0xffff9339bd18 in thread_start (/lib64/libc.so.6+0xebd18) SUMMARY: AddressSanitizer: 6144 byte(s) leaked in 8 allocation(s). ``` **Expected behavior** No memory leakages. **To Reproduce** ``` Start quic bridge. Add subscription for bridge. curl --location 'http://127.0.0.1:8081/api/v4/bridges/sub/emqx' \ --header 'Content-Type: application/json' \ --header 'Authorization: Basic YWRtaW46cHVibGlj' \ --data '{ "data": { "subscription": [ { "topic": "test", "qos": 0 }, { "topic": "cmd/topic5", "qos": 2 } ], "sub_properties": { "identifier": 1, "user_properties": [ { "key": "key1", "value": "value1" }, { "key": "key2", "value": "value2" } ] } } } ' Unsubcribe those topic. curl --location 'http://127.0.0.1:8081/api/v4/bridges/unsub/emqx' \ --header 'Content-Type: application/json' \ --header 'Authorization: Basic YWRtaW46cHVibGlj' \ --data '{ "data": { "unsubscription": [ { "topic": "test" }, { "topic": "cmd/topic2" } ], "unsub_properties": { "user_properties": [ { "key": "key1", "value": "value1" }, { "key": "key2", "value": "value2" } ] } } } ' ``` ** Environment Details ** - NanoMQ version. Latest - Operating system and version - Compiler and language used - 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.
Memory leak in nanomq.
https://api.github.com/repos/nanomq/nanomq/issues/1378/comments
3
2023-07-12T10:08:37Z
2023-07-17T08:51:30Z
https://github.com/nanomq/nanomq/issues/1378
1,800,634,956
1,378
[ "emqx", "nanomq" ]
**Describe the bug** Data race in qpipe(qstrm) ``` panic: pthread_mutex_lock: Invalid argument This message is indicative of a BUG. Report this at https://github.com/emqx/nanomq /root/nanomq/build/nanomq/nanomq(nni_show_backtrace+0xa8) [0x4b6e84] /root/nanomq/build/nanomq/nanomq(nni_panic+0x250) [0x4b71c0] /root/nanomq/build/nanomq/nanomq() [0x4cf0a4] /root/nanomq/build/nanomq/nanomq(nni_plat_mtx_lock+0x14) [0x4cf27c] /root/nanomq/build/nanomq/nanomq(nni_mtx_lock+0x14) [0x4c56cc] /root/nanomq/build/nanomq/nanomq(quic_pipe_recv+0xc0) [0x5a407c] /root/nanomq/build/nanomq/nanomq() [0x4e40cc] /root/nanomq/build/nanomq/nanomq(nni_task_exec+0x158) [0x4c4bfc] /root/nanomq/build/nanomq/nanomq() [0x4a63c8] /root/nanomq/build/nanomq/nanomq(nni_aio_finish_sync+0x2c) [0x4a6448] /root/nanomq/build/nanomq/nanomq() [0x5a3ccc] /root/nanomq/build/nanomq/nanomq() [0x4c430c] /root/nanomq/build/nanomq/nanomq() [0x4c5970] /root/nanomq/build/nanomq/nanomq() [0x4cf87c] /lib64/libc.so.6(+0x809a8) [0xffff83f409a8] /lib64/libc.so.6(+0xebd1c) [0xffff83fabd1c] Thread 8 "nng:task" received signal SIGABRT, Aborted. [Switching to Thread 0xffff7c2ef0a0 (LWP 57931)] 0x0000ffff83f42658 in __pthread_kill_implementation () from /lib64/libc.so.6 Missing separate debuginfos, use: dnf debuginfo-install glibc-2.35-17.fc36.aarch64 libasan-12.2.1-2.fc36.aarch64 libatomic-12.2.1-2.fc36.aarch64 libgcc-12.2.1-2.fc36.aarch64 libstdc++-12.2.1-2.fc36.aarch64 systemd-libs-250.10-2.fc36.aarch64 (gdb) bt #0 0x0000ffff83f42658 in __pthread_kill_implementation () from /lib64/libc.so.6 #1 0x0000ffff83efab00 [PAC] in raise () from /lib64/libc.so.6 #2 0x0000ffff83ee70f8 [PAC] in abort () from /lib64/libc.so.6 #3 0x00000000004ccf5c [PAC] in nni_plat_abort () at /root/nanomq/nng/src/platform/posix/posix_debug.c:23 #4 0x00000000004b71c4 in nni_panic (fmt=0x7390e0 "pthread_mutex_lock: %s") at /root/nanomq/nng/src/core/panic.c:66 #5 0x00000000004cf0a4 in nni_pthread_mutex_lock (m=0xffff72b6f488) at /root/nanomq/nng/src/platform/posix/posix_thread.c:85 #6 0x00000000004cf27c in nni_plat_mtx_lock (mtx=0xffff72b6f488) at /root/nanomq/nng/src/platform/posix/posix_thread.c:146 #7 0x00000000004c56cc in nni_mtx_lock (mtx=0xffff72b6f488) at /root/nanomq/nng/src/core/thread.c:27 #8 0x00000000005a407c in quic_pipe_recv (qpipe=0xffff72b6f480, raio=0xffff7572b308) at /root/nanomq/nng/src/supplemental/quic/quic_api.c:1316 #9 0x00000000004e40cc in mqtt_quic_recv_cb (arg=0xffff7572b080) at /root/nanomq/nng/src/mqtt/protocol/mqtt/mqttv5_quic.c:937 #10 0x00000000004c4bfc in nni_task_exec (task=0xffff7572b328) at /root/nanomq/nng/src/core/taskq.c:144 #11 0x00000000004a63c8 in nni_aio_finish_impl (aio=0xffff7572b308, rv=0, count=0, msg=0x0, sync=true) at /root/nanomq/nng/src/core/aio.c:454 #12 0x00000000004a6448 in nni_aio_finish_sync (aio=0xffff7572b308, result=0, count=0) at /root/nanomq/nng/src/core/aio.c:469 #13 0x00000000005a3ccc in quic_pipe_recv_cb (arg=0xffff72b6f480) at /root/nanomq/nng/src/supplemental/quic/quic_api.c:1236 #14 0x00000000004c430c in nni_taskq_thread (self=0xffff80703128) at /root/nanomq/nng/src/core/taskq.c:50 #15 0x00000000004c5970 in nni_thr_wrap (arg=0xffff80703130) at /root/nanomq/nng/src/core/thread.c:94 #16 0x00000000004cf87c in nni_plat_thr_main (arg=0xffff80703130) at /root/nanomq/nng/src/platform/posix/posix_thread.c:266 #17 0x0000ffff83f409a8 in start_thread () from /lib64/libc.so.6 #18 0x0000ffff83fabd1c [PAC] in thread_start () from /lib64/libc.so.6 ``` **Expected behavior** **Actual Behavior** **To Reproduce** ``` ./nanomq_cli/nanomq_cli bench pub -t topic1/a -L 100000 -p 1883 -h localhost -i 10 -I 10 -s 20 -q 1 -k 300 ``` ** Environment Details ** - NanoMQ version - Operating system and version - Compiler and language used - 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.
Data race in qpipe(qstrm)
https://api.github.com/repos/nanomq/nanomq/issues/1369/comments
1
2023-07-07T10:55:54Z
2023-07-12T10:09:43Z
https://github.com/nanomq/nanomq/issues/1369
1,793,316,936
1,369
[ "emqx", "nanomq" ]
**Describe the bug** ``` ==44220==ERROR: LeakSanitizer: detected memory leaks Direct leak of 409600 byte(s) in 200 object(s) allocated from: #0 0xffff8064e500 in malloc (/lib64/libasan.so.8+0xae500) #1 0x4abd74 in nni_alloc /root/nanomq/nng/src/platform/posix/posix_alloc.c:20 #2 0x477818 in nng_alloc /root/nanomq/nng/src/nng.c:60 #3 0x452658 in pub_cb /root/nanomq/nanomq_cli/bench.c:216 #4 0x454db4 in nnb_publish /root/nanomq/nanomq_cli/bench.c:526 #5 0x45501c in bench_start /root/nanomq/nanomq_cli/bench.c:558 #6 0x45e35c in main /root/nanomq/nanomq_cli/main.c:106 #7 0xffff800973c4 in __libc_start_call_main (/lib64/libc.so.6+0x273c4) #8 0xffff8009749c in __libc_start_main_alias_2 (/lib64/libc.so.6+0x2749c) #9 0x45126c in _start (/root/nanomq/build/nanomq_cli/nanomq_cli+0x45126c) SUMMARY: AddressSanitizer: 409600 byte(s) leaked in 200 allocation(s). ``` **To Reproduce** Run `./nanomq_cli/nanomq_cli bench pub -h 127.0.0.1 -p 1883 -q 2 -t topic1/a -s 2048` Then stopping mqtt broker. The `nanomq_cli bench` tool was stopped because there were no active connections. Then memory leakage happened. **Environment Details** - NanoMQ version - Operating system and version - Compiler and language used - testing scenario **Client SDK** **Additional context**
Memory leakages in nanomq_cli bench tool
https://api.github.com/repos/nanomq/nanomq/issues/1346/comments
1
2023-07-05T04:08:12Z
2023-09-27T10:27:05Z
https://github.com/nanomq/nanomq/issues/1346
1,788,724,585
1,346
[ "emqx", "nanomq" ]
**Describe the bug** ``` ==43759==ERROR: AddressSanitizer: heap-use-after-free on address 0xffff890578e0 at pc 0x0000004b4678 bp 0xffff97dae560 sp 0xffff97dae578 READ of size 4 at 0xffff890578e0 thread T11 #0 0x4b4674 in nni_msg_get_type /root/nanomq/nng/src/core/message.c:752 #1 0x4a3f94 in nng_msg_get_type /root/nanomq/nng/src/nng.c:2259 #2 0x458e98 in quic_ack_cb /root/nanomq/nanomq/bridge.c:675 #3 0x4c407c in nni_taskq_thread /root/nanomq/nng/src/core/taskq.c:50 #4 0x4c56e0 in nni_thr_wrap /root/nanomq/nng/src/core/thread.c:94 #5 0x4cf5ec in nni_plat_thr_main /root/nanomq/nng/src/platform/posix/posix_thread.c:266 #6 0xffffa19c09a4 in start_thread (/lib64/libc.so.6+0x809a4) #7 0xffffa1a2bd18 in thread_start (/lib64/libc.so.6+0xebd18) 0xffff890578e0 is located 0 bytes inside of 168-byte region [0xffff890578e0,0xffff89057988) freed by thread T6 here: #0 0xffffa1f1d348 in __interceptor_free.part.0 (/lib64/libasan.so.8+0xad348) #1 0x4ca950 in nni_free /root/nanomq/nng/src/platform/posix/posix_alloc.c:33 #2 0x4b3320 in nni_msg_free /root/nanomq/nng/src/core/message.c:465 #3 0x49f4f8 in nng_msg_free /root/nanomq/nng/src/nng.c:1524 #4 0x4599d4 in quic_ack_cb /root/nanomq/nanomq/bridge.c:739 #5 0x4c407c in nni_taskq_thread /root/nanomq/nng/src/core/taskq.c:50 #6 0x4c56e0 in nni_thr_wrap /root/nanomq/nng/src/core/thread.c:94 #7 0x4cf5ec in nni_plat_thr_main /root/nanomq/nng/src/platform/posix/posix_thread.c:266 #8 0xffffa19c09a4 in start_thread (/lib64/libc.so.6+0x809a4) #9 0xffffa1a2bd18 in thread_start (/lib64/libc.so.6+0xebd18) previously allocated by thread T6 here: #0 0xffffa1f1df28 in calloc (/lib64/libasan.so.8+0xadf28) #1 0x4ca928 in nni_zalloc /root/nanomq/nng/src/platform/posix/posix_alloc.c:26 #2 0x4b2dc0 in nni_msg_alloc /root/nanomq/nng/src/core/message.c:387 #3 0x49f4b8 in nng_msg_alloc /root/nanomq/nng/src/nng.c:1512 #4 0x5a291c in quic_pipe_recv_cb /root/nanomq/nng/src/supplemental/quic/quic_api.c:1162 #5 0x4c407c in nni_taskq_thread /root/nanomq/nng/src/core/taskq.c:50 #6 0x4c56e0 in nni_thr_wrap /root/nanomq/nng/src/core/thread.c:94 #7 0x4cf5ec in nni_plat_thr_main /root/nanomq/nng/src/platform/posix/posix_thread.c:266 #8 0xffffa19c09a4 in start_thread (/lib64/libc.so.6+0x809a4) #9 0xffffa1a2bd18 in thread_start (/lib64/libc.so.6+0xebd18) Thread T11 created by T0 here: #0 0xffffa1ebacdc in __interceptor_pthread_create (/lib64/libasan.so.8+0x4acdc) #1 0x4cf6e0 in nni_plat_thr_init /root/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x4c59ec in nni_thr_init /root/nanomq/nng/src/core/thread.c:121 #3 0x4c43e4 in nni_taskq_init /root/nanomq/nng/src/core/taskq.c:95 #4 0x4c5368 in nni_taskq_sys_init /root/nanomq/nng/src/core/taskq.c:294 #5 0x4ae094 in nni_init_helper /root/nanomq/nng/src/core/init.c:35 #6 0x4cfa70 in nni_plat_init /root/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x4ae148 in nni_init /root/nanomq/nng/src/core/init.c:58 #8 0x51a944 in nng_mtx_alloc /root/nanomq/nng/src/supplemental/util/platform.c:93 #9 0x56e248 in conf_bridge_parse_ver2 /root/nanomq/nng/src/supplemental/nanolib/conf_ver2.c:929 #10 0x56f7ec in conf_parse_ver2 /root/nanomq/nng/src/supplemental/nanolib/conf_ver2.c:1235 #11 0x495ae0 in broker_start /root/nanomq/nanomq/apps/broker.c:1573 #12 0x454f50 in main /root/nanomq/nanomq/nanomq.c:142 #13 0xffffa19673c4 in __libc_start_call_main (/lib64/libc.so.6+0x273c4) #14 0xffffa196749c in __libc_start_main_alias_2 (/lib64/libc.so.6+0x2749c) #15 0x45326c in _start (/root/nanomq/build/nanomq/nanomq+0x45326c) Thread T6 created by T0 here: #0 0xffffa1ebacdc in __interceptor_pthread_create (/lib64/libasan.so.8+0x4acdc) #1 0x4cf6e0 in nni_plat_thr_init /root/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x4c59ec in nni_thr_init /root/nanomq/nng/src/core/thread.c:121 #3 0x4c43e4 in nni_taskq_init /root/nanomq/nng/src/core/taskq.c:95 #4 0x4c5368 in nni_taskq_sys_init /root/nanomq/nng/src/core/taskq.c:294 #5 0x4ae094 in nni_init_helper /root/nanomq/nng/src/core/init.c:35 #6 0x4cfa70 in nni_plat_init /root/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x4ae148 in nni_init /root/nanomq/nng/src/core/init.c:58 #8 0x51a944 in nng_mtx_alloc /root/nanomq/nng/src/supplemental/util/platform.c:93 #9 0x56e248 in conf_bridge_parse_ver2 /root/nanomq/nng/src/supplemental/nanolib/conf_ver2.c:929 #10 0x56f7ec in conf_parse_ver2 /root/nanomq/nng/src/supplemental/nanolib/conf_ver2.c:1235 #11 0x495ae0 in broker_start /root/nanomq/nanomq/apps/broker.c:1573 #12 0x454f50 in main /root/nanomq/nanomq/nanomq.c:142 #13 0xffffa19673c4 in __libc_start_call_main (/lib64/libc.so.6+0x273c4) #14 0xffffa196749c in __libc_start_main_alias_2 (/lib64/libc.so.6+0x2749c) #15 0x45326c in _start (/root/nanomq/build/nanomq/nanomq+0x45326c) SUMMARY: AddressSanitizer: heap-use-after-free /root/nanomq/nng/src/core/message.c:752 in nni_msg_get_type Shadow bytes around the buggy address: 0x200ff120aec0: fa fa fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x200ff120aed0: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa 0x200ff120aee0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x200ff120aef0: fd fd fd fd fd fa fa fa fa fa fa fa fa fa fd fd 0x200ff120af00: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd =>0x200ff120af10: fd fd fd fa fa fa fa fa fa fa fa fa[fd]fd fd fd 0x200ff120af20: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x200ff120af30: fd fa fa fa fa fa fa fa fa fa fd fd fd fd fd fd 0x200ff120af40: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fa 0x200ff120af50: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd 0x200ff120af60: fd fd fd fd fd fd fd fd fd fd fd fd fd 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 ==43759==ABORTING ``` **To Reproduce** ``` ./nanomq/nanomq start --conf ../etc/nanomq.conf ./nanomq_cli/nanomq_cli bench pub -h 127.0.0.1 -p 1883 -q 2 -t topic1/a -s 2048 ./nanomq_cli/nanomq_cli sub -h "432121.xyz" -p 1883 -t "topic1/a" -q 2 ``` configuration of quic bridge ``` bridges.mqtt.emqx { server = "mqtt-quic://432121.xyz:14567" proto_ver = 5 username = alvin password = alvin123 clean_start = true keepalive = 60s forwards = ["topic1/#", "topic2/#"] quic_keepalive = 10s quic_idle_timeout = 0s quic_discon_timeout = 20s quic_handshake_timeout = 60s hybrid_bridging = false quic_multi_stream = false quic_qos_priority=false quic_0rtt=true qinitial_rtt_ms=700s subscription = [ { topic = "cmd/topic1" qos = 1 }, { topic = "cmd/topic2" qos = 2 } ] parallel = 2 max_send_queue_len = 1024 max_recv_queue_len = 1024 } ``` ** Environment Details ** - NanoMQ version - Operating system and version - Compiler and language used - testing scenario **Client SDK** **Additional context** Add any other context about the problem here.
Heap use after free in quic bridge
https://api.github.com/repos/nanomq/nanomq/issues/1345/comments
0
2023-07-05T03:57:22Z
2023-07-08T03:03:08Z
https://github.com/nanomq/nanomq/issues/1345
1,788,717,348
1,345
[ "emqx", "nanomq" ]
**Describe the bug** nanomq will crash when using http api with an unauthorized username and password. **To Reproduce** start nanomq with --http; use cmd “ curl -i --basic -u admin:public2 -X GET 'http://localhost:8081/api/v4/brokers' ”; As the default username and password are "admin:public" , this will cause a crash. ** Environment Details ** - NanoMQ latest version - Ubuntu 22.04 - gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04.1)
nanomq crashes when unauthorized user using http api
https://api.github.com/repos/nanomq/nanomq/issues/1339/comments
0
2023-07-04T08:57:35Z
2023-07-05T10:31:04Z
https://github.com/nanomq/nanomq/issues/1339
1,787,479,438
1,339
[ "emqx", "nanomq" ]
Currently, the style of NanoMQ configuration is in a rapid changing pace. In case of any misunderstanding and misuse, we recommend to use the classical configuring way until our HOCON configuration file is finalized. Classical(KV): https://nanomq.io/docs/en/latest/config-description/v013.html you can find the old style of configuration file in https://github.com/emqx/nanomq/blob/master/etc/nanomq_old.conf `nanomq start --old_conf $nanomq_old.conf` Sorry for the troubles
Recommend to use the classical configuration (Ver before 0.19.5)
https://api.github.com/repos/nanomq/nanomq/issues/1337/comments
2
2023-07-04T07:46:52Z
2023-10-10T10:34:09Z
https://github.com/nanomq/nanomq/issues/1337
1,787,361,454
1,337
[ "emqx", "nanomq" ]
**Describe the bug** A bug in quic bridge. ``` ==27091==ERROR: AddressSanitizer: heap-use-after-free on address 0xffff84971120 at pc 0x0000004b4620 bp 0xffff8a2fe3a0 sp 0xffff8a2fe3b8 READ of size 8 at 0xffff84971120 thread T20 #0 0x4b461c in nni_msg_get_proto_data /root/nanomq/nng/src/core/message.c:740 #1 0x53a11c in nni_mqtt_msg_get_aio /root/nanomq/nng/src/supplemental/mqtt/mqtt_msg.c:899 #2 0x53a1c8 in mqtt_close_unack_msg_cb /root/nanomq/nng/src/supplemental/mqtt/mqtt_msg.c:918 #3 0x4abd64 in nni_id_map_foreach /root/nanomq/nng/src/core/idhash.c:70 #4 0x4e7410 in quic_mqtt_stream_close /root/nanomq/nng/src/mqtt/protocol/mqtt/mqttv5_quic.c:1698 #5 0x59f2ec in quic_connection_cb /root/nanomq/nng/src/supplemental/quic/quic_api.c:645 #6 0xffff9950cd00 in QuicConnIndicateEvent /root/nanomq/nng/extern/msquic/src/core/connection.c:749 #7 0xffff9950f41c in QuicConnOnShutdownComplete /root/nanomq/nng/extern/msquic/src/core/connection.c:1479 #8 0xffff99523114 in QuicConnDrainOperations /root/nanomq/nng/extern/msquic/src/core/connection.c:7532 #9 0xffff994f89e8 in QuicWorkerProcessConnection /root/nanomq/nng/extern/msquic/src/core/worker.c:510 #10 0xffff994f9004 in QuicWorkerLoop /root/nanomq/nng/extern/msquic/src/core/worker.c:667 #11 0xffff9955b0c4 in CxPlatRunExecutionContexts /root/nanomq/nng/extern/msquic/src/platform/platform_worker.c:369 #12 0xffff9955b834 in CxPlatWorkerThread /root/nanomq/nng/extern/msquic/src/platform/platform_worker.c:454 #13 0xffff993209a4 in start_thread (/lib64/libc.so.6+0x809a4) #14 0xffff9938bd18 in thread_start (/lib64/libc.so.6+0xebd18) 0xffff84971120 is located 112 bytes inside of 168-byte region [0xffff849710b0,0xffff84971158) freed by thread T11 here: #0 0xffff9987d348 in __interceptor_free.part.0 (/lib64/libasan.so.8+0xad348) #1 0x4ca95c in nni_free /root/nanomq/nng/src/platform/posix/posix_alloc.c:33 #2 0x4b332c in nni_msg_free /root/nanomq/nng/src/core/message.c:465 #3 0x4e29a4 in mqtt_quic_send_cb /root/nanomq/nng/src/mqtt/protocol/mqtt/mqttv5_quic.c:592 #4 0x4c4088 in nni_taskq_thread /root/nanomq/nng/src/core/taskq.c:50 #5 0x4c56ec in nni_thr_wrap /root/nanomq/nng/src/core/thread.c:94 #6 0x4cf5f8 in nni_plat_thr_main /root/nanomq/nng/src/platform/posix/posix_thread.c:266 #7 0xffff993209a4 in start_thread (/lib64/libc.so.6+0x809a4) #8 0xffff9938bd18 in thread_start (/lib64/libc.so.6+0xebd18) previously allocated by thread T12 here: #0 0xffff9987df28 in calloc (/lib64/libasan.so.8+0xadf28) #1 0x4ca934 in nni_zalloc /root/nanomq/nng/src/platform/posix/posix_alloc.c:26 #2 0x4b2dcc in nni_msg_alloc /root/nanomq/nng/src/core/message.c:387 #3 0x535f4c in nni_mqtt_msg_alloc /root/nanomq/nng/src/supplemental/mqtt/mqtt_msg.c:59 #4 0x51b24c in nng_mqtt_msg_alloc /root/nanomq/nng/src/supplemental/mqtt/mqtt_public.c:20 #5 0x455e58 in bridge_publish_msg /root/nanomq/nanomq/bridge.c:132 #6 0x48bb00 in bridge_handler /root/nanomq/nanomq/apps/broker.c:171 #7 0x48f318 in server_cb /root/nanomq/nanomq/apps/broker.c:519 #8 0x4c4088 in nni_taskq_thread /root/nanomq/nng/src/core/taskq.c:50 #9 0x4c56ec in nni_thr_wrap /root/nanomq/nng/src/core/thread.c:94 #10 0x4cf5f8 in nni_plat_thr_main /root/nanomq/nng/src/platform/posix/posix_thread.c:266 #11 0xffff993209a4 in start_thread (/lib64/libc.so.6+0x809a4) #12 0xffff9938bd18 in thread_start (/lib64/libc.so.6+0xebd18) Thread T20 created by T0 here: #0 0xffff9981acdc in __interceptor_pthread_create (/lib64/libasan.so.8+0x4acdc) #1 0xffff9955fc6c in CxPlatThreadCreate /root/nanomq/nng/extern/msquic/src/platform/platform_posix.c:666 #2 0xffff9955a48c in CxPlatWorkersLazyStart /root/nanomq/nng/extern/msquic/src/platform/platform_worker.c:193 #3 0xffff99563310 in CxPlatDataPathInitialize /root/nanomq/nng/extern/msquic/src/platform/datapath_epoll.c:557 #4 0xffff994d7cf0 in QuicLibraryEnsureExecutionContext /root/nanomq/nng/extern/msquic/src/core/library.c:659 #5 0xffff994e0de8 in MsQuicRegistrationOpen /root/nanomq/nng/extern/msquic/src/core/registration.c:56 #6 0x5a4110 in quic_open /root/nanomq/nng/src/supplemental/quic/quic_api.c:1456 #7 0x4e7f9c in nng_mqttv5_quic_open_conf /root/nanomq/nng/src/mqtt/protocol/mqtt/mqttv5_quic.c:1983 #8 0x459c68 in bridge_quic_client /root/nanomq/nanomq/bridge.c:789 #9 0x45bb40 in bridge_client /root/nanomq/nanomq/bridge.c:1071 #10 0x491ea4 in broker /root/nanomq/nanomq/apps/broker.c:919 #11 0x495f54 in broker_start /root/nanomq/nanomq/apps/broker.c:1619 #12 0x454f50 in main /root/nanomq/nanomq/nanomq.c:142 #13 0xffff992c73c4 in __libc_start_call_main (/lib64/libc.so.6+0x273c4) #14 0xffff992c749c in __libc_start_main_alias_2 (/lib64/libc.so.6+0x2749c) #15 0x45326c in _start (/root/nanomq/build/nanomq/nanomq+0x45326c) Thread T11 created by T0 here: #0 0xffff9981acdc in __interceptor_pthread_create (/lib64/libasan.so.8+0x4acdc) #1 0x4cf6ec in nni_plat_thr_init /root/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x4c59f8 in nni_thr_init /root/nanomq/nng/src/core/thread.c:121 #3 0x4c43f0 in nni_taskq_init /root/nanomq/nng/src/core/taskq.c:95 #4 0x4c5374 in nni_taskq_sys_init /root/nanomq/nng/src/core/taskq.c:294 #5 0x4ae0a0 in nni_init_helper /root/nanomq/nng/src/core/init.c:35 #6 0x4cfa7c in nni_plat_init /root/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x4ae154 in nni_init /root/nanomq/nng/src/core/init.c:58 #8 0x51a99c in nng_mtx_alloc /root/nanomq/nng/src/supplemental/util/platform.c:93 #9 0x56e2a0 in conf_bridge_parse_ver2 /root/nanomq/nng/src/supplemental/nanolib/conf_ver2.c:929 #10 0x56f840 in conf_parse_ver2 /root/nanomq/nng/src/supplemental/nanolib/conf_ver2.c:1234 #11 0x495aec in broker_start /root/nanomq/nanomq/apps/broker.c:1567 #12 0x454f50 in main /root/nanomq/nanomq/nanomq.c:142 #13 0xffff992c73c4 in __libc_start_call_main (/lib64/libc.so.6+0x273c4) #14 0xffff992c749c in __libc_start_main_alias_2 (/lib64/libc.so.6+0x2749c) #15 0x45326c in _start (/root/nanomq/build/nanomq/nanomq+0x45326c) Thread T12 created by T0 here: #0 0xffff9981acdc in __interceptor_pthread_create (/lib64/libasan.so.8+0x4acdc) #1 0x4cf6ec in nni_plat_thr_init /root/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x4c59f8 in nni_thr_init /root/nanomq/nng/src/core/thread.c:121 #3 0x4c43f0 in nni_taskq_init /root/nanomq/nng/src/core/taskq.c:95 #4 0x4c5374 in nni_taskq_sys_init /root/nanomq/nng/src/core/taskq.c:294 #5 0x4ae0a0 in nni_init_helper /root/nanomq/nng/src/core/init.c:35 #6 0x4cfa7c in nni_plat_init /root/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x4ae154 in nni_init /root/nanomq/nng/src/core/init.c:58 #8 0x51a99c in nng_mtx_alloc /root/nanomq/nng/src/supplemental/util/platform.c:93 #9 0x56e2a0 in conf_bridge_parse_ver2 /root/nanomq/nng/src/supplemental/nanolib/conf_ver2.c:929 #10 0x56f840 in conf_parse_ver2 /root/nanomq/nng/src/supplemental/nanolib/conf_ver2.c:1234 #11 0x495aec in broker_start /root/nanomq/nanomq/apps/broker.c:1567 #12 0x454f50 in main /root/nanomq/nanomq/nanomq.c:142 #13 0xffff992c73c4 in __libc_start_call_main (/lib64/libc.so.6+0x273c4) #14 0xffff992c749c in __libc_start_main_alias_2 (/lib64/libc.so.6+0x2749c) #15 0x45326c in _start (/root/nanomq/build/nanomq/nanomq+0x45326c) SUMMARY: AddressSanitizer: heap-use-after-free /root/nanomq/nng/src/core/message.c:740 in nni_msg_get_proto_data Shadow bytes around the buggy address: 0x200ff092e1d0: fd fa fa fa fa fa fa fa fa fa fd fd fd fd fd fd 0x200ff092e1e0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fa 0x200ff092e1f0: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd 0x200ff092e200: fd fd fd fd fd fd fd fd fd fd fd fd fd fa fa fa 0x200ff092e210: fa fa fa fa fa fa fd fd fd fd fd fd fd fd fd fd =>0x200ff092e220: fd fd fd fd[fd]fd fd fd fd fd fd fa fa fa fa fa 0x200ff092e230: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fd 0x200ff092e240: fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa 0x200ff092e250: fa fa fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x200ff092e260: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa 0x200ff092e270: 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 ``` **To Reproduce** ``` ./nanomq_cli/nanomq_cli bench pub -h 127.0.0.1 -p 1883 -q 2 -t topic1/a -s 2048 ./nanomq_cli/nanomq_cli sub -h "432121.xyz" -p 1883 -t "topic1/a" ``` ** Environment Details ** - NanoMQ version. Latest main branch - Operating system and version. Fedora - Compiler and language used. GCC - testing scenario. **Client SDK** nanomq_cli **Additional context**
Heap use after free in quic bridge
https://api.github.com/repos/nanomq/nanomq/issues/1329/comments
0
2023-07-03T06:06:18Z
2023-07-03T10:15:19Z
https://github.com/nanomq/nanomq/issues/1329
1,785,403,604
1,329
[ "emqx", "nanomq" ]
**Describe the bug** rule engine is not supported in full-tag docker images **To Reproduce** It looks like the rules engine was not enabled when the docker image was compiled ** Environment Details ** - NanoMQ version: 0.18.2 - Operating system and version: ubuntu20.04, docker 19.03.8
rule engine is not supported in full-tag docker images
https://api.github.com/repos/nanomq/nanomq/issues/1325/comments
3
2023-07-01T03:00:34Z
2023-07-21T10:51:41Z
https://github.com/nanomq/nanomq/issues/1325
1,783,396,718
1,325
[ "emqx", "nanomq" ]
**Describe the bug** This reload function has the following problems: 1. When the client calls reload successfully, the server side reports an error and the configuration of Load does not take effect ```CLI nanomq reload --conf etc/nanomq.conf reload succeed ``` ```SERVER LOG 2023-07-01 10:10:19 [45753] DEBUG ../nanomq/cmd_proc.c:107 cmd_server_cb: recv cmd : {"cmd":"reload","conf_file":"etc/nanomq.conf","conf_type":2} error: syntax error ``` 2. When the incoming configuration to be reloaded is as follows (nanomq_acl_new.conf does not exist), it will directly cause the SERVER program to crash ```nanomq.conf auth { allow_anonymous = true no_match = allow deny_action = disconnect cache = { max_size = 32 ttl = 1m } # password = {include "etc/nanomq_pwd.conf"} acl = {include "etc/nanomq_acl_new.conf"} } ``` ```server log 2023-07-01 10:10:19 [45753] DEBUG ../nanomq/cmd_proc.c:107 cmd_server_cb: recv cmd : {"cmd":"reload","conf_file":"etc/nanomq.conf","conf_type":2} error: syntax error error: syntax error munmap_chunk(): invalid pointer Aborted (core dumped) ``` ** Environment Details ** - NanoMQ version: 0.18.2 - Operating system and version: ubuntu20.04 - Compiler and language used: cmake - testing scenario: nanomqCLI
reload fail or server panic
https://api.github.com/repos/nanomq/nanomq/issues/1324/comments
3
2023-07-01T02:55:29Z
2024-02-05T04:01:56Z
https://github.com/nanomq/nanomq/issues/1324
1,783,390,648
1,324
[ "emqx", "nanomq" ]
**Describe the bug** A clear and concise description of what the bug is. 认证配置如下: sources = [ { type = simple enable = true users = [ { username = "admin" password = "public" }, { username = "client" password = "public" } ] }, { type = http enable = true auth_req { url = "http://host.docker.internal:8088/mqtt/auth" method = POST headers.content-type = "application/json" params = {clientid = "%c", username = "%u", password = "%P"} } timeout = 5s connect_timeout = 5s pool_size = 32 } ] 启动hauth_http后,认证链不生效,simple类型的认证没有起作用。 **Expected behavior** 根据认证链依次认证。 **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** 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.
auth_http
https://api.github.com/repos/nanomq/nanomq/issues/1320/comments
3
2023-06-29T10:26:11Z
2024-02-26T08:22:33Z
https://github.com/nanomq/nanomq/issues/1320
1,780,539,518
1,320
[ "emqx", "nanomq" ]
QUIC client doesnt reconnect to remote broker if session take over happens. Need to handle this case by shutdown connection manually
QUIC bridging stop reconnecting after being kicked out
https://api.github.com/repos/nanomq/nanomq/issues/1315/comments
1
2023-06-28T08:31:49Z
2023-06-28T15:15:06Z
https://github.com/nanomq/nanomq/issues/1315
1,778,468,332
1,315
[ "emqx", "nanomq" ]
- 运行环境描述 - host:armv7l linux 32bit - nanomq:0.18.2,源码交叉编译版本 - 由于交叉编译暂时无法编译sqlite、规则引擎特性。无法使用规则引擎把broker的启动、bridge的连接信息记录到本地 - 本地mqtt client后启动,存在丢失$SYS/brokers/connected $SYS/brokers/disconnected消息的问题 - 使用webhook转发bridge连接状态信息,存在本地http server后启动从而漏掉webhook请求的问题 - 问题: - 是否存在对borker的api调用获取本地nanomq的bridge连接状态 - 或者是否存在别的方法可以随时查询nanomq的bridge连接状态
Cross-compile MySQL connector + Feature request: Query bridging connection status
https://api.github.com/repos/nanomq/nanomq/issues/1295/comments
9
2023-06-15T05:07:31Z
2024-04-18T08:14:02Z
https://github.com/nanomq/nanomq/issues/1295
1,758,045,176
1,295
[ "emqx", "nanomq" ]
Make Error at CMakeLists.txt:315 (add_subdirectory): The source directory /xxxxx/nanomq-0.18.2/nng does not contain a CMakeLists.txt file. 因为release中下载的nng目录为空。
Plz update submodules if you wanna compile from source
https://api.github.com/repos/nanomq/nanomq/issues/1292/comments
1
2023-06-14T08:05:01Z
2024-02-05T04:02:13Z
https://github.com/nanomq/nanomq/issues/1292
1,756,303,785
1,292
[ "emqx", "nanomq" ]
**Describe the bug** on ubuntu-14.4 cross compile to armv7l linux with`CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabi-g++ cmake -G Ninja -DNNG_ENABLE_SQLITE=ON -DENABLE_RULE_ENGINE=ON ..` report error: ``` -- NanoMQ versions -- -- Configuring for NanoMQ version 0.18.0 -- Build NanoMQ with ACL support -- -- MODE [Release] -- -- Configuring for NNG version 1.6.0-pre -- Building static libs. Check MQTT_QUIC_CLIENT support: OFF -- Test zt disabled (unconfigured) -- Checking for module 'mysqlclient' -- No package 'mysqlclient' found CMake Error at /usr/share/cmake-3.24/Modules/FindPkgConfig.cmake:607 (message): A required package was not found Call Stack (most recent call first): /usr/share/cmake-3.24/Modules/FindPkgConfig.cmake:829 (_pkg_check_modules_internal) nanomq/CMakeLists.txt:71 (pkg_check_modules) ``` ** Environment Details ** - NanoMQ version: 0.18.0 - Operating system and version: - host: ubuntu-14.4 - target: armv7l linux 3.4.39 - Compiler and language used: arm-linux-gnueabi-gcc (Linaro GCC 4.9-2017.01) 4.9.4 **Client SDK** nanomq-0.18.2 release source
nanomq enable sqlite compile error
https://api.github.com/repos/nanomq/nanomq/issues/1291/comments
3
2023-06-14T07:58:42Z
2024-04-18T07:44:42Z
https://github.com/nanomq/nanomq/issues/1291
1,756,292,957
1,291
[ "emqx", "nanomq" ]
I know nanomq support webhook,but I can not find an example. I use emqx webhook program to work with nanomq and got an error. io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2Exception: Unexpected HTTP/1.x request: POST Anyone can give me a suggest?
Need a webhook tutorial
https://api.github.com/repos/nanomq/nanomq/issues/1270/comments
0
2023-06-02T03:32:32Z
2024-01-26T02:38:53Z
https://github.com/nanomq/nanomq/issues/1270
1,737,405,667
1,270
[ "emqx", "nanomq" ]
**Is your feature request related to a problem? Please describe.** The challenge is that NanoMQ could run in an environment that allows external TCP connections to MQTT Broker (cloud) only via a forward tunnel proxy like squid. **Describe the solution you'd like** TCP Proxy could be configured on the bridge connection such that it makes the TCP connection via the tunnel proxy (squid). **Describe alternatives you've considered** No alternatives **Additional context** This would work only with proxies that support tunneling.
Feature Request: Bridge connection via Tunnel Proxy
https://api.github.com/repos/nanomq/nanomq/issues/1261/comments
1
2023-05-22T19:53:40Z
2023-05-23T03:48:44Z
https://github.com/nanomq/nanomq/issues/1261
1,720,387,463
1,261
[ "emqx", "nanomq" ]
**Is your feature request related to a problem? Please describe.** When the bridge goes down, the broker does not send LWT as NanoMQ does not connect with LWT. **Describe the solution you'd like** mosquitto bridge has notifications support, allows the bridge to publish UP and DOWN events to a configurable topic. **Describe alternatives you've considered** Mosquitto **Additional context** mosquitto bridge has notifications support, allows the bridge to publish UP and DOWN events to a configurable topic. https://mosquitto.org/man/mosquitto-conf-5.html ``` notifications [ true | false ] If set to true, publish notification messages to the local and remote brokers giving information about the state of the bridge connection. Retained messages are published to the topic $SYS/broker/connection/<remote_clientid>/state unless otherwise set with notification_topics. If the message is 1 then the connection is active, or 0 if the connection has failed. Defaults to true. This uses the Last Will and Testament (LWT) feature. notifications_local_only [ true | false ] If set to true, only publish notification messages to the local broker giving information about the state of the bridge connection. Defaults to false. notification_topic topic Choose the topic on which notifications will be published for this bridge. If not set the messages will be sent on the topic $SYS/broker/connection/<remote_clientid>/state. ```
Feature request: bridge notifications
https://api.github.com/repos/nanomq/nanomq/issues/1260/comments
6
2023-05-22T19:46:09Z
2024-07-22T06:09:35Z
https://github.com/nanomq/nanomq/issues/1260
1,720,373,315
1,260
[ "emqx", "nanomq" ]
Since 0.14, hybrid bridging is broken. Will fix this in next 0.19 ver
Hybrid bridging is broken
https://api.github.com/repos/nanomq/nanomq/issues/1259/comments
0
2023-05-22T07:19:09Z
2023-05-27T01:48:51Z
https://github.com/nanomq/nanomq/issues/1259
1,719,059,166
1,259
[ "emqx", "nanomq" ]
MsQUIC project maintains an independent OpenSSL repo alone for encryption, while AWS C IOT SDK also doing so. And incompatible issue has been identified between these 2 features. They cannot be enabled together, at least in one project. This is caused by outside project and poor design of OpenSSL, NanoMQ wouldn't try to fix this.
OpenSSL incompatibility problem - AWS bridging & QUIC birdging is affected
https://api.github.com/repos/nanomq/nanomq/issues/1239/comments
0
2023-05-11T04:09:00Z
2023-05-11T04:09:12Z
https://github.com/nanomq/nanomq/issues/1239
1,705,031,086
1,239
[ "emqx", "nanomq" ]
To all users of NanoMQ, I apologize that a bug is found in AWS bridging feature (more specifically in AWS bridging conf file) This will be fixed along with security issues. Thanks
AWS bridging is broken since 0.9.0
https://api.github.com/repos/nanomq/nanomq/issues/1238/comments
0
2023-05-11T03:59:23Z
2023-05-11T04:21:43Z
https://github.com/nanomq/nanomq/issues/1238
1,705,024,079
1,238
[ "emqx", "nanomq" ]
Hello, I'm trying to run nanomq on Windows 11. When I start the broker it immediately shows an error which says that ucrtbased.dll is missing. I have tried searching which software has this dll, and it should come with Microsoft Visual C++ Redistributable. I have all versions installed, and non of them provides this dll. I have downloaded this file separately from a website and put it in system32, but now nanomq gives an error that says that the application wasn't able to properly start. Is there any way to launch nanomq broker on windows?
Enhance WIndows packaging CI (Debug to Release)
https://api.github.com/repos/nanomq/nanomq/issues/1232/comments
6
2023-05-07T04:59:29Z
2024-02-05T04:02:56Z
https://github.com/nanomq/nanomq/issues/1232
1,698,893,409
1,232
[ "emqx", "nanomq" ]
File: [/docs/zh_CN/docker.md](https://nanomq.io/docs/zh/latest/docker.html)
没有内容
https://api.github.com/repos/nanomq/nanomq/issues/1227/comments
2
2023-05-06T08:02:23Z
2023-05-09T03:04:40Z
https://github.com/nanomq/nanomq/issues/1227
1,698,526,361
1,227
[ "emqx", "nanomq" ]
**Describe the bug** http_server enable jwt, request response error, {"code":103} **Actual Behavior** console print “ERROR /home/runner/work/nanomq/nanomq/nanomq/rest_api.c:627 jwt_authorize: decode jwt token failed: return 0, result: 1” **To Reproduce** jwt payload: { "exp": 1683292928, "username": "admin", "password": "public" } ** Environment Details ** - NanoMQ version docker image 0.17.9-full - debian 11.5 **Additional context** postman jwt config screenshot: <img width="438" alt="1683222649904" src="https://user-images.githubusercontent.com/1784566/236287894-d97b0ced-31bc-4e19-be05-556372b3da83.png"> docker log screenshot: <img width="1069" alt="1683222824201" src="https://user-images.githubusercontent.com/1784566/236288238-4466f636-d25f-4736-855f-6ce57dc8337d.png">
http server open jwt auth fail
https://api.github.com/repos/nanomq/nanomq/issues/1221/comments
1
2023-05-04T17:55:16Z
2023-05-06T10:56:16Z
https://github.com/nanomq/nanomq/issues/1221
1,696,452,905
1,221
[ "emqx", "nanomq" ]
**Describe the bug** Hi! We have discovered a UAF vulnerability in our latest branch, here are the details. The following information is provided to facilitate reproduction. **To Reproduce** If possible include actual reproduction test code here. Minimal C test cases are perferred. **Environment Details** - NanoMQ version #5a8f908c09f23c54d8d82ade607d7cffda80358e - NanoNNG #2fc2c28d74ad2bc31c73fdf067d0e49c0c163485 ![image](https://user-images.githubusercontent.com/44093631/235565101-a4f2571c-07a7-4357-8acb-73106107367e.png) [UAF_sub_handler_c_316.zip](https://github.com/emqx/nanomq/files/11369196/UAF_sub_handler_c_316.zip)
[Security]: UAF of retain msg in sub_Ctx_handle
https://api.github.com/repos/nanomq/nanomq/issues/1217/comments
1
2023-05-02T02:15:01Z
2023-05-16T07:19:21Z
https://github.com/nanomq/nanomq/issues/1217
1,691,672,254
1,217
[ "emqx", "nanomq" ]
**Describe the bug** Hi! Similar to previous #1165, this should be one UAF due to condition contention in the latest branch (both for NanoMQ && NanoNNG). In fact, this vulnerability was committed to [#1165#issuecomment](https://github.com/emqx/nanomq/issues/1165#issuecomment-1514991022) and all of them have been fixed. But it seems that the problem is still present in the latest branch, either because of a situation that bypasses the patch or because they are caused by something more specific, so I opened this issue. The following information is provided to facilitate reproduction. **To Reproduce** If possible include actual reproduction test code here. Minimal C test cases are perferred. **Environment Details** - NanoMQ version #5a8f908c09f23c54d8d82ade607d7cffda80358e - NanoNNG #2fc2c28d74ad2bc31c73fdf067d0e49c0c163485 ![image](https://user-images.githubusercontent.com/44093631/235466117-a361c6a9-de7c-4503-b22a-c813b023a6ea.png) [UAF_nmq_mqtt_c_404.zip](https://github.com/emqx/nanomq/files/11365926/UAF_nmq_mqtt_c_404.zip)
[Security]: duplicate with #1180
https://api.github.com/repos/nanomq/nanomq/issues/1216/comments
8
2023-05-01T14:32:04Z
2023-05-19T08:23:49Z
https://github.com/nanomq/nanomq/issues/1216
1,690,888,683
1,216
[ "emqx", "nanomq" ]
**Describe the bug** Hi, we found a new security problem (Segmentation Fault in mqtt_public.c:322) in the latest branch. The following information is provided to facilitate reproduction and restoration. **To Reproduce** If possible include actual reproduction test code here. Minimal C test cases are perferred. ** Environment Details ** - NanoMQ version #5a8f908c09f23c54d8d82ade607d7cffda80358e - NanoNNG #2fc2c28d74ad2bc31c73fdf067d0e49c0c163485 [SEGV_publi_c_322.zip](https://github.com/emqx/nanomq/files/11365839/SEGV_publi_c_322.zip) ![image](https://user-images.githubusercontent.com/44093631/235465775-ee4e5ce3-9674-4c63-ac06-3d84ed6d7562.png) ![image](https://user-images.githubusercontent.com/44093631/235465909-5a2bc26f-2840-407b-b92a-330cf29b55b9.png) **Additional context** Add any other context about the problem here.
[Security]:Decoding invalid topic triggers a buffer overflow
https://api.github.com/repos/nanomq/nanomq/issues/1215/comments
1
2023-05-01T14:19:31Z
2023-05-15T02:08:58Z
https://github.com/nanomq/nanomq/issues/1215
1,690,875,983
1,215
[ "emqx", "nanomq" ]
I'm trying to connect to MQTT Broker over WebSocket protocol. The connection is not established consistently, it results in errors from time to time. **Expected behavior** A connection is established every time. **Actual Behavior** A connection is not established every time. **To Reproduce** Broker setup: I've used Docker image of NanoMQ broker: https://hub.docker.com/r/emqx/nanomq and specified NANOMQ_WEBSOCKET_URL (`docker run -d -p 1883:1883 -p 8883:8883 -p 8083:8083 -e NANOMQ_WEBSOCKET_URL="nmq-ws://0.0.0.0:8083/mqtt" --name nanomq emqx/nanomq:latest`) Latest at the moment is [0.17.3] Client setup: For connection setup I've been trying default examples from here (tried both of them, modified mqtt-client-Node.js to connect over WS too). They've resulted in the same outcome. https://github.com/emqx/MQTT-Client-Examples/tree/master/mqtt-client-React https://github.com/emqx/MQTT-Client-Examples/tree/master/mqtt-client-Node.js Connection works the first time, but after first time the client is connected, sometimes connection is not established. - **Client side:** The error which is logged during reconnection on client side is `undefined` ``` client.on('reconnect', (error) => { console.log(`Reconnecting...`, error) }) ``` ``` Reconnecting... undefined ``` - **Broker side:** The error on Docker Container is ``` WARN /nanomq/nng/src/sp/transport/mqttws/nmq_websocket.c:126 wstran_pipe_recv_cb: recv aio error Object closed ``` **Environment Details** - Broker: emqx/nanomq:latest (at the moment [0.17.3]) Client: https://github.com/mqttjs/MQTT.js - Mac OS 13.2.1 **Additional context** This issue is irregular. Haven't figured the pattern besides it working the first time a client is trying to connect. I'm able to "consistently reproduce" it by continuously trying to connect/disconnect to a broker after 1 minute of first connection.
Unstable WebSocket connection, recv aio error Object closed
https://api.github.com/repos/nanomq/nanomq/issues/1210/comments
8
2023-04-26T13:27:54Z
2023-12-22T09:19:53Z
https://github.com/nanomq/nanomq/issues/1210
1,685,036,106
1,210
[ "emqx", "nanomq" ]
https://github.com/emqx/nanomq/actions/runs/4772364171/jobs/8484830733?pr=1193
Enhance broker_Test
https://api.github.com/repos/nanomq/nanomq/issues/1194/comments
1
2023-04-22T11:03:28Z
2023-04-25T09:06:10Z
https://github.com/nanomq/nanomq/issues/1194
1,679,480,282
1,194
[ "emqx", "nanomq" ]
**Describe the bug** > We are sorry that several security vulnerabilities have been reported recently that may affect your normal work, and we apologize if this has caused any inconvenience. Hi, we found a new security problem (Segmentation Fault in mqtt_parser.c:608) in the latest branch. The following information is provided to facilitate reproduction and restoration. **To Reproduce** If possible include actual reproduction test code here. Minimal C test cases are perferred. ** Environment Details ** - NanoMQ version #69224a88554e7187f6d303a23ed825a7875b8a7d - NanoNNG #e320bebbb681d7623e1f8e02a1e5369384b91db7 ![image](https://user-images.githubusercontent.com/44093631/233353010-d1996d68-d353-4eac-bff3-99f2f02b6ac3.png) [data.zip](https://github.com/emqx/nanomq/files/11285684/data.zip) **Additional context** Add any other context about the problem here.
[Security]: regression bug
https://api.github.com/repos/nanomq/nanomq/issues/1190/comments
4
2023-04-20T11:32:55Z
2023-05-05T01:46:50Z
https://github.com/nanomq/nanomq/issues/1190
1,676,543,387
1,190
[ "emqx", "nanomq" ]
### Discussed in https://github.com/emqx/nanomq/discussions/1182 <div type='discussions-op-text'> <sup>Originally posted by **anandbwfrd** April 18, 2023</sup> How can I subscribe to a topic from an external MQTT Broker and publish the content to a new topic on local MQTT Broker using the nanomq_cli tool on Windows OS? I think it requires the usage of the NanoMQGateway tool which isn't built by default. I need access to the Windows Source code to be able to build it using CMAKE and Ninja - Screenshot attached below. Please confirm if the NanoMQGateway tool is supported on the Windows Platform. ![Screenshot 2023-04-18 201451](https://user-images.githubusercontent.com/112025627/232942152-be2bc2c0-b72c-4a06-87d5-a3de4474ec3e.png) </div>
Unable to use Nano MQ Gateway tool - Request for Source code for Windows OS to build NanoMQ Gateway Tool
https://api.github.com/repos/nanomq/nanomq/issues/1183/comments
2
2023-04-19T01:23:18Z
2023-04-20T04:07:33Z
https://github.com/nanomq/nanomq/issues/1183
1,674,033,575
1,183
[ "emqx", "nanomq" ]
**Describe the bug** We found a heap-buffer-overflow in `conn_handler` function of `mqtt_parser.c` when it processes malformed messages. **Expected behavior** A clear and concise description of what you expected to happen. **Actual Behavior** Heap-buffer-overflow **To Reproduce** start nanomq with ./nanomq start Send the packet:nc 127.0.0.1 1883 < ./1181-poc.raw [1181-poc.raw.zip](https://github.com/emqx/nanomq/files/11268189/1181-poc.raw.zip) `conn_handler` function of `mqtt_parser.c:602:20` <img width="635" alt="image" src="https://user-images.githubusercontent.com/131155516/232842198-2f213639-009c-4ad4-813a-6e5af36f5490.png"> Asan Log > ================================================================= > ==3700126==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000bb3c at pc 0x0000005f287d bp 0x7f8477d97950 sp 0x7f8477d97948 > READ of size 1 at 0x60200000bb3c thread T7 (nng:task) > #0 0x5f287c in conn_handler /home/user/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:602:20 > #1 0x816b7d in tcptran_pipe_nego_cb /home/user/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:363:13 > #2 0x5b467b in nni_taskq_thread /home/user/nanomq/nng/src/core/taskq.c:50:4 > #3 0x5b7d4c in nni_thr_wrap /home/user/nanomq/nng/src/core/thread.c:94:3 > #4 0x5c78e0 in nni_plat_thr_main /home/user/nanomq/nng/src/platform/posix/posix_thread.c:266:2 > #5 0x7f847ddb4608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8 > #6 0x7f847db40132 in clone /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95 > > 0x60200000bb3c is located 0 bytes to the right of 12-byte region [0x60200000bb30,0x60200000bb3c) > allocated by thread T7 (nng:task) here: > #0 0x4adf1d in malloc (/home/user/nanomq/build/nanomq/nanomq+0x4adf1d) > #1 0x81686e in tcptran_pipe_nego_cb /home/user/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:345:18 > #2 0x5b467b in nni_taskq_thread /home/user/nanomq/nng/src/core/taskq.c:50:4 > #3 0x5b7d4c in nni_thr_wrap /home/user/nanomq/nng/src/core/thread.c:94:3 > #4 0x5c78e0 in nni_plat_thr_main /home/user/nanomq/nng/src/platform/posix/posix_thread.c:266:2 > #5 0x7f847ddb4608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8 > > Thread T7 (nng:task) created by T0 here: > #0 0x498cca in pthread_create (/home/user/nanomq/build/nanomq/nanomq+0x498cca) > #1 0x5c766e in nni_plat_thr_init /home/user/nanomq/nng/src/platform/posix/posix_thread.c:279:7 > #2 0x5b74de in nni_thr_init /home/user/nanomq/nng/src/core/thread.c:121:12 > #3 0x5b3c6f in nni_taskq_init /home/user/nanomq/nng/src/core/taskq.c:95:8 > #4 0x57bb04 in nni_init_helper /home/user/nanomq/nng/src/core/init.c:35:13 > #5 0x5c7ef2 in nni_plat_init /home/user/nanomq/nng/src/platform/posix/posix_thread.c:422:12 > #6 0x61b6bd in nni_proto_mqtt_open /home/user/nanomq/nng/src/sp/protocol.c:37:12 > #7 0x544f4b in broker /home/user/nanomq/nanomq/apps/broker.c:871:25 > #8 0x54ea34 in broker_start /home/user/nanomq/nanomq/apps/broker.c:1602:7 > #9 0x7f847da45082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16 > > SUMMARY: AddressSanitizer: heap-buffer-overflow /home/user/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:602:20 in conn_handler > Shadow bytes around the buggy address: > 0x0c047fff9710: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa > 0x0c047fff9720: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa > 0x0c047fff9730: fa fa fd fa fa fa fd fa fa fa fd fd fa fa fd fa > 0x0c047fff9740: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa > 0x0c047fff9750: fa fa fd fd fa fa fd fa fa fa fd fa fa fa fd fa > =>0x0c047fff9760: fa fa fd fd fa fa 00[04]fa fa 00 01 fa fa fa fa > 0x0c047fff9770: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa > 0x0c047fff9780: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa > 0x0c047fff9790: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa > 0x0c047fff97a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa > 0x0c047fff97b0: 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 > ==3700126==ABORTING > ** Environment Details ** - NanoMQ version: 0.17.5 (da4d3c8a) - Operating system and version: Ubuntu 20.04 - Compiler and language used: gcc 9.4.0 clang 10.0.0 - testing scenario: Run the broker(build with ASAN and TSAN) with the ./nanomq start command
[Security]: Vulnerability identified
https://api.github.com/repos/nanomq/nanomq/issues/1181/comments
0
2023-04-18T16:29:38Z
2023-04-20T07:14:36Z
https://github.com/nanomq/nanomq/issues/1181
1,673,473,933
1,181
[ "emqx", "nanomq" ]
**Describe the bug** We found a heap-use-after-free in `nano_ctx_send` function of `nmq_mqtt.c` when it processes malformed messages. **Actual Behavior** Heap-use-after-free **To Reproduce** Read the `pipe` in `nano_ctx_send`(nmq_mqtt.c) <img width="666" alt="image" src="https://user-images.githubusercontent.com/131155516/232831609-cb006702-2f3e-4751-8dde-a91ef5087770.png"> Free the `pipe` in `reap_worker`(reap.c) -> `pipe_destroy`(pipe.c) <img width="671" alt="image" src="https://user-images.githubusercontent.com/131155516/232833249-01f34876-46c1-4e1a-863e-85d6b3ea26a2.png"> `pipe_destroy`(pipe.c) <img width="820" alt="image" src="https://user-images.githubusercontent.com/131155516/232833523-9f79a96f-3019-4576-b8d1-b073f1fcb5b3.png"> ASAN Log > > ================================================================= > ==3144198==ERROR: AddressSanitizer: heap-use-after-free on address 0x61d00003ff98 at pc 0x0000006dce8c bp 0x7fe86eea87f0 sp 0x7fe86eea87e8 > READ of size 8 at 0x61d00003ff98 thread T11 (nng:task) > #0 0x6dce8b in nano_ctx_send /home/user/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:405:9 > #1 0x5a80b0 in nng_ctx_send /home/user/nanomq/nng/src/nng.c:401:2 > #2 0x577770 in server_cb /home/user/nanomq/nanomq/apps/broker.c:696:3 > #3 0x646595 in nni_taskq_thread /home/user/nanomq/nng/src/core/taskq.c:50:4 > #4 0x64caf0 in nni_thr_wrap /home/user/nanomq/nng/src/core/thread.c:94:3 > #5 0x66a073 in nni_plat_thr_main /home/user/nanomq/nng/src/platform/posix/posix_thread.c:266:2 > #6 0x7fe876f21608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8 > #7 0x7fe876cad132 in clone /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95 > > 0x61d00003ff98 is located 792 bytes inside of 2304-byte region [0x61d00003fc80,0x61d000040580) > freed by thread T14 (nng:reap2) here: > #0 0x4acc8d in free (/home/user/nanomq/build/nanomq/nanomq+0x4acc8d) > #1 0x6172b6 in pipe_destroy /home/user/nanomq/nng/src/core/pipe.c:83:2 > #2 0x618e7e in reap_worker /home/user/nanomq/nng/src/core/reap.c:58:5 > #3 0x64caf0 in nni_thr_wrap /home/user/nanomq/nng/src/core/thread.c:94:3 > #4 0x66a073 in nni_plat_thr_main /home/user/nanomq/nng/src/platform/posix/posix_thread.c:266:2 > #5 0x7fe876f21608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8 > > previously allocated by thread T11 (nng:task) here: > #0 0x4ad082 in calloc (/home/user/nanomq/build/nanomq/nanomq+0x4ad082) > #1 0x6600a9 in nni_zalloc /home/user/nanomq/nng/src/platform/posix/posix_alloc.c:26:19 > #2 0x61079e in pipe_create /home/user/nanomq/nng/src/core/pipe.c:252:11 > #3 0x6133d8 in nni_pipe_create_listener /home/user/nanomq/nng/src/core/pipe.c:331:12 > #4 0x6332c1 in nni_listener_add_pipe /home/user/nanomq/nng/src/core/socket.c:1578:6 > #5 0x5f071c in listener_accept_cb /home/user/nanomq/nng/src/core/listener.c:357:3 > #6 0x646595 in nni_taskq_thread /home/user/nanomq/nng/src/core/taskq.c:50:4 > #7 0x64caf0 in nni_thr_wrap /home/user/nanomq/nng/src/core/thread.c:94:3 > #8 0x66a073 in nni_plat_thr_main /home/user/nanomq/nng/src/platform/posix/posix_thread.c:266:2 > #9 0x7fe876f21608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8 > > Thread T11 (nng:task) created by T0 here: > #0 0x497cba in pthread_create (/home/user/nanomq/build/nanomq/nanomq+0x497cba) > #1 0x669c07 in nni_plat_thr_init /home/user/nanomq/nng/src/platform/posix/posix_thread.c:279:7 > #2 0x64bbbd in nni_thr_init /home/user/nanomq/nng/src/core/thread.c:121:12 > #3 0x645507 in nni_taskq_init /home/user/nanomq/nng/src/core/taskq.c:95:8 > #4 0x5e6479 in nni_init_helper /home/user/nanomq/nng/src/core/init.c:35:13 > #5 0x66ad55 in nni_plat_init /home/user/nanomq/nng/src/platform/posix/posix_thread.c:422:12 > #6 0x6fdfa8 in nni_proto_mqtt_open /home/user/nanomq/nng/src/sp/protocol.c:37:12 > #7 0x592a92 in broker /home/user/nanomq/nanomq/apps/broker.c:872:25 > #8 0x5a2d8d in broker_start /home/user/nanomq/nanomq/apps/broker.c:1603:7 > #9 0x4e1842 in main /home/user/nanomq/nanomq/nanomq.c:142:10 > #10 0x7fe876bb2082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16 > > Thread T14 (nng:reap2) created by T0 here: > #0 0x497cba in pthread_create (/home/user/nanomq/build/nanomq/nanomq+0x497cba) > #1 0x669c07 in nni_plat_thr_init /home/user/nanomq/nng/src/platform/posix/posix_thread.c:279:7 > #2 0x64bbbd in nni_thr_init /home/user/nanomq/nng/src/core/thread.c:121:12 > #3 0x6188e5 in nni_reap_sys_init /home/user/nanomq/nng/src/core/reap.c:110:12 > #4 0x5e64b0 in nni_init_helper /home/user/nanomq/nng/src/core/init.c:36:13 > #5 0x66ad55 in nni_plat_init /home/user/nanomq/nng/src/platform/posix/posix_thread.c:422:12 > #6 0x6fdfa8 in nni_proto_mqtt_open /home/user/nanomq/nng/src/sp/protocol.c:37:12 > #7 0x592a92 in broker /home/user/nanomq/nanomq/apps/broker.c:872:25 > #8 0x5a2d8d in broker_start /home/user/nanomq/nanomq/apps/broker.c:1603:7 > #9 0x4e1842 in main /home/user/nanomq/nanomq/nanomq.c:142:10 > #10 0x7fe876bb2082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16 > > SUMMARY: AddressSanitizer: heap-use-after-free /home/user/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:405:9 in nano_ctx_send > Shadow bytes around the buggy address: > 0x0c3a7fffffa0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd > 0x0c3a7fffffb0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd > 0x0c3a7fffffc0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd > 0x0c3a7fffffd0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd > 0x0c3a7fffffe0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd > =>0x0c3a7ffffff0: fd fd fd[fd]fd fd fd fd fd fd fd fd fd fd fd fd > 0x0c3a80000000: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd > 0x0c3a80000010: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd > 0x0c3a80000020: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd > 0x0c3a80000030: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd > 0x0c3a80000040: 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 > ==3144198==ABORTING > ** Environment Details ** - NanoMQ version: 0.16.5 (aa188a4d) - Operating system and version: Ubuntu 20.04 - Compiler and language used: gcc 9.4.0 clang 10.0.0 - testing scenario: Run the broker(build with ASAN and TSAN) with the ./nanomq start command
[Security]: data contention in pipe reaper
https://api.github.com/repos/nanomq/nanomq/issues/1180/comments
4
2023-04-18T15:56:32Z
2023-05-18T03:03:09Z
https://github.com/nanomq/nanomq/issues/1180
1,673,423,197
1,180
[ "emqx", "nanomq" ]
**Describe the bug** We found a SEGV cased by member access within null pointer of type 'nni_msg' (aka 'struct nng_msg') in `nni_msg_set_cmd_type` function of `message.c` when it processes malformed messages. **Expected behavior** If Asan is enabled at compile time, the NanoMQ crashes and displays ASAN information. **Actual Behavior** SEGV, runtime error: member access within null pointer of type 'nni_msg' (aka 'struct nng_msg') **To Reproduce** start nanomq with ./nanomq start Send the packet:nc 127.0.0.1 1179 < ./1179-poc.raw [1179-poc.zip](https://github.com/emqx/nanomq/files/11268258/1179-poc.zip) in `nni_msg_set_cmd_type` function of `message.c` <img width="491" alt="image" src="https://user-images.githubusercontent.com/131155516/232805502-57eedc30-266b-4399-9f55-0789cdb807de.png"> in `server_cb` function of `broker.c` <img width="664" alt="image" src="https://user-images.githubusercontent.com/131155516/232808044-a14093fd-29ce-4115-b104-a5513e1530d4.png"> Asan Log > /home/user/nanomq/nng/src/core/message.c:711:5: runtime error: member access within null pointer of type 'nni_msg' (aka 'struct nng_msg') > SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/user/nanomq/nng/src/core/message.c:711:5 in ================================================================= > ==3076672==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000088 (pc 0x00000060754b bp 0x7ff360ea8a10 sp 0x7ff360ea89f0 T11) > ==3076672==The signal is caused by a WRITE memory access. > ==3076672==Hint: address points to the zero page. > #0 0x60754b in nni_msg_set_cmd_type /home/user/nanomq/nng/src/core/message.c:711:14 > #1 0x57d2a9 in server_cb /home/user/nanomq/nanomq/apps/broker.c:667:6 > #2 0x646595 in nni_taskq_thread /home/user/nanomq/nng/src/core/taskq.c:50:4 > #3 0x64caf0 in nni_thr_wrap /home/user/nanomq/nng/src/core/thread.c:94:3 > #4 0x66a073 in nni_plat_thr_main /home/user/nanomq/nng/src/platform/posix/posix_thread.c:266:2 > #5 0x7ff368f21608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8 > #6 0x7ff368cad132 in clone /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95 > > SUMMARY: AddressSanitizer: SEGV /home/user/nanomq/nng/src/core/message.c:711:14 in nni_msg_set_cmd_type ** Environment Details ** - NanoMQ version: 0.16.5(aa188a4d) & da4d3c8a - Operating system and version: Ubuntu 20.04 - Compiler and language used: gcc 9.4.0 clang 10.0.0 - testing scenario: Run the broker(build with ASAN and TSAN) with the ./nanomq start command
[Security]: vulnerability of invalid Last-will msg
https://api.github.com/repos/nanomq/nanomq/issues/1179/comments
4
2023-04-18T14:27:43Z
2023-04-19T08:00:24Z
https://github.com/nanomq/nanomq/issues/1179
1,673,254,963
1,179
[ "emqx", "nanomq" ]
**Describe the bug** We found heap-buffer-overflow in `copyn_utf8_str` function of `mqtt_parser.c` with 4 different call stack and 4 POCs, when it processes malformed messages . ( After fixed in the #1043. the call stack is different) **Expected behavior** A clear and concise description of what you expected to happen. **Actual Behavior** Heap-buffer-overflow **To Reproduce** - Run the broker(build with ASAN and TSAN) with the ./nanomq start command - nc 127.0.0.1 1883 < 1178-poc.raw `copyn_utf8_str` in `mqtt_parser.c:227:2` <img width="728" alt="image" src="https://user-images.githubusercontent.com/131155516/232794510-da2a92b1-d419-4605-83d1-69be4d60ef8e.png"> 1. `conn_handler` in `mqtt_parser.c:640:15` [1178-poc@640.zip](https://github.com/emqx/nanomq/files/11274242/1178-poc%40640.raw.zip) <img width="724" alt="image" src="https://user-images.githubusercontent.com/131155516/232835534-97974948-2cba-4649-8cc8-9a7a65ce6a04.png"> Asan Log > ==3077253==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000046bd at pc 0x0000006b18f2 bp 0x7f96834488b0 sp 0x7f96834488a8 > READ of size 1 at 0x6020000046bd thread T8 (nng:task) > #0 0x6b18f1 in copyn_utf8_str /home/user/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:227:2 > #1 0x6b8d81 in conn_handler /home/user/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:640:15 > #2 0xa879ef in tcptran_pipe_nego_cb /home/user/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:363:13 > #3 0x646595 in nni_taskq_thread /home/user/nanomq/nng/src/core/taskq.c:50:4 > #4 0x64caf0 in nni_thr_wrap /home/user/nanomq/nng/src/core/thread.c:94:3 > #5 0x66a073 in nni_plat_thr_main /home/user/nanomq/nng/src/platform/posix/posix_thread.c:266:2 > #6 0x7f9689c7c608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8 > #7 0x7f9689a08132 in clone /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95 > > 0x6020000046bd is located 0 bytes to the right of 13-byte region [0x6020000046b0,0x6020000046bd) > allocated by thread T8 (nng:task) here: > #0 0x4acf0d in malloc (/home/user/nanomq/build/nanomq/nanomq+0x4acf0d) > #1 0x660004 in nni_alloc /home/user/nanomq/nng/src/platform/posix/posix_alloc.c:20:19 > #2 0xa87348 in tcptran_pipe_nego_cb /home/user/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:345:18 > #3 0x646595 in nni_taskq_thread /home/user/nanomq/nng/src/core/taskq.c:50:4 > #4 0x64caf0 in nni_thr_wrap /home/user/nanomq/nng/src/core/thread.c:94:3 > #5 0x66a073 in nni_plat_thr_main /home/user/nanomq/nng/src/platform/posix/posix_thread.c:266:2 > #6 0x7f9689c7c608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8 > > Thread T8 (nng:task) created by T0 here: > #0 0x497cba in pthread_create (/home/user/nanomq/build/nanomq/nanomq+0x497cba) > #1 0x669c07 in nni_plat_thr_init /home/user/nanomq/nng/src/platform/posix/posix_thread.c:279:7 > #2 0x64bbbd in nni_thr_init /home/user/nanomq/nng/src/core/thread.c:121:12 > #3 0x645507 in nni_taskq_init /home/user/nanomq/nng/src/core/taskq.c:95:8 > #4 0x5e6479 in nni_init_helper /home/user/nanomq/nng/src/core/init.c:35:13 > #5 0x66ad55 in nni_plat_init /home/user/nanomq/nng/src/platform/posix/posix_thread.c:422:12 > #6 0x6fdfa8 in nni_proto_mqtt_open /home/user/nanomq/nng/src/sp/protocol.c:37:12 > #7 0x592a92 in broker /home/user/nanomq/nanomq/apps/broker.c:872:25 > #8 0x5a2d8d in broker_start /home/user/nanomq/nanomq/apps/broker.c:1603:7 > #9 0x4e1842 in main /home/user/nanomq/nanomq/nanomq.c:142:10 > #10 0x7f968990d082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16 > > SUMMARY: AddressSanitizer: heap-buffer-overflow /home/user/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:227:2 in copyn_utf8_str > Shadow bytes around the buggy address: > 0x0c047fff8880: fa fa fd fa fa fa fd fd fa fa fd fa fa fa fd fa > 0x0c047fff8890: fa fa fd fd fa fa fd fa fa fa fd fa fa fa fd fd > 0x0c047fff88a0: fa fa fd fd fa fa fd fd fa fa fd fa fa fa fd fa > 0x0c047fff88b0: fa fa fd fa fa fa fd fa fa fa fd fd fa fa fd fd > 0x0c047fff88c0: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa > =>0x0c047fff88d0: fa fa fd fa fa fa 00[05]fa fa 05 fa fa fa fa fa > 0x0c047fff88e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa > 0x0c047fff88f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa > 0x0c047fff8900: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa > 0x0c047fff8910: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa > 0x0c047fff8920: 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 > ==3077253==ABORTING 2. `conn_handler` in `mqtt_parser.c:682:16` [1178-poc@682.zip](https://github.com/emqx/nanomq/files/11268148/1178-poc.raw.zip) <img width="717" alt="image" src="https://user-images.githubusercontent.com/131155516/232836016-0a2df652-2e0e-49bb-a72c-eb7d4496a1e0.png"> Asan Log > ==3476660==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60300000c2c3 at pc 0x0000006b18f2 bp 0x7f84f41cd8b0 sp 0x7f84f41cd8a8 > READ of size 1 at 0x60300000c2c3 thread T8 (nng:task) > #0 0x6b18f1 in copyn_utf8_str /home/user/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:227:2 > #1 0x6ba8ac in conn_handler /home/user/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:682:16 > #2 0xa879ef in tcptran_pipe_nego_cb /home/user/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:363:13 > #3 0x646595 in nni_taskq_thread /home/user/nanomq/nng/src/core/taskq.c:50:4 > #4 0x64caf0 in nni_thr_wrap /home/user/nanomq/nng/src/core/thread.c:94:3 > #5 0x66a073 in nni_plat_thr_main /home/user/nanomq/nng/src/platform/posix/posix_thread.c:266:2 > #6 0x7f84faa01608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8 > #7 0x7f84fa78d132 in clone /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95 > 3. `mqtt_parser.c:725:7` [1178-poc@725.zip](https://github.com/emqx/nanomq/files/11274155/1178-poc%40725.zip) <img width="704" alt="image" src="https://user-images.githubusercontent.com/131155516/233107132-c0d5bad0-8aac-4839-9abd-33b1ef6239e2.png"> Asan Log > ==3644123==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x604000010673 at pc 0x0000005edb81 bp 0x7f66497d88f0 sp 0x7f66497d88e8 > READ of size 1 at 0x604000010673 thread T6 (nng:task) > #0 0x5edb80 in copyn_utf8_str /home/user/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:227:2 > #1 0x5f3b50 in conn_handler /home/user/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:725:7 > #2 0x816b7d in tcptran_pipe_nego_cb /home/user/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:363:13 > #3 0x5b467b in nni_taskq_thread /home/user/nanomq/nng/src/core/taskq.c:50:4 > #4 0x5b7d4c in nni_thr_wrap /home/user/nanomq/nng/src/core/thread.c:94:3 > #5 0x5c78e0 in nni_plat_thr_main /home/user/nanomq/nng/src/platform/posix/posix_thread.c:266:2 > #6 0x7f664efde608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8 > #7 0x7f664ed6a132 in clone /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95 4. `mqtt_parser.c:712:16` [1178-poc@712.zip](https://github.com/emqx/nanomq/files/11274297/1178-poc%40712.raw.zip) <img width="702" alt="image" src="https://user-images.githubusercontent.com/131155516/233109942-b022b3d0-22c8-44ea-82d8-307234594e93.png"> Asan Log > ==3751258==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6040000081f3 at pc 0x0000005edb81 bp 0x7ff0693818f0 sp 0x7ff0693818e8 > READ of size 1 at 0x6040000081f3 thread T12 (nng:task) > #0 0x5edb80 in copyn_utf8_str /home/user/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:227:2 > #1 0x5f393d in conn_handler /home/user/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:712:16 > #2 0x816b7d in tcptran_pipe_nego_cb /home/user/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:363:13 > #3 0x5b467b in nni_taskq_thread /home/user/nanomq/nng/src/core/taskq.c:50:4 > #4 0x5b7d4c in nni_thr_wrap /home/user/nanomq/nng/src/core/thread.c:94:3 > #5 0x5c78e0 in nni_plat_thr_main /home/user/nanomq/nng/src/platform/posix/posix_thread.c:266:2 > #6 0x7ff071c11608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8 > #7 0x7ff07199d132 in clone /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95 ** Environment Details ** - NanoMQ version: 0.16.5 (aa188a4d) - Operating system and version: Ubuntu 20.04 - Compiler and language used: gcc 9.4.0 clang 10.0.0 - testing scenario: Run the broker(build with ASAN and TSAN) with the ./nanomq start command
[Security]: non-severe vulnerability
https://api.github.com/repos/nanomq/nanomq/issues/1178/comments
9
2023-04-18T14:05:18Z
2024-06-12T08:21:09Z
https://github.com/nanomq/nanomq/issues/1178
1,673,211,886
1,178
[ "emqx", "nanomq" ]
It would be nice to be able to define different topic names for remote/local in subscription/forward bridge definition (plus possibility to define/override reatin and qos flags For example: ``` bridges.mqtt { nodes = [ { name = emqx ... subscription = [ { remote_topic = "recv/topic1" local_topic = "machineAA/topic1" retain = 0 qos = 1 }, { remote_topic = "recv/topic2" local_topic = "machineAA/topic2 retain = ${flags.retain} qos = ${flags.qos} } ] .... forward = [ { local_topic = "machineAA/topic3" remote_topic = "snd/topic3" retain = 1 qos = 1 } ] } ] } ```
MQTT bridge - local and remote topics for subscription/forward
https://api.github.com/repos/nanomq/nanomq/issues/1174/comments
9
2023-04-18T06:45:48Z
2024-01-23T04:22:02Z
https://github.com/nanomq/nanomq/issues/1174
1,672,459,358
1,174
[ "emqx", "nanomq" ]
### Discussed in https://github.com/emqx/nanomq/discussions/1172 <div type='discussions-op-text'> <sup>Originally posted by **anandbwfrd** April 17, 2023</sup> I am getting 2 errors when trying to run NANOMQ using default configuration on Server 2022 OS. Can someone help me with this issue ASAP please? I have attached the screenshot of the errors that I am getting. thanks, Anand. ![Screenshot 2023-04-17 121755](https://user-images.githubusercontent.com/112025627/232565537-4d0239d6-b745-4278-8818-9250ac38ffe9.png) ![Screenshot 2023-04-17 121741](https://user-images.githubusercontent.com/112025627/232565538-cbbed0a3-ff77-4471-9155-9bf37d34d477.png) </div>
Unable to run NanoMQ on Windows Server 2022 OS
https://api.github.com/repos/nanomq/nanomq/issues/1173/comments
4
2023-04-17T17:35:39Z
2023-06-02T03:50:41Z
https://github.com/nanomq/nanomq/issues/1173
1,671,659,155
1,173
[ "emqx", "nanomq" ]
**Describe the bug** When using `nanomq start --conf /etc/nanomq.conf` followed by `nanomq reload` to reload the configuration file, the NanoMQ process crashes and reports an error message: ``` munmap_chunk(): invalid pointer Aborted (core dumped) ``` **Expected behavior** I expected the NanoMQ process to reload the configuration file without crashing. **Actual Behavior** The NanoMQ process crashes and reports an error message: `munmap_chunk(): invalid pointer`. **To Reproduce** 1. Run `nanomq start --conf /etc/nanomq.conf` 2. Run `nanomq reload` **Environment Details** - NanoMQ version: 0.17.5 - Operating system and version: `Linux ccdecc0ea4a2 5.13.0-52-generic #59-Ubuntu SMP Wed Jun 15 20:17:13 UTC 2022 x86_64 GNU/Linux` - Compiler and language used: N/A - Testing scenario: N/A **Client SDK** N/A **Additional context** N/A
NanoMQ process crashes when reloading configuration file with 'munmap_chunk(): invalid pointer' error
https://api.github.com/repos/nanomq/nanomq/issues/1171/comments
1
2023-04-17T15:32:46Z
2023-04-19T03:02:39Z
https://github.com/nanomq/nanomq/issues/1171
1,671,462,760
1,171
[ "emqx", "nanomq" ]
**Describe the bug** Hi, there appears to be a new heap overflow vulnerability in the latest version of the program. (mqtt_parser.c:174) By School of Cyber Science and Technology, Shandong University **Expected behavior** When a specific message is sent, the server crashes. **Actual Behavior** When a specific message is sent, the server crashes. **To Reproduce** If possible include actual reproduction test code here. Minimal C test cases are perferred. ** Environment Details ** - NanoMQ version:master branch version commit #8c54cd7, NanoNNG Git Commit#971b7d02 **(newest)** - Operating system and version:Ubuntu 20.04 - Compiler and language used:gcc 9.4.0 clang 10.0.0 - testing scenario - start nanomq with ./nanomq start - Send the packet:nc 127.0.0.1 1883 < ./heap.raw - NanoMQ crashes ![image](https://user-images.githubusercontent.com/44093631/232226581-677349c6-b65a-4062-a234-63c8f59aaea1.png) [heap.zip](https://github.com/emqx/nanomq/files/11239589/heap.zip) **Additional context** Because the vulnerability types are different, I opened a separate issue that can be merged with other issues if necessary to make it easier to fix.
[Security]: Invalid property cause vulnerability
https://api.github.com/repos/nanomq/nanomq/issues/1169/comments
2
2023-04-15T13:26:40Z
2023-04-19T10:52:38Z
https://github.com/nanomq/nanomq/issues/1169
1,669,396,385
1,169
[ "emqx", "nanomq" ]
**Describe the bug** We have also found a SEGV in other locations, specifically replicating the information below. By School of Cyber Science and Technology, Shandong University **Expected behavior** When a specific publish message is sent, the server crashes. **Actual Behavior** When a specific publish message is sent, the server crashes. **To Reproduce** If possible include actual reproduction test code here. Minimal C test cases are perferred. ** Environment Details ** - NanoMQ version:master branch version commit #8c54cd7, NanoNNG Git Commit#971b7d02 **(newest)** - Operating system and version:Ubuntu 20.04 - Compiler and language used:gcc 9.4.0 clang 10.0.0 - testing scenario - start nanomq with ./nanomq start - Send the packet:nc 127.0.0.1 1883 < ./seg.raw - NanoMQ crashes ![image](https://user-images.githubusercontent.com/44093631/232226143-eeffb66a-1851-4f07-af8c-f71796d81681.png) [seg.zip](https://github.com/emqx/nanomq/files/11239577/seg.zip) **Additional context** Because the vulnerability types are different, I opened a separate issue that can be merged with other issues if necessary to make it easier to fix.
[Security]: Vulnerability in topic trie
https://api.github.com/repos/nanomq/nanomq/issues/1168/comments
0
2023-04-15T13:20:21Z
2023-04-18T03:58:10Z
https://github.com/nanomq/nanomq/issues/1168
1,669,392,636
1,168
[ "emqx", "nanomq" ]
**Describe the bug** We found that NanoMQ can cause a buffer overflow when it processes malformed messages. This vulnerability is different from Github Issue https://github.com/emqx/nanomq/issues/1154 Although a fix(https://github.com/nanomq/NanoNNG/pull/509) has been made for Github Issue https://github.com/emqx/nanomq/issues/1154, the problem has not been completely fixed. This seems to be triggered at different locations By School of Cyber Science and Technology, Shandong University **Expected behavior** If Asan is enabled at compile time, the NanoMQ crashes and displays ASAN information. **Actual Behavior** If Asan is enabled at compile time, the NanoMQ crashes and displays ASAN information, which can cause DOS. **To Reproduce** If possible include actual reproduction test code here. Minimal C test cases are perferred. **Environment Details** NanoMQ version:master branch version commit #8c54cd7, NanoNNG Git Commit#971b7d02 Operating system and version:Ubuntu 20.04 Compiler and language used:gcc 9.4.0 clang 10.0.0 testing scenario start nanomq with ./nanomq start Send the packet:nc 127.0.0.1 1883 < ./poc.raw NanoMQ crashes ![image](https://user-images.githubusercontent.com/44093631/232202898-af60cc70-635c-4610-b5d0-bfb77e4de301.png) [poc.zip](https://github.com/emqx/nanomq/files/11238923/poc.zip)
[Security]: Vulnerability in sub info list
https://api.github.com/repos/nanomq/nanomq/issues/1167/comments
7
2023-04-15T09:03:34Z
2023-05-21T15:49:15Z
https://github.com/nanomq/nanomq/issues/1167
1,669,254,202
1,167
[ "emqx", "nanomq" ]
**Describe the bug** Our team (School of Cyber Science and Technology, Shandong University)have found the a potential issue in the current version of nanomq,it may cause heap-use-after-free when it handles the publish messages **Expected behavior** We use ASAN to compile the target server, and when we send a large number of malformed data packets to it, it may crash and output the following information : ![image](https://user-images.githubusercontent.com/92987321/232107702-eb628585-c956-48fb-817f-e72c71c3edf4.png) the Call stack information is: ![image](https://user-images.githubusercontent.com/92987321/232110281-6445c4af-0e44-4b04-9f50-9682cef62c28.png) **Actual Behavior** Describe what occurred. **To Reproduce** we will provide the POC below to the developer for validation: [heap-use-after-free-poc.zip](https://github.com/emqx/nanomq/files/11235468/heap-use-after-free-poc.zip) ** Environment Details ** - NanoMQ version master branch version commit #8c54cd7 - Operating system and version Ubuntu 20.04 - Compiler and language used gcc 9.4.0 clang 10.0.0 - testing scenario start nanomq with ./nanomq start Send the packet:nc 127.0.0.1 1883 < heap-use-after-free-poc(Repeat multiple times) util cause NanoMQ crashes **Additional context** To trigger the issue, it is necessary to continuously replay the poc multiple times until nanomq crashes,it may need 2 - 15 times
[Security]: wrong protocol name & data racing
https://api.github.com/repos/nanomq/nanomq/issues/1165/comments
13
2023-04-14T17:23:19Z
2023-04-25T10:06:34Z
https://github.com/nanomq/nanomq/issues/1165
1,668,648,319
1,165
[ "emqx", "nanomq" ]
**Describe the bug** 您好,我们在NanoMQ当前版本中还发现了一项内存泄露,以下为详细漏洞信息以供开发人员参考。 School of Cyber Science and Technology, Shandong University **Expected behavior** 如果在编译时启用 ASAN,NanoMQ 会崩溃并显示 ASAN 信息。 ![image](https://user-images.githubusercontent.com/44093631/232076656-b9f891f5-6a0f-4018-ab19-a35cec93e74d.png) **To Reproduce** 1. start nanomq with ./nanomq start 2. Send the packet:nc 127.0.0.1 1883 < ./leak.raw 3. NanoMQ crashes [leak1.zip](https://github.com/emqx/nanomq/files/11234045/leak1.zip) ** Environment Details ** - NanoMQ version:master branch version commit #8c54cd7 - Operating system and version:Ubuntu 20.04 - Compiler and language used:gcc 9.4.0 clang 10.0.0 - testing scenario
potential memleak
https://api.github.com/repos/nanomq/nanomq/issues/1164/comments
2
2023-04-14T14:46:47Z
2023-04-15T07:50:40Z
https://github.com/nanomq/nanomq/issues/1164
1,668,392,801
1,164
[ "emqx", "nanomq" ]
**Describe the bug** We (School of Cyber Science and Technology, Shandong University) found that NanoMQ can cause buffer overflow when it processes malformed messages. This vulnerability is different from https://github.com/emqx/nanomq/issues/1153 and https://github.com/emqx/nanomq/issues/1154 **Expected behavior** If Asan is enabled at compile time, the NanoMQ crashes and displays ASAN information. **Actual Behavior** If Asan is enabled at compile time, the NanoMQ crashes and displays ASAN information, which can cause DOS. **To Reproduce** Similarly, we will send a vulnerability POC via email (jaylin@emqx.io) to help developers fix this vulnerability. ![image](https://user-images.githubusercontent.com/44093631/231415327-e5e23495-d13f-41f2-8c34-c345ced65e8f.png) **Environment Details** - NanoMQ version:master branch version commit #a72347c (As it is also the current HEAD version of [gitee](https://gitee.com/emqx/nanomq?_from=gitee_search) ) - Operating system and version:Ubuntu 20.04 - Compiler and language used:gcc 9.4.0 clang 10.0.0 - testing scenario 1. start nanomq with ./nanomq start 2. Send the packet:nc 127.0.0.1 1883 < ./poc3.raw 3. NanoMQ crashes
heap-buffer-overflow3 in NanoMQ
https://api.github.com/repos/nanomq/nanomq/issues/1155/comments
3
2023-04-12T09:29:05Z
2023-04-14T10:11:32Z
https://github.com/nanomq/nanomq/issues/1155
1,664,192,034
1,155
[ "emqx", "nanomq" ]
**Describe the bug** We (School of Cyber Science and Technology, Shandong University) found that NanoMQ can cause buffer overflow when it processes malformed SUBSCRIBE messages. This vulnerability is different from https://github.com/emqx/nanomq/issues/1153 **Expected behavior** If Asan is enabled at compile time, the NanoMQ crashes and displays ASAN information. **Actual Behavior** If Asan is enabled at compile time, the NanoMQ crashes and displays ASAN information, which can cause DOS. **To Reproduce** Similarly, we will send a vulnerability POC via email (jaylin@emqx.io) to help developers fix this vulnerability. ![image](https://user-images.githubusercontent.com/44093631/231413709-06fbbc79-46df-4b9b-b149-8369d50c9305.png) **Environment Details** - NanoMQ version:master branch version commit #a72347c (As it is also the current HEAD version of [gitee](https://gitee.com/emqx/nanomq?_from=gitee_search) ) - Operating system and version:Ubuntu 20.04 - Compiler and language used:gcc 9.4.0 clang 10.0.0 - testing scenario 1. start nanomq with ./nanomq start 2. Send the packet:nc 127.0.0.1 1883 < ./poc2.raw 3. NanoMQ crashes
heap-buffer-overflow2 in NanoMQ
https://api.github.com/repos/nanomq/nanomq/issues/1154/comments
2
2023-04-12T09:21:09Z
2023-04-19T06:43:53Z
https://github.com/nanomq/nanomq/issues/1154
1,664,179,606
1,154
[ "emqx", "nanomq" ]
**Describe the bug** We (School of Cyber Science and Technology, Shandong University) found that NanoMQ can cause buffer overflow when it processes malformed PUBLISH messages. **Expected behavior** If Asan is enabled at compile time, the NanoMQ crashes and displays ASAN information. ![image](https://user-images.githubusercontent.com/44093631/231410694-a3e662c2-ffb9-480f-86ab-66744864b4a5.png) **Actual Behavior** Describe what occurred. **To Reproduce** From a vulnerability disclosure point of view, I will email(jaylin@emqx.io) the POC to the developer for validation since it's possible to achieve at least a DoS pretty easily. ** Environment Details ** - NanoMQ version:master branch version commit #a72347c (As it is also the current HEAD version of [gitee](https://gitee.com/emqx/nanomq?_from=gitee_search) ) - Operating system and version:Ubuntu 20.04 - Compiler and language used:gcc 9.4.0 clang 10.0.0 - testing scenario 1. start nanomq with ./nanomq start 2. Send the packet:nc 127.0.0.1 1883 < ./poc.raw 3. NanoMQ crashes
[Security]: Vulnerability that are unecessary to be fixed
https://api.github.com/repos/nanomq/nanomq/issues/1153/comments
0
2023-04-12T09:10:25Z
2023-04-15T07:37:26Z
https://github.com/nanomq/nanomq/issues/1153
1,664,162,150
1,153
[ "emqx", "nanomq" ]
**Describe the bug** Executing the following command via shell on Linux Debian: `nanomq_cli pub --url "mqtt-tcp://127.0.0.1:1883" -t my/topic -m 'mymessage'` The result is: ``` > connect_cb: mqtt-tcp://127.0.0.1:1883 connect result: 0 > ``` **Expected behavior** The command should publish and **exit**. For reference, the `mosquitto_pub` command does exit at the end as expected. **Actual Behavior** The terminal hangs there. **To Reproduce** Just run the command above. **Environment Details** - NanoMQ version 0.15.0 - Debian Bookworm
nanomq_cli pub does not exit after publishing a message
https://api.github.com/repos/nanomq/nanomq/issues/1148/comments
2
2023-04-11T09:47:07Z
2023-04-19T07:39:12Z
https://github.com/nanomq/nanomq/issues/1148
1,662,126,882
1,148
[ "emqx", "nanomq" ]
**Describe the bug** Hconf reads an incorrect time from the config file. ``` --- a/etc/nanomq_example.conf +++ b/etc/nanomq_example.conf @@ -732,15 +732,15 @@ bridges.mqtt { ## Initial RTT: Initial RTT estimate. (ms) ## RTT: round trip time ## Default: 800ms >> this line qinitial_rtt_ms=800ms ``` When the initial rtt ms value in the config file was set to `800`. The value in runtime is 0. When the initial rtt ms value in the config file was set to `800ms`. The value in runtime is 74200. Only the initial rtt ms value in the config file was set to `800s`. The value in runtime is 800. **Expected behavior** **Actual Behavior** **To Reproduce** ** Environment Details ** - NanoMQ version - latest master branch - Operating system and version. osx - Compiler and language used. clang - testing scenario **Client SDK** **Additional context**
Hconf reads an incorrect time from the config file
https://api.github.com/repos/nanomq/nanomq/issues/1142/comments
0
2023-04-06T11:01:18Z
2023-04-06T11:08:27Z
https://github.com/nanomq/nanomq/issues/1142
1,657,202,070
1,142
[ "emqx", "nanomq" ]
**Describe the bug** ubuntu 18.04 arm32 system , install nanomq by : ``` git clone https://github.com/emqx/nanomq.git ; cd nanomq git submodule update --init --recursive mkdir build && cd build cmake -G Ninja .. ninja ``` run start to failed ``` ubuntu@ubuntu:~/nanomq/nanomq/build$ ./nanomq/nanomq start panic: getrandom failed This message is indicative of a BUG. Report this at https://github.com/emqx/nanomq Aborted ``` **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 ``` ubuntu@ubuntu:~/nanomq/nanomq/build$ ./nanomq/nanomq -h Usage: nanomq { start | stop | restart | reload } [--help] NanoMQ Messaging Engine for Edge Computing & Messaging bus v0.16.5-2 Copyright 2022 EMQ Edge Computing Team ``` - Operating system and version ``` ubuntu@ubuntu:~/nanomq/nanomq/build$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.6 LTS Release: 18.04 Codename: bionic ubuntu@ubuntu:~/nanomq/nanomq/build$ uname -a Linux ubuntu 3.10.65 #138 SMP PREEMPT Wed Mar 1 11:22:29 CST 2023 armv7l armv7l armv7l GNU/Linux ``` - Compiler and language used ``` Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/7/lto-wrapper Target: arm-linux-gnueabihf Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=arm-linux-gnueabihf- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-werror --enable-multilib --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf Thread model: posix gcc version 7.5.0 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) ubuntu@ubuntu:~/nanomq/nanomq/build$ ninja --version 1.12.0.git ubuntu@ubuntu:~/nanomq/nanomq/build$ dpkg -s cmake Package: cmake Status: install ok installed Priority: optional Section: devel Installed-Size: 21506 Maintainer: Kitware Debian Maintainers <debian@kitware.com> Architecture: armhf Multi-Arch: foreign Version: 3.25.2-0kitware1ubuntu18.04.1 Depends: cmake-data (= 3.25.2-0kitware1ubuntu18.04.1), procps, libc6 (>= 2.25), libgcc1 (>= 1:3.5), libssl1.1 (>= 1.1.1), libstdc++6 (>= 6) ```
ubuntu 18.04 arm32 system install with cmake & Ninja failed
https://api.github.com/repos/nanomq/nanomq/issues/1141/comments
1
2023-04-05T14:26:28Z
2024-02-26T10:19:09Z
https://github.com/nanomq/nanomq/issues/1141
1,655,734,000
1,141
[ "emqx", "nanomq" ]
**Describe the bug** nanomq_cli triggers memleak if sends a sub **Expected behavior** no memleak **Actual Behavior** suback is not freed currently, sending subscribe with nng_sendmsg and ignore suback would cause such problem. including nanosdk All users plz use nng_mqtt_subscribe_async with a aio callback to deal with suback before any new idea comes to my mind
nanomq_cli sub cause memleak & suback could be ignored
https://api.github.com/repos/nanomq/nanomq/issues/1138/comments
2
2023-04-04T11:34:36Z
2024-04-14T14:36:12Z
https://github.com/nanomq/nanomq/issues/1138
1,653,714,644
1,138
[ "emqx", "nanomq" ]
**Describe the bug** * The first error is that the file openssl/pem.h was not found when building with ninja. * The second error is that do not let cmake to find msquic from system env. (The log followed shows the cmake try to use the file /usr/local/include/msquic.h in system env.) **Expected behavior** No errors in building. **Actual Behavior** **To Reproduce** ** Environment Details ** - NanoMQ version latest - Operating system and version OSX - Compiler and language used Clang - testing scenario **Additional context** ``` logs are as follows. ninja  ✔  3s  ≡  [48/563] Building C object nng/CMakeFiles/nng_testing.dir/src/mqtt/protocol/mqtt/mqtt_client.c.o /Users/wangha/Documents/Git/nanomq/nng/src/mqtt/protocol/mqtt/mqtt_client.c:572:13: warning: unused variable 'msg' [-Wunused-variable] nni_msg * msg = NULL; ^ /Users/wangha/Documents/Git/nanomq/nng/src/mqtt/protocol/mqtt/mqtt_client.c:573:13: warning: unused variable 'aio' [-Wunused-variable] nni_aio * aio; ^ /Users/wangha/Documents/Git/nanomq/nng/src/mqtt/protocol/mqtt/mqtt_client.c:574:13: warning: unused variable 'pid' [-Wunused-variable] uint16_t pid = p->rid; ^ 3 warnings generated. [50/563] Building C object nng/CMakeFiles/nng_testing.dir/src/mqtt/protocol/mqtt/mqttv5_client.c.o /Users/wangha/Documents/Git/nanomq/nng/src/mqtt/protocol/mqtt/mqttv5_client.c:559:13: warning: unused variable 'msg' [-Wunused-variable] nni_msg * msg; ^ /Users/wangha/Documents/Git/nanomq/nng/src/mqtt/protocol/mqtt/mqttv5_client.c:560:13: warning: unused variable 'aio' [-Wunused-variable] nni_aio * aio; ^ /Users/wangha/Documents/Git/nanomq/nng/src/mqtt/protocol/mqtt/mqttv5_client.c:561:13: warning: unused variable 'pid' [-Wunused-variable] uint16_t pid = p->rid; ^ 3 warnings generated. [53/563] Building C object nng/CMakeFiles/nng_testing.dir/src/mqtt/transport/tcp/mqtt_tcp.c.o /Users/wangha/Documents/Git/nanomq/nng/src/mqtt/transport/tcp/mqtt_tcp.c:882:62: warning: expression result unused [-Wunused-value] p->qosmax == 1 ? (*header &= 0XF9) & (*header |= 0X02) : *header; ~~~~~~~~~~~~~~~~~ ^~~~~~~ 1 warning generated. [59/563] Building C object nng/CMakeFiles/nng_testing.dir/src/mqtt/protocol/mqtt/mqtt_quic.c.o /Users/wangha/Documents/Git/nanomq/nng/src/mqtt/protocol/mqtt/mqtt_quic.c:1534:11: warning: unused variable 'aio' [-Wunused-variable] nni_aio *aio; ^ /Users/wangha/Documents/Git/nanomq/nng/src/mqtt/protocol/mqtt/mqtt_quic.c:1997:3: warning: variable 'mqtt_sock' is uninitialized when used here [-Wuninitialized] mqtt_sock->bridge_conf = node; ^~~~~~~~~ /Users/wangha/Documents/Git/nanomq/nng/src/mqtt/protocol/mqtt/mqtt_quic.c:1993:29: note: initialize the variable 'mqtt_sock' to silence this warning mqtt_sock_t *mqtt_sock; ^ = NULL 2 warnings generated. [61/563] Building C object nng/CMakeFiles/nng_testing.dir/src/mqtt/transport/tls/mqtt_tls.c.o /Users/wangha/Documents/Git/nanomq/nng/src/mqtt/transport/tls/mqtt_tls.c:876:59: warning: expression result unused [-Wunused-value] p->qosmax == 1? (*header &= 0XF9) & (*header |= 0X02):*header; ~~~~~~~~~~~~~~~~~ ^~~~~~~ 1 warning generated. [73/563] Building C object nng/CMakeFiles/nng_testing.dir/src/sp/protocol/mqtt/auth_http.c.o /Users/wangha/Documents/Git/nanomq/nng/src/sp/protocol/mqtt/auth_http.c:242:3: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] sprintf(uri, "%s?%s", nng_http_req_get_uri(req), req_data); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg' #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) ^ 1 warning generated. [97/563] Building C object nng/CMakeFiles/nng_testing.dir/src/supplemental/http/http_server.c.o /Users/wangha/Documents/Git/nanomq/nng/src/supplemental/http/http_server.c:1570:3: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] sprintf(dst, "%s%s", NNG_PLATFORM_DIR_SEP, "index.html"); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg' #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) ^ 1 warning generated. [106/563] Building C object nng/CMakeFiles/nng_testing.dir/src/supplemental/mqtt/mqtt_qos_db.c.o /Users/wangha/Documents/Git/nanomq/nng/src/supplemental/mqtt/mqtt_qos_db.c:154:4: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] sprintf(dest_path, "%s/%s", pwd, db_name); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg' #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) ^ /Users/wangha/Documents/Git/nanomq/nng/src/supplemental/mqtt/mqtt_qos_db.c:160:4: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] sprintf(dest_path, "%s%s", user_path, db_name); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg' #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) ^ /Users/wangha/Documents/Git/nanomq/nng/src/supplemental/mqtt/mqtt_qos_db.c:162:4: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] sprintf(dest_path, "%s/%s", user_path, db_name); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg' #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) ^ /Users/wangha/Documents/Git/nanomq/nng/src/supplemental/mqtt/mqtt_qos_db.c:1255:63: warning: unused parameter 'proto_ver' [-Wunused-parameter] nni_mqtt_msg_serialize(nni_msg *msg, size_t *out_len, uint8_t proto_ver) ^ 4 warnings generated. [109/563] Building C object nng/CMakeFiles/nng_testing.dir/src/supplemental/nanolib/parser.c.o parser.y:170:29: warning: unused parameter 'jso' [-Wunused-parameter] void yyerror(struct cJSON **jso, const char *s) ^ 1 warning generated. [111/563] Building C object nng/CMakeFiles/nng_testing.dir/src/supplemental/nanolib/cJSON.c.o /Users/wangha/Documents/Git/nanomq/nng/src/supplemental/nanolib/cJSON.c:128:2: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] sprintf(version, "%i.%i.%i", CJSON_VERSION_MAJOR, CJSON_VERSION_MINOR, ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg' #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) ^ /Users/wangha/Documents/Git/nanomq/nng/src/supplemental/nanolib/cJSON.c:550:12: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] length = sprintf((char *) number_buffer, "null"); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg' #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) ^ /Users/wangha/Documents/Git/nanomq/nng/src/supplemental/nanolib/cJSON.c:554:12: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] length = sprintf((char *) number_buffer, "%1.15g", d); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg' #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) ^ /Users/wangha/Documents/Git/nanomq/nng/src/supplemental/nanolib/cJSON.c:560:13: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] length = sprintf((char *) number_buffer, "%1.17g", d); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg' #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) ^ /Users/wangha/Documents/Git/nanomq/nng/src/supplemental/nanolib/cJSON.c:959:5: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] sprintf((char *) output_pointer, "u%04x", ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg' #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) ^ 5 warnings generated. [117/563] Building C object nng/CMakeFiles/nng_testing.dir/src/supplemental/quic/quic_api.c.o FAILED: nng/CMakeFiles/nng_testing.dir/src/supplemental/quic/quic_api.c.o /Library/Developer/CommandLineTools/usr/bin/cc -DACL_SUPP -DASAN -DDEBUG -DENABLE_LOG -DLOG_USE_COLOR -DNANO_HIDDEN_VISIBILITY -DNANO_PLATFORM_DARWIN -DNANO_PLATFORM_POSIX -DNNG_ENABLE_STATS -DNNG_HAVE_ARC4RANDOM=1 -DNNG_HAVE_BACKTRACE=1 -DNNG_HAVE_BUS0 -DNNG_HAVE_FLOCK=1 -DNNG_HAVE_GETPEEREID=1 -DNNG_HAVE_KQUEUE=1 -DNNG_HAVE_LANGINFO=1 -DNNG_HAVE_LOCALPEERCRED=1 -DNNG_HAVE_LOCALPEERPID=1 -DNNG_HAVE_LOCKF=1 -DNNG_HAVE_MQTT_BROKER -DNNG_HAVE_MQTT_CLIENT -DNNG_HAVE_MQTT_QUIC_CLIENT -DNNG_HAVE_MSG_CONTROL=1 -DNNG_HAVE_PAIR0 -DNNG_HAVE_PAIR1 -DNNG_HAVE_PTHREAD_ATFORK_PTHREAD=1 -DNNG_HAVE_PTHREAD_SETNAME_NP=1 -DNNG_HAVE_PUB0 -DNNG_HAVE_PULL0 -DNNG_HAVE_PUSH0 -DNNG_HAVE_REP0 -DNNG_HAVE_REQ0 -DNNG_HAVE_RESPONDENT0 -DNNG_HAVE_SEMAPHORE_PTHREAD=1 -DNNG_HAVE_STDATOMIC=1 -DNNG_HAVE_STRCASECMP=1 -DNNG_HAVE_STRLCPY=1 -DNNG_HAVE_STRNCASECMP=1 -DNNG_HAVE_STRNLEN=1 -DNNG_HAVE_SUB0 -DNNG_HAVE_SURVEYOR0 -DNNG_HAVE_UNIX_SOCKETS=1 -DNNG_HIDDEN_VISIBILITY -DNNG_MAX_TASKQ_THREADS=16 -DNNG_PLATFORM_DARWIN -DNNG_PLATFORM_POSIX -DNNG_PRIVATE -DNNG_STATIC_LIB -DNNG_SUPP_HTTP -DNNG_SUPP_QUIC -DNNG_TEST_LIB -DNNG_TRANSPORT_INPROC -DNNG_TRANSPORT_IPC -DNNG_TRANSPORT_MQTT_BROKER_TCP -DNNG_TRANSPORT_MQTT_BROKER_TLS -DNNG_TRANSPORT_MQTT_BROKER_WS -DNNG_TRANSPORT_MQTT_BROKER_WSS -DNNG_TRANSPORT_MQTT_TCP -DNNG_TRANSPORT_MQTT_TLS -DNNG_TRANSPORT_TCP -DNNG_TRANSPORT_TLS -DNNG_TRANSPORT_WS -DNNG_TRANSPORT_WSS -DQUIC_API_ENABLE_PREVIEW_FEATURES -DQUIC_TLS_ENGINE_FINI=nng_quic_libs_fini_msquic -DQUIC_TLS_ENGINE_INIT=nng_quic_libs_init_msquic -DSUPP_BENCH -DSUPP_CLIENT -DSUPP_NNG_PROXY -DSUPP_QUIC -DSUPP_SYSLOG -D_GNU_SOURCE -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -D_THREAD_SAFE -I/Users/wangha/Documents/Git/nanomq/nng/src -I/Users/wangha/Documents/Git/nanomq/build/_deps/opensslquic-build/openssl/include -I/usr/local/include -I/Users/wangha/Documents/Git/nanomq/nng/src/testing -I/Users/wangha/Documents/Git/nanomq/nng/include -I/Users/wangha/Documents/Git/nanomq/nanolib/include -I/Users/wangha/Documents/Git/nanomq/nanomq/include -g -fsanitize=address -Wall -Wextra -fno-omit-frame-pointer -fsanitize=address -g -std=gnu99 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk -mmacosx-version-min=13.2 -MD -MT nng/CMakeFiles/nng_testing.dir/src/supplemental/quic/quic_api.c.o -MF nng/CMakeFiles/nng_testing.dir/src/supplemental/quic/quic_api.c.o.d -o nng/CMakeFiles/nng_testing.dir/src/supplemental/quic/quic_api.c.o -c /Users/wangha/Documents/Git/nanomq/nng/src/supplemental/quic/quic_api.c In file included from /Users/wangha/Documents/Git/nanomq/nng/src/supplemental/quic/quic_api.c:11: /usr/local/include/msquic.h:28:9: warning: unknown pragma ignored [-Wunknown-pragmas] #pragma warning(disable:4201) // nonstandard extension used: nameless struct/union ^ /usr/local/include/msquic.h:29:9: warning: unknown pragma ignored [-Wunknown-pragmas] #pragma warning(disable:4214) // nonstandard extension used: bit field types other than int ^ /Users/wangha/Documents/Git/nanomq/nng/src/supplemental/quic/quic_api.c:18:10: fatal error: 'openssl/pem.h' file not found #include "openssl/pem.h" ^~~~~~~~~~~~~~~ 2 warnings and 1 error generated. ```
2 errors in building with option -DNNG_ENABLE_QUIC=ON with ninja on osx
https://api.github.com/repos/nanomq/nanomq/issues/1133/comments
4
2023-04-04T07:39:11Z
2024-07-22T06:06:34Z
https://github.com/nanomq/nanomq/issues/1133
1,653,357,327
1,133
[ "emqx", "nanomq" ]
**Describe the bug** ``` ==7391==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x000103052cf1 at pc 0x0001007b8088 bp 0x00017062d210 sp 0x00017062c9d0 READ of size 2 at 0x000103052cf1 thread T15 2023-04-03 17:38:48 [7391] TRACE /Users/wangha/Documents/Git/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:603 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb 0x104207ac0 #0 0x1007b8084 in wrap_strlen+0x164 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x18084) (BuildId: 112043985f03370ebc205328b62c210a32000000200000000100000000000b00) #1 0x186443b8c in vsscanf_l+0xa0 (libsystem_c.dylib:arm64e+0xab8c) (BuildId: 14cd841b0c7b34a2a342cc6796ef925932000000200000000100000000020d00) #2 0x1007c0778 in wrap_sscanf+0x7c (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x20778) (BuildId: 112043985f03370ebc205328b62c210a32000000200000000100000000000b00) #3 0x1002619e8 in file_rotation log.c:208 #4 0x10026021c in file_callback log.c:88 #5 0x1002610d0 in log_log log.c:288 #6 0x100112c4c in nano_pipe_recv_cb nmq_mqtt.c:994 #7 0x1000a33f8 in nni_task_exec taskq.c:144 #8 0x10006f4b8 in nni_aio_finish_impl aio.c:454 #9 0x10006f50c in nni_aio_finish_sync aio.c:469 #10 0x10014d01c in tcptran_pipe_recv_cb broker_tcp.c:844 #11 0x1000a2cbc in nni_taskq_thread taskq.c:50 #12 0x1000a777c in nni_thr_wrap thread.c:94 #13 0x1000c9378 in nni_plat_thr_main posix_thread.c:266 #14 0x18657a068 in _pthread_start+0x90 (libsystem_pthread.dylib:arm64e+0x7068) (BuildId: 9f3b729aed043e65adacd75ad06ebbdc32000000200000000100000000020d00) #15 0x186574e28 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e28) (BuildId: 9f3b729aed043e65adacd75ad06ebbdc32000000200000000100000000020d00) 0x000103052cf1 is located 0 bytes to the right of 1-byte region [0x000103052cf0,0x000103052cf1) allocated by thread T15 here: #0 0x1007e2e68 in wrap_malloc+0x94 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x42e68) (BuildId: 112043985f03370ebc205328b62c210a32000000200000000100000000000b00) #1 0x1000ae1b0 in nni_alloc posix_alloc.c:20 #2 0x1000b0724 in nni_plat_file_get posix_file.c:119 #3 0x100261980 in file_rotation log.c:206 #4 0x10026021c in file_callback log.c:88 #5 0x1002610d0 in log_log log.c:288 #6 0x100112c4c in nano_pipe_recv_cb nmq_mqtt.c:994 #7 0x1000a33f8 in nni_task_exec taskq.c:144 #8 0x10006f4b8 in nni_aio_finish_impl aio.c:454 #9 0x10006f50c in nni_aio_finish_sync aio.c:469 #10 0x10014d01c in tcptran_pipe_recv_cb broker_tcp.c:844 #11 0x1000a2cbc in nni_taskq_thread taskq.c:50 #12 0x1000a777c in nni_thr_wrap thread.c:94 #13 0x1000c9378 in nni_plat_thr_main posix_thread.c:266 #14 0x18657a068 in _pthread_start+0x90 (libsystem_pthread.dylib:arm64e+0x7068) (BuildId: 9f3b729aed043e65adacd75ad06ebbdc32000000200000000100000000020d00) #15 0x186574e28 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e28) (BuildId: 9f3b729aed043e65adacd75ad06ebbdc32000000200000000100000000020d00) Thread T15 created by T0 here: #0 0x1007dcd2c in wrap_pthread_create+0x54 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x3cd2c) (BuildId: 112043985f03370ebc205328b62c210a32000000200000000100000000000b00) #1 0x1000c905c in nni_plat_thr_init posix_thread.c:279 #2 0x1000a73f4 in nni_thr_init thread.c:121 #3 0x1000a2924 in nni_taskq_init taskq.c:95 #4 0x1000a413c in nni_taskq_sys_init taskq.c:294 #5 0x10007a81c in nni_init_helper init.c:35 #6 0x1000c9840 in nni_plat_init posix_thread.c:422 #7 0x10007a804 in nni_init init.c:58 #8 0x100182f94 in nng_mtx_alloc platform.c:93 #9 0x100003bb0 in log_init mqtt_api.c:223 #10 0x10004b198 in broker_start broker.c:1592 #11 0x1000045fc in main nanomq.c:142 #12 0x18624fe4c (<unknown module>) SUMMARY: AddressSanitizer: heap-buffer-overflow (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x18084) (BuildId: 112043985f03370ebc205328b62c210a32000000200000000100000000000b00) in wrap_strlen+0x164 Shadow bytes around the buggy address: 0x00702062a540: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x00702062a550: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x00702062a560: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x00702062a570: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x00702062a580: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x00702062a590: fa fa fa fa fa fa fa fa fa fa fa fa fa fa[01]fa 0x00702062a5a0: fa fa 00 03 fa fa fd fa fa fa fa fa fa fa fa fa 0x00702062a5b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x00702062a5c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x00702062a5d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x00702062a5e0: 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 ``` **Expected behavior** logger works. **Actual Behavior** Errors happened in logger. **To Reproduce** ** Environment Details ** - NanoMQ version - Operating system and version - Compiler and language used - testing scenario **Client SDK** **Additional context**
Error in logging???
https://api.github.com/repos/nanomq/nanomq/issues/1132/comments
1
2023-04-03T09:43:46Z
2023-04-04T10:33:16Z
https://github.com/nanomq/nanomq/issues/1132
1,651,712,511
1,132
[ "emqx", "nanomq" ]
**Describe the bug** The connection was been closed by the NanoMQ when the client's subscription option nolocal is turned on **Expected behavior** Should not be closed! **Actual Behavior** Client;s connection was been closed by NanoMQ **To Reproduce** ``` diff --git a/src/sp/transport/mqtt/broker_tcp.c b/src/sp/transport/mqtt/broker_tcp.c index 1a843c90..5b6c8e8c 100644 --- a/src/sp/transport/mqtt/broker_tcp.c +++ b/src/sp/transport/mqtt/broker_tcp.c @@ -1353,6 +1353,14 @@ nmq_pipe_send_start_v5(tcptran_pipe *p, nni_msg *msg, nni_aio *aio) return; } } + if (niov == 0) { + // No local caused + nni_msg_free(msg); + nni_aio_set_prov_data(txaio, NULL); + nni_aio_set_msg(aio, NULL); + nni_aio_finish(aio, 0, 0); + return; + } nni_aio_set_iov(txaio, niov, iov); nng_stream_send(p->conn, txaio); return; ``` ** Environment Details ** - NanoMQ version - Operating system and version - Compiler and language used - 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.
The connection was closed by the broker when the client's subscription option nolocal is turned on
https://api.github.com/repos/nanomq/nanomq/issues/1131/comments
0
2023-04-03T08:28:44Z
2023-04-03T09:42:16Z
https://github.com/nanomq/nanomq/issues/1131
1,651,592,408
1,131
[ "emqx", "nanomq" ]
**Is your feature request related to a problem? Please describe.** It is easy to make mistakes when setting subscriptions counter. **Describe the solution you'd like** No subscriptions counter should be inputed.
It is easy to make mistakes when setting subscriptions counter.
https://api.github.com/repos/nanomq/nanomq/issues/1128/comments
2
2023-03-31T09:11:52Z
2023-04-18T08:23:44Z
https://github.com/nanomq/nanomq/issues/1128
1,648,998,688
1,128
[ "emqx", "nanomq" ]
**Describe the bug** Nanomq forwards the msgs of the topic with no local flag to the client self. **Expected behavior** No forward. **Actual Behavior** **To Reproduce** MQTTX or nanosdk. ** Environment Details ** - NanoMQ version latest - Operating system and version osx - Compiler and language used c - testing scenario **Client SDK** **Additional context**
Is no local function not supported?
https://api.github.com/repos/nanomq/nanomq/issues/1127/comments
0
2023-03-31T09:09:14Z
2023-04-01T04:22:47Z
https://github.com/nanomq/nanomq/issues/1127
1,648,994,405
1,127
[ "emqx", "nanomq" ]
**Is your feature request related to a problem? Please describe.** **Describe the solution you'd like** 2MiB as the default packet size would be better **Describe alternatives you've considered** **Additional context**
Are the default max_packet_size and client_max_packet_size in configuration too small?
https://api.github.com/repos/nanomq/nanomq/issues/1126/comments
0
2023-03-31T07:09:45Z
2023-05-11T07:05:57Z
https://github.com/nanomq/nanomq/issues/1126
1,648,803,224
1,126
[ "emqx", "nanomq" ]
**Describe the bug** Repeatedly calling nni_sock_find in nng_mqtt_quic_set_config. ``` int nng_mqtt_quic_open_keepalive(nng_socket *sock, const char *url, void *node) { nni_sock *nsock = NULL; conf_bridge_node *conf_node = node; int rv = 0; // Quic settings if ((rv = nni_proto_open(sock, &mqtt_msquic_proto)) == 0) { nni_sock_find(&nsock, sock->id); if (nsock) { // set bridge conf nng_mqtt_quic_set_config(sock, node); quic_open(); quic_proto_open(&mqtt_msquic_proto); quic_proto_set_bridge_conf(conf_node); quic_connect_ipv4(url, nsock, NULL); } else { rv = -1; } } nni_sock_rele(nsock); return rv; } int nng_mqtt_quic_set_config(nng_socket *sock, void *node) { nni_sock *nsock = NULL; conf_bridge_node *conf_node = node; mqtt_sock_t *mqtt_sock; nni_sock_find(&nsock, sock->id); if (nsock) { mqtt_sock = nni_sock_proto_data(nsock); mqtt_sock->bridge_conf = node; if (mqtt_sock->bridge_conf->multi_stream) { mqtt_sock->streams = nng_alloc(sizeof(nni_id_map)); nni_id_map_init( mqtt_sock->streams, 0x0000u, 0xffffu, true); } } else { return -1; } nni_sock_rele(nsock); return 0; } ``` **Expected behavior** No repeatedly calling. **Actual Behavior** **To Reproduce** ** Environment Details ** - NanoMQ version - Operating system and version - Compiler and language used - testing scenario **Client SDK** **Additional context**
Repeatedly calling nni_sock_find in nng_mqtt_quic_set_config
https://api.github.com/repos/nanomq/nanomq/issues/1107/comments
1
2023-03-20T07:33:21Z
2023-03-23T10:15:04Z
https://github.com/nanomq/nanomq/issues/1107
1,631,550,526
1,107
[ "emqx", "nanomq" ]
**Describe the bug** Uploading Windows package failed https://github.com/emqx/nanomq/actions/runs/4453184083/jobs/7823115785 I am begging you to have a look ~~ @Rory-Z
Github Action failed
https://api.github.com/repos/nanomq/nanomq/issues/1106/comments
1
2023-03-19T03:13:40Z
2023-04-27T10:38:55Z
https://github.com/nanomq/nanomq/issues/1106
1,630,756,351
1,106
[ "emqx", "nanomq" ]
[**Describe the bug** A clear and concise description of what the bug is. **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** 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. ](https://github.com/emqx/nanomq/actions/runs/4434345896)
Retain as publish is broken?
https://api.github.com/repos/nanomq/nanomq/issues/1103/comments
0
2023-03-17T05:00:14Z
2023-03-17T06:17:35Z
https://github.com/nanomq/nanomq/issues/1103
1,628,693,192
1,103
[ "emqx", "nanomq" ]
**Describe the bug** 无论是DEB源安装,还是Docker安装,都有如下错误,引起Nanomq进程僵死,无响应,日志报错。 1. 启动Nanomq服务 2. pub客户端连接并上报消息 3. Nanomq报错,并且无响应 以容器方式启动的命令如下: `docker run -d -p 1883:1883 -p 8883:8883 -v /etc/nanomq.conf:/etc/nanomq.conf --name nanomq emqx/nanomq` 容器的id: 6c61ba6cbe74c57e4a34638f0228f509d70d5b336bf5912d8b6fa637cf7717a6 **Expected behavior** 错误日志如下: ```bash 2023-03-16 04:28:38 [1] WARN /nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:450 nano_ctx_send: pipe 933801404 occupied! resending in cb! 2023-03-16 04:28:38 [1] WARN /nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:450 nano_ctx_send: pipe 933801404 occupied! resending in cb! 2023-03-16 04:28:54 [1] WARN /nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:450 nano_ctx_send: pipe 933801405 occupied! resending in cb! 2023-03-16 04:28:56 [1] WARN /nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:605 tcptran_pipe_recv_cb: nni aio recv error!! Connection shutdown 2023-03-16 04:28:56 [1] WARN /nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:853 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 139 2023-03-16 04:28:59 [1] WARN /nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:450 nano_ctx_send: pipe 933801406 occupied! resending in cb! 2023-03-16 04:29:03 [1] WARN /nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:605 tcptran_pipe_recv_cb: nni aio recv error!! Connection shutdown 2023-03-16 04:29:03 [1] WARN /nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:853 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 139 2023-03-16 04:29:28 [1] WARN /nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:396 nano_ctx_send: pipe id 933801404 is gone, pub failed ``` **Actual Behavior** /etc/nanomq.conf配置文件如下: ```bash # NanoMQ Configuration 0.14.0 # #============================================================ # # NanoMQ Broker # #============================================================ system { daemon = false num_taskq_thread = 0 max_taskq_thread = 0 parallel = 0 } mqtt.session { property_size = 32 max_packet_size = 1024 client_max_packet_size = 1024 msq_len = 2048 qos_duration = 10s keepalive_backoff = 1250 allow_anonymous = true } listeners.tcp { enable = true bind = "0.0.0.0:1883" } listeners.ssl { enable = false bind = "0.0.0.0:8883" keyfile = "/etc/certs/key.pem" certfile = "/etc/certs/cert.pem" cacertfile = "/etc/certs/cacert.pem" verify_peer = false fail_if_no_peer_cert = false } listeners.ws { enable = true bind = "0.0.0.0:8083/mqtt" } http_server { enable = true port = 8081 parallel = 2 username = admin password = xxx auth_type = basic jwt { public.keyfile = "/etc/certs/jwt/jwtRS256.key.pub" private.keyfile = "/etc/certs/jwt/jwtRS256.key" } } log { to = [file, console] level = warn dir = "/tmp" file = "nanomq.log" rotation { size = 100MB count = 5 } } sqlite { enable = true, disk_cache_size = 102400, mounted_file_path="/tmp/" flush_mem_threshold = 100 resend_interval = 5000 } webhook { enable = false url = "http://127.0.0.1:80" headers.content-type = "application/json" body.encoding = plain pool_size = 32 } webhook.rule.client.connect = [{action: on_client_connect}] webhook.rule.client.connack = [{action: on_client_connack}] webhook.rule.client.connected = [{action: on_client_connected}] webhook.rule.client.disconnected = [{action: on_client_disconnected}] webhook.rule.client.subscribe = [{action: on_client_subscribe}] webhook.rule.client.unsubscribe = [{action: on_client_unsubscribe}] webhook.rule.session.subscribed = [{action: on_session_subscribed}] webhook.rule.session.unsubscribed = [{action: on_session_unsubscribed}] webhook.rule.session.terminated = [{action: on_session_terminated}] webhook.rule.message.publish = [{action: on_message_publish}] webhook.rule.message.delivered = [{action: on_message_delivered}] webhook.rule.message.acked = [{action: on_message_acked}] authorization { no_match = allow deny_action = ignore cache = { enable = false max_size = 32 ttl = 1m } sources = [ { type = simple enable = true users = [ { username = "z2m" password = "xxx" } { username = "rule" password = "xxx" } ] }, { type = file enable = false rules = [ ## Allow MQTT client using username "dashboard" to subscribe to "$SYS/#" topics {"permit": "allow", "username": "dashboard", "action": "subscribe", "topics": ["$SYS/#"]} ## Deny "All Users" subscribe to "$SYS/#" "#" Topics {"permit": "deny", "username": "#", "action": "subscribe", "topics": ["$SYS/#", "#"]} ## Allow any other publish/subscribe operation {"permit": "allow"} ] }, { type = http enable = false auth_req { url = "http://127.0.0.1:80/mqtt/auth" method = post headers.content-type = "application/x-www-form-urlencoded" params = {clientid = "%c", username = "%u", password = "%p"} } super_req { url = "http://127.0.0.1:80/mqtt/superuser" method = "post" headers.content-type = "application/x-www-form-urlencoded" params = {clientid = "%c", username = "%u", password = "%p"} } acl_req { url = "http://127.0.0.1:8991/mqtt/acl" method = "post" headers.content-type = "application/x-www-form-urlencoded" params = {clientid = "%c", username = "%u", access = "%A", ipaddr = "%a", topic = "%t", mountpoint = "%m"} } timeout = 5s connect_timeout = 5s pool_size = 32 } ] } bridges.mqtt { nodes = [ { name = emqx enable = false connector { server = "mqtt-tcp://localhost:1883" proto_ver = 4 username = user password = pwd clean_start = true keepalive = 60s } forwards = ["topic1/#", "topic2/#"] quic_keepalive = 120s quic_idle_timeout = 120s quic_discon_timeout = 20s quic_handshake_timeout = 60s hybrid_bridging = false congestion_control = cubic subscription = [ { topic = "cmd/topic1" qos = 1 }, { topic = "cmd/topic2" qos = 2 } ] parallel = 2 max_send_queue_len = 1024 max_recv_queue_len = 1024 ssl { enable = false keyfile = "/etc/certs/key.pem" certfile = "/etc/certs/cert.pem" cacertfile = "/etc/certs/cacert.pem" } } ] sqlite { enable = false disk_cache_size = 102400 mounted_file_path = "/tmp/" flush_mem_threshold = 100 resend_interval = 5000 } } bridges.aws.nodes = [ { name = aws enable = false connector { server = "localhost:1883" proto_ver = 4 username = user password = pwd clientid = "aws_bridge_client" clean_start = true keepalive = 60s } forwards = ["topic1/#", "topic2/#"] subscription = [ { topic = "cmd/topic1" qos = 1 }, { topic = "cmd/topic2" qos = 2 } ] parallel = 2 ssl { enable = false keyfile = "/etc/certs/key.pem" certfile = "/etc/certs/cert.pem" cacertfile = "/etc/certs/cacert.pem" } } ] rules.option = OFF rules.sqlite { path = "/tmp/sqlite_rule.db" enable = false rules = [ { enable = true sql = "SELECT payload.x.y as y, payload.z as z FROM \"#\" WHERE y > 10 and z != 'str'" table = broker }, { enable = true sql = "SELECT topic, payload FROM \"abc\"" table = broker1 }, { enable = true sql = "SELECT * FROM \"#\" " table = broker2 } ] } rules.repub { enable = false rules = [ { enable = true server = "mqtt-tcp://localhost:1883" topic = "topic/repub1" proto_ver = 4 clientid = "repub_client1" keepalive = 60s clean_start = true username = username password = passwd sql = "SELECT payload.x.y as y, payload.z as z FROM \"#\" WHERE y > 10 and z != 'str'" }, { enable = true server = "mqtt-tcp://localhost:1883" topic = "topic/repub2" proto_ver = 4 clientid = "repub_client2" keepalive = 60s clean_start = true username = username password = passwd sql = "SELECT topic, payload FROM \"abc\"" } ] } rules.mysql { name = "mysql_rule_db" enable = false rules = [ { enable = true table = broker host = localhost username = username password = password sql = "SELECT payload.x.y as y, payload.z as z FROM \"#\" WHERE y > 10 and z != 'str'" }, { enable = true table = broker1 host = localhost username = username password = password sql = "SELECT * FROM \"abc\"" }, { enable = true table = broker2 host = localhost username = username password = password sql = "SELECT payload, qos FROM \"#\" WHERE qos > 0" } ] } ``` **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** 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.
Nanomq process suspend after run and topic publish
https://api.github.com/repos/nanomq/nanomq/issues/1102/comments
2
2023-03-16T04:39:24Z
2023-04-04T06:44:21Z
https://github.com/nanomq/nanomq/issues/1102
1,626,699,692
1,102
[ "emqx", "nanomq" ]
**Describe the bug** NanoMQ crash while resend mqtt V3.1.1 & mqtt v5 retain message to subscribe client; **Expected behavior** A clear and concise description of what you expected to happen. **Actual Behavior** Describe what occurred. **To Reproduce** configuration: `sqlite.enable = false` `nanomq start --conf nanomq.conf` 1. `mqttx pub -t "topic1/a/3" -m "this is a retain message1" -r -q 2 -V 5` 2. `mqttx pub -t "topic1/2/3" -m "this is a retain message2" -r -q 0 -V 3.1.1` 3. `mqttx sub -t "topic1/+/3"` ** Environment Details ** - NanoMQ version - Operating system and version - Compiler and language used - testing scenario **Client SDK** If possible include the mqtt sdk you used to connect to nanomq Minimal C test cases are perferred. **Additional context** ```bash 2023-03-12 11:28:28 [949971] DEBUG ../nanomq/apps/broker.c:336 server_cb: retain msg [0x60300002f330] size [2] AddressSanitizer:DEADLYSIGNAL ================================================================= ==949971==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000028 (pc 0x55d577747937 bp 0x7efcbd3ef6b0 sp 0x7efcbd3ef690 T16) ==949971==The signal is caused by a READ memory access. ==949971==Hint: address points to the zero page. #0 0x55d577747936 in nni_mqtt_msg_get_publish_property ../nng/src/supplemental/mqtt/mqtt_msg.c:145 #1 0x55d5777301d8 in nng_mqtt_msg_get_publish_property ../nng/src/supplemental/mqtt/mqtt_public.c:261 #2 0x55d57768dd97 in check_msg_exp ../nanomq/pub_handler.c:1666 #3 0x55d5776b35d4 in server_cb ../nanomq/apps/broker.c:341 #4 0x55d5776e83fe in nni_task_exec ../nng/src/core/taskq.c:144 #5 0x55d5776cb99e in nni_aio_finish_impl ../nng/src/core/aio.c:454 #6 0x55d5776cba20 in nni_aio_finish_sync ../nng/src/core/aio.c:469 #7 0x55d577714557 in nano_pipe_recv_cb ../nng/src/sp/protocol/mqtt/nmq_mqtt.c:1136 #8 0x55d5776e83fe in nni_task_exec ../nng/src/core/taskq.c:144 #9 0x55d5776cb99e in nni_aio_finish_impl ../nng/src/core/aio.c:454 #10 0x55d5776cba20 in nni_aio_finish_sync ../nng/src/core/aio.c:469 #11 0x55d577a349ad in tcptran_pipe_recv_cb ../nng/src/sp/transport/mqtt/broker_tcp.c:840 #12 0x55d5776e7c07 in nni_taskq_thread ../nng/src/core/taskq.c:50 #13 0x55d5776e8fa3 in nni_thr_wrap ../nng/src/core/thread.c:94 #14 0x55d5776f20ce in nni_plat_thr_main ../nng/src/platform/posix/posix_thread.c:266 #15 0x7efcc85d158f in start_thread nptl/pthread_create.c:463 #16 0x7efcc84f1222 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x119222) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV ../nng/src/supplemental/mqtt/mqtt_msg.c:145 in nni_mqtt_msg_get_publish_property Thread T16 (nng:task) created by T0 here: #0 0x7efcc8624805 in pthread_create (/lib/x86_64-linux-gnu/libasan.so.5+0x3a805) #1 0x55d5776f21fe in nni_plat_thr_init ../nng/src/platform/posix/posix_thread.c:279 #2 0x55d5776e924c in nni_thr_init ../nng/src/core/thread.c:121 #3 0x55d5776e7f28 in nni_taskq_init ../nng/src/core/taskq.c:95 #4 0x55d5776e8c73 in nni_taskq_sys_init ../nng/src/core/taskq.c:294 #5 0x55d5776d2d2a in nni_init_helper ../nng/src/core/init.c:35 #6 0x55d5776f2552 in nni_plat_init ../nng/src/platform/posix/posix_thread.c:422 #7 0x55d5776d2da8 in nni_init ../nng/src/core/init.c:58 #8 0x55d57772f381 in nng_mtx_alloc ../nng/src/supplemental/util/platform.c:93 #9 0x55d57768623f in log_init ../nanomq/mqtt_api.c:223 #10 0x55d5776bbd65 in broker_start ../nanomq/apps/broker.c:1590 #11 0x55d5776865d0 in main ../nanomq/nanomq.c:142 #12 0x7efcc8400cb1 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x28cb1) ==949971==ABORTING ```
NanoMQ crashes while resend mqtt V3.1.1 & mqtt v5 retain message to subscribe client (retain in memory)
https://api.github.com/repos/nanomq/nanomq/issues/1098/comments
0
2023-03-12T03:43:18Z
2023-03-14T02:55:09Z
https://github.com/nanomq/nanomq/issues/1098
1,620,223,195
1,098
[ "emqx", "nanomq" ]
**Describe the bug** Receiving MQTT V5 msg via bridging topic with retain flag is on. Another local client sub to this bridging topic **Expected behavior** retain msg is being delivered successfully. **Actual Behavior** heap buffer overflow
Data type incompatible
https://api.github.com/repos/nanomq/nanomq/issues/1095/comments
0
2023-03-10T10:26:53Z
2023-03-10T10:35:14Z
https://github.com/nanomq/nanomq/issues/1095
1,618,730,805
1,095
[ "emqx", "nanomq" ]
Hi, In case of `connector.proto_ver=5`, NanoMQ bridge mode can not forward messages from a remote broker, and shows `decode message failed`. On the other hand, in case of `connector.proto_ver=4`, no problem. NanoMQ bridge does not support MQTT ver5 ? ## Environment - NanoMQ version: 0.16.0 - Linux distribution: Archlinux ~~arm~~ x86_64 (all packages are latest) ## To Reproduce 1. Build NanoMQ ``` sudo rm -rf /var/tmp/nanomq-build && \ mkdir /var/tmp/nanomq-build && \ cd /var/tmp/nanomq-build && \ git clone https://github.com/emqx/nanomq.git -b 0.16.0 && \ cd nanomq && \ git submodule update --init --recursive && \ cmake -B build -G Ninja -DCMAKE_INSTALL_PREFIX="" \ -DENABLE_JWT=ON \ -DNNG_ENABLE_QUIC=ON && \ DESTDIR=/opt/local/nanomq sudo -E ninja -C build install ``` 2. Edit `nanomq.conf` Just change only the following settings. ``` bridge.mqtt.nodes[0].connector.server = "mqtt-tcp://broker.emqx.io:1883" bridge.mqtt.nodes[0].connector.proto_ver = 5 bridge.mqtt.nodes[0].congestion_control = "bbr" bridge.mqtt.nodes[0].forwards = ["fwd-topic/1/#", "fwd-topic/2/#"] bridge.mqtt.nodes[0].subscription = [ { topic = "sub-topic/1/#" qos = 1 } { topic = "sub-topic/2/#" qos = 2 } ] ``` 3. Start NanoMQ ``` /opt/local/nanomq/bin/nanomq start --conf the_edited_config_file ``` 4. Client X connects the NanoMQ, and subscribes `sub-topic/2/xxx` with OoS=2. 4. Client Y connects `broker.emqx.io:1883`, and publishes a message to `sub-topic/2/xxx`. 6. Result No messages arrives on Client X subscription `sub-topic/2/xxx`. NanoMQ console log shows the following line. ``` 2023-03-09 17:43:24 [210596] WARN /var/tmp/nanomq-build/nanomq/nanomq/pub_handler.c:1082 handle_pub: decode message failed. ``` Thanks.
NanoMQ bridge can not forward messages from remote broker (proto version 5)
https://api.github.com/repos/nanomq/nanomq/issues/1093/comments
7
2023-03-09T09:13:34Z
2023-03-17T00:03:08Z
https://github.com/nanomq/nanomq/issues/1093
1,616,761,302
1,093
[ "emqx", "nanomq" ]
About NanoMQ bridge mode. Currently, NanoMQ bridge mode does not support Last Will message when remote connection is broken. It would be nice if Last Will related parameters can be configured for remote bridge connection. - will topic - will payload May be plain text or json. - will qos - will retain - will delay interval - will message expiry interval - others? payload format indicator, content type, user property, response topic, correlation data It seems bridge connection code is [bridge.c](https://github.com/emqx/nanomq/blob/master/nanomq/bridge.c ). But I'm not familiar with C. Sorry.. Thanks.
Last Will message when remote bridge connection is broken
https://api.github.com/repos/nanomq/nanomq/issues/1091/comments
2
2023-03-09T06:59:27Z
2023-04-27T10:38:38Z
https://github.com/nanomq/nanomq/issues/1091
1,616,550,554
1,091
[ "emqx", "nanomq" ]
**Describe the bug** (https://github.com/emqx/nanomq/actions/runs/4328861530/jobs/7558953427) OpenSSL dependency breaks CMake Need to configute the OpenSSL in msuiqc for cross-compiling
Build action failed
https://api.github.com/repos/nanomq/nanomq/issues/1081/comments
1
2023-03-04T04:16:46Z
2023-03-06T03:35:00Z
https://github.com/nanomq/nanomq/issues/1081
1,609,592,878
1,081
[ "emqx", "nanomq" ]
Is there any api to change bridging subscriptions dynamically ?
Dynamic bridging subscription
https://api.github.com/repos/nanomq/nanomq/issues/1078/comments
3
2023-02-23T08:42:38Z
2023-10-11T03:28:39Z
https://github.com/nanomq/nanomq/issues/1078
1,596,442,871
1,078
[ "emqx", "nanomq" ]
**Describe the bug** I am using nanomq briding between my emqx server and my app. My app publish messages successfully over nanomq but Other app publish message to my app(subscriptions over nanomq), message cames to my app and nanomq container closing simultaneously. I try different topic and different message data but result is same. I share logs and nanomq.conf file below. [nanomq-logs.txt](https://github.com/emqx/nanomq/files/10809303/nanomq-logs.txt) [nanomq.c ![photo_2023-02-23_03-22-28](https://user-images.githubusercontent.com/33575745/220794300-eb5600ef-ec85-4de8-853c-c7fe1195905f.jpg) onf.txt](https://github.com/emqx/nanomq/files/10809304/nanomq.conf.txt)
Nanomq container stop after take message
https://api.github.com/repos/nanomq/nanomq/issues/1077/comments
2
2023-02-23T00:23:14Z
2023-02-23T08:33:14Z
https://github.com/nanomq/nanomq/issues/1077
1,596,032,604
1,077
[ "emqx", "nanomq" ]
null
Build sqlite in the container in the next version
https://api.github.com/repos/nanomq/nanomq/issues/1076/comments
1
2023-02-22T03:40:06Z
2024-02-26T10:20:29Z
https://github.com/nanomq/nanomq/issues/1076
1,594,405,577
1,076
[ "emqx", "nanomq" ]
**Describe the bug** Through fuzzing NanoMQ we(@mfloto and me) discovered a packet that causes a double free when tcptran_pipe_recv_cb calls property_free, which leads to the application crashing instantly. Running it with Valgrind also reveals that there is be a heap-use-after-free, which is also confirmed by building with `cmake -G Ninja -DDEBUG=ON -DTSAN=ON ..`. We also noticed that the application routinely got to the point where it would just not respond to packets anymore despite running. **Expected behavior** The Application should send a Connection Acknowledgement Packet with bad Authentication Method or something similar. **Actual Behavior** NanoMQ sends back this Connection Acknowledgement with reason Code success: ``` ConnectAck(ConnectAckPacket { session_present: false, reason_code: Success, session_expiry_interval: None, receive_maximum: None, maximum_qos: None, retain_available: None, maximum_packet_size: None, assigned_client_identifier: None, topic_alias_maximum: Some(TopicAliasMaximum(59939)), reason_string: None, user_properties: [], wildcard_subscription_available: None, subscription_identifiers_available: None, shared_subscription_available: None, server_keep_alive: None, response_information: None, server_reference: None, authentication_method: Some(AuthenticationMethod("bcRUdmSDYuwbV62")), authentication_data: Some(AuthenticationData(b"H7FOxM")) }) ``` Also the [log with trace log_level](https://gist.github.com/Nereuxofficial/d53118451a25eb629f23a6d6350fdc74) **To Reproduce** If possible i would like to avoid putting the PoC for this bug out in public since it's possible to achieve at least a DoS pretty easily. I couldn't find a Security.md or a way to report this better so i am opening up this issue but if possible i would like to send the code privately. If that is not possible i can of course provide it in this issue Also as i am pretty bad at writing C so I would like to write it in Zig but it would be pretty trivial to translate to C. **Environment Details** - NanoMQ version: master branch commit 20f436a3b9d45f9809d7c7f0714905c657354631 (As of writing this is current HEAD) - Tested on: x86_64 Linux 6.1.11-100.fc36.x86_64, 5.15.79.1-microsoft-standard-WSL2 - Compiler and language tested: gcc (GCC) 12.2.1 20230201, clang version 15.0.7, gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0 - Testing scenario: 1. start nanomq with `./nanomq start` 2. Send the packet 3. NanoMQ sends the Connack 4. NanoMQ crashes **Client SDK** [MQTT-broker](https://github.com/bschwind/mqtt-broker) was used to decode the ConnAck but we wrote the raw bytes to the tcp stream
Double free of Properties/heap-use after Free
https://api.github.com/repos/nanomq/nanomq/issues/1075/comments
3
2023-02-21T10:36:01Z
2023-02-22T00:11:34Z
https://github.com/nanomq/nanomq/issues/1075
1,593,232,780
1,075
[ "emqx", "nanomq" ]
**Describe the bug** curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/subscriptions" calling subscriptions info API triggers it. **Expected behavior** nothing, just give sub info back **Actual Behavior** ==435227==ERROR: AddressSanitizer: heap-use-after-free on address 0x603000023600 at pc 0x55abae2d64a7 bp 0x7f21c60f4660 sp 0x7f21c60f4650 READ of size 8 at 0x603000023600 thread T11 #0 0x55abae2d64a6 in dbhash_copy_topic_queue /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/supplemental/nanolib/hash_table.c:401 #1 0x55abadf7e3f7 in get_subscriptions /home/jaylin/Projects/EdgeComputing/nanomq/nanomq/rest_api.c:1130 #2 0x55abadf78f5e in process_request /home/jaylin/Projects/EdgeComputing/nanomq/nanomq/rest_api.c:734 #3 0x55abadf8d6cb in inproc_cb /home/jaylin/Projects/EdgeComputing/nanomq/nanomq/web_server.c:407 #4 0x55abadfd44a2 in nni_task_exec /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/taskq.c:144 #5 0x55abadfb773c in nni_aio_finish_impl /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/aio.c:454 #6 0x55abadfb77be in nni_aio_finish_sync /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/aio.c:469 #7 0x55abadff7a69 in rep0_pipe_recv_cb /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/sp/protocol/reqrep0/rep.c:564 #8 0x55abadfd3caa in nni_taskq_thread /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/taskq.c:50 #9 0x55abadfd5062 in nni_thr_wrap /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/thread.c:94 #10 0x55abadfde217 in nni_plat_thr_main /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/platform/posix/posix_thread.c:266 #11 0x7f21cf48ab42 in start_thread nptl/pthread_create.c:442 #12 0x7f21cf51c9ff (/lib/x86_64-linux-gnu/libc.so.6+0x1269ff) 0x603000023600 is located 16 bytes inside of 24-byte region [0x6030000235f0,0x603000023608) freed by thread T18 here: #0 0x7f21d023b517 in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:127 #1 0x55abadfd98d9 in nni_free /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/platform/posix/posix_alloc.c:33 #2 0x55abadfa87bf in nng_free /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/nng.c:78 #3 0x55abadf7e5da in get_subscriptions /home/jaylin/Projects/EdgeComputing/nanomq/nanomq/rest_api.c:1147 #4 0x55abadf78f5e in process_request /home/jaylin/Projects/EdgeComputing/nanomq/nanomq/rest_api.c:734 #5 0x55abadf8d6cb in inproc_cb /home/jaylin/Projects/EdgeComputing/nanomq/nanomq/web_server.c:407 #6 0x55abadfd44a2 in nni_task_exec /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/taskq.c:144 #7 0x55abadfb773c in nni_aio_finish_impl /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/aio.c:454 #8 0x55abadfb77be in nni_aio_finish_sync /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/aio.c:469 #9 0x55abadff7a69 in rep0_pipe_recv_cb /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/sp/protocol/reqrep0/rep.c:564 #10 0x55abadfd3caa in nni_taskq_thread /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/taskq.c:50 #11 0x55abadfd5062 in nni_thr_wrap /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/thread.c:94 #12 0x55abadfde217 in nni_plat_thr_main /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/platform/posix/posix_thread.c:266 #13 0x7f21cf48ab42 in start_thread nptl/pthread_create.c:442 previously allocated by thread T7 here: #0 0x7f21d023b867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145 #1 0x55abae2d596b in new_topic_queue /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/supplemental/nanolib/hash_table.c:246 #2 0x55abae2d5d2a in dbhash_insert_topic /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/supplemental/nanolib/hash_table.c:291 #3 0x55abadf72a52 in sub_ctx_handle /home/jaylin/Projects/EdgeComputing/nanomq/nanomq/sub_handler.c:281 #4 0x55abadf9e73a in server_cb /home/jaylin/Projects/EdgeComputing/nanomq/nanomq/apps/broker.c:313 #5 0x55abadfd44a2 in nni_task_exec /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/taskq.c:144 #6 0x55abadfb773c in nni_aio_finish_impl /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/aio.c:454 #7 0x55abadfb77be in nni_aio_finish_sync /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/aio.c:469 #8 0x55abae00a182 in nano_pipe_recv_cb /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1136 #9 0x55abadfd44a2 in nni_task_exec /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/taskq.c:144 #10 0x55abadfb773c in nni_aio_finish_impl /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/aio.c:454 #11 0x55abadfb77be in nni_aio_finish_sync /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/aio.c:469 #12 0x55abae34703c in tcptran_pipe_recv_cb /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:839 #13 0x55abadfd3caa in nni_taskq_thread /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/taskq.c:50 #14 0x55abadfd5062 in nni_thr_wrap /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/thread.c:94 #15 0x55abadfde217 in nni_plat_thr_main /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/platform/posix/posix_thread.c:266 #16 0x7f21cf48ab42 in start_thread nptl/pthread_create.c:442 Thread T11 created by T0 here: #0 0x7f21d01df685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216 #1 0x55abadfde347 in nni_plat_thr_init /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x55abadfd530e in nni_thr_init /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/thread.c:121 #3 0x55abadfd3fcc in nni_taskq_init /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/taskq.c:95 #4 0x55abadfd4d2c in nni_taskq_sys_init /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/taskq.c:294 #5 0x55abadfbea53 in nni_init_helper /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/init.c:35 #6 0x55abadfde6ec in nni_plat_init /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x55abadfbead4 in nni_init /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/init.c:58 #8 0x55abae02b009 in nng_mtx_alloc /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/supplemental/util/platform.c:93 #9 0x55abadf5f6f6 in log_init /home/jaylin/Projects/EdgeComputing/nanomq/nanomq/mqtt_api.c:223 #10 0x55abadfa7bdf in broker_start /home/jaylin/Projects/EdgeComputing/nanomq/nanomq/apps/broker.c:1587 #11 0x55abadf5fa9f in main /home/jaylin/Projects/EdgeComputing/nanomq/nanomq/nanomq.c:142 #12 0x7f21cf41fd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 Thread T18 created by T0 here: #0 0x7f21d01df685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216 #1 0x55abadfde347 in nni_plat_thr_init /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x55abadfd530e in nni_thr_init /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/thread.c:121 #3 0x55abadfd3fcc in nni_taskq_init /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/taskq.c:95 #4 0x55abadfd4d2c in nni_taskq_sys_init /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/taskq.c:294 #5 0x55abadfbea53 in nni_init_helper /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/init.c:35 #6 0x55abadfde6ec in nni_plat_init /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x55abadfbead4 in nni_init /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/init.c:58 #8 0x55abae02b009 in nng_mtx_alloc /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/supplemental/util/platform.c:93 #9 0x55abadf5f6f6 in log_init /home/jaylin/Projects/EdgeComputing/nanomq/nanomq/mqtt_api.c:223 #10 0x55abadfa7bdf in broker_start /home/jaylin/Projects/EdgeComputing/nanomq/nanomq/apps/broker.c:1587 #11 0x55abadf5fa9f in main /home/jaylin/Projects/EdgeComputing/nanomq/nanomq/nanomq.c:142 #12 0x7f21cf41fd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 Thread T7 created by T0 here: #0 0x7f21d01df685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216 #1 0x55abadfde347 in nni_plat_thr_init /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x55abadfd530e in nni_thr_init /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/thread.c:121 #3 0x55abadfd3fcc in nni_taskq_init /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/taskq.c:95 #4 0x55abadfd4d2c in nni_taskq_sys_init /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/taskq.c:294 #5 0x55abadfbea53 in nni_init_helper /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/init.c:35 #6 0x55abadfde6ec in nni_plat_init /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x55abadfbead4 in nni_init /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/core/init.c:58 #8 0x55abae02b009 in nng_mtx_alloc /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/supplemental/util/platform.c:93 #9 0x55abadf5f6f6 in log_init /home/jaylin/Projects/EdgeComputing/nanomq/nanomq/mqtt_api.c:223 #10 0x55abadfa7bdf in broker_start /home/jaylin/Projects/EdgeComputing/nanomq/nanomq/apps/broker.c:1587 #11 0x55abadf5fa9f in main /home/jaylin/Projects/EdgeComputing/nanomq/nanomq/nanomq.c:142 #12 0x7f21cf41fd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 SUMMARY: AddressSanitizer: heap-use-after-free /home/jaylin/Projects/EdgeComputing/nanomq/nng/src/supplemental/nanolib/hash_table.c:401 in dbhash_copy_topic_queue Shadow bytes around the buggy address: 0x0c067fffc670: fd fd fd fa fa fa fd fd fd fa fa fa fd fd fd fa 0x0c067fffc680: fa fa fd fd fd fa fa fa fd fd fd fa fa fa fd fd 0x0c067fffc690: fd fa fa fa fd fd fd fd fa fa fd fd fd fa fa fa 0x0c067fffc6a0: 00 00 00 00 fa fa 00 00 00 fa fa fa 00 00 00 fa 0x0c067fffc6b0: fa fa 00 00 00 fa fa fa 00 00 04 fa fa fa fd fd =>0x0c067fffc6c0:[fd]fa fa fa fd fd fd fa fa fa fd fd fd fa fa fa 0x0c067fffc6d0: fd fd fd fd fa fa fd fd fd fa fa fa fd fd fd fd 0x0c067fffc6e0: fa fa fd fd fd fa fa fa fd fd fd fd fa fa fd fd 0x0c067fffc6f0: fd fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fffc700: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fffc710: 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 ==435227==ABORTING **To Reproduce** connect a client & sub to aa-proxy/deliver/request/14b1d08c-3d52-444b-9289-bee5a3d3ed67 ** Environment Details ** - NanoMQ version 0.15.5
api/v4/subscriptions is broken
https://api.github.com/repos/nanomq/nanomq/issues/1073/comments
0
2023-02-20T10:29:06Z
2023-02-21T08:04:59Z
https://github.com/nanomq/nanomq/issues/1073
1,591,571,763
1,073
[ "emqx", "nanomq" ]
**Describe the bug** Build nanomq with: - `-DBUILD_DDS_PROXY=ON -DENABLE_RULE_ENGINE=ON ...` - `-DBUILD_DDS_PROXY=ON -DBUILD_ZMQ_GATEWAY=ON ...` **Expected behavior** Successful build. **Actual Behavior** Build failed with: ```sh > duplicate symbol '_fatal' in: > nanomq_cli/CMakeFiles/nanomq_cli.dir/dds2mqtt/mqtt_client.c.o > nanomq_cli/CMakeFiles/nanomq_cli.dir/rule_ctrl.c.o ``` or ```sh > duplicate symbol '_client_publish' in: > nanomq_cli/CMakeFiles/nanomq_cli.dir/dds2mqtt/mqtt_client.c.o > nanomq_cli/CMakeFiles/nanomq_cli.dir/zmq_gateway.c.o ``` **Environment Details** - NanoMQ 0.5.15 - NixOS
Enabling DDS proxy conflicts with other build options
https://api.github.com/repos/nanomq/nanomq/issues/1070/comments
2
2023-02-18T21:30:31Z
2023-02-20T05:11:53Z
https://github.com/nanomq/nanomq/issues/1070
1,590,476,285
1,070
[ "emqx", "nanomq" ]
**Is your feature request related to a problem? Please describe.** I see that there is a property to allow anonymous login, which could be interesting to enable per listener . This way we could define something like: 127.0.0.1:1883 allow_anonymous=true 0.0.0.0:8883 allow_anonymous=false which seems to be more secure. **Describe the solution you'd like** I would like to be able to set this feature per listener. **Describe alternatives you've considered** I know as work around, ACL can be set to allow localhost connections, but this would require allow anonymous connections globally ``` ## Allow connections from Localhost {"permit": "allow", "ipaddr": "127.0.0.1", "action": "pubsub", "topics": ["$SYS/#", "#"]} ```
allow anonymous login to be set per listener, not globally
https://api.github.com/repos/nanomq/nanomq/issues/1068/comments
3
2023-02-17T09:50:57Z
2024-07-22T06:11:30Z
https://github.com/nanomq/nanomq/issues/1068
1,589,059,393
1,068
[ "emqx", "nanomq" ]
This is a critical bug that will be triggered in multi-channel/loopback bridging scenario
NULL bridge_aio in extra(bridge) ctx
https://api.github.com/repos/nanomq/nanomq/issues/1064/comments
2
2023-02-17T03:54:37Z
2023-04-23T11:08:38Z
https://github.com/nanomq/nanomq/issues/1064
1,588,710,230
1,064
[ "emqx", "nanomq" ]
**Describe the bug** A clear and concise description of what the bug is. **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** 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.
The broker does not seem to handle SIGTERM properly.
https://api.github.com/repos/nanomq/nanomq/issues/1062/comments
1
2023-02-16T08:36:02Z
2023-11-13T03:50:56Z
https://github.com/nanomq/nanomq/issues/1062
1,587,258,069
1,062
[ "emqx", "nanomq" ]
File: [/docs/zh_CN/README.md](https://nanomq.io/docs/zh/latest/) ···[NanoMQ (opens new window)](https://nanomq.io/zh)NanoMQ 致力于解决这些问题···
错误的描述信息
https://api.github.com/repos/nanomq/nanomq/issues/1061/comments
4
2023-02-16T01:26:02Z
2023-02-20T07:11:24Z
https://github.com/nanomq/nanomq/issues/1061
1,586,842,098
1,061
[ "emqx", "nanomq" ]
**Describe the bug** windows平台,连接服务后直接执行消息发布,执行多次发布操作后服务进程闪退 **Expected behavior** 服务进程正常运行 **Actual Behavior** 服务进程异常退出 ** Environment Details ** - NanoMQ v0.15.2 - windows 11 **Additional context** 1. 启动服务 2. 向一个topic发布消息 3. 订阅该topic 4. 继续向topic发布消息x2
Incompatible on Windows 11
https://api.github.com/repos/nanomq/nanomq/issues/1057/comments
1
2023-02-14T00:54:54Z
2023-02-14T03:19:29Z
https://github.com/nanomq/nanomq/issues/1057
1,583,305,586
1,057
[ "emqx", "nanomq" ]
Connection not working with some clients like []()https://github.com/marvinroger/async-mqtt-client and other clients downloaded from apple store but same time working with some Android clients
Not Connecting with some clients
https://api.github.com/repos/nanomq/nanomq/issues/1056/comments
4
2023-02-13T12:17:15Z
2024-01-23T04:23:24Z
https://github.com/nanomq/nanomq/issues/1056
1,582,245,043
1,056
[ "emqx", "nanomq" ]
- When handling the issue, the character limit was 65536 bytes, so the issue was handled in two parts. **Describe the bug** I have acquired many asan logs, but it takes too much time to analyze them all, so I will only attach the logs. **Expected behavior** A clear and concise description of what you expected to happen. **Actual Behavior** **To Reproduce** Heap Overflow & Use After Free Bugs - target-1675834892.645183 - target file : [target-1675834892.645183.txt](https://github.com/emqx/nanomq/files/10704564/target-1675834892.645183.txt) ``` ================================================================= ==106026==ERROR: AddressSanitizer: heap-use-after-free on address 0x611000021744 at pc 0x55f1b85f79d6 bp 0x7f5f296f2900 sp 0x7f5f296f28f0 READ of size 1 at 0x611000021744 thread T13 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1040 nano_pipe_recv_cb: qos msg not found! 2023-02-08 14:41:32 [106026] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1040 nano_pipe_recv_cb: qos msg not found! 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] INFO /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/sub_handler.c:81 decode_sub_msg: topic: [$SYS/#] len: [6] 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:436 nano_ctx_send: pipe 1555308216 occupied! resending in cb! 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:436 nano_ctx_send: pipe 1555308216 occupied! resending in cb! 2023-02-08 14:41:32 [106026] INFO /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/sub_handler.c:81 decode_sub_msg: topic: [$SYS/#] len: [6] 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:393 nano_ctx_send: pipe id 1555308216 is gone, pub failed 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:393 nano_ctx_send: pipe id 1555308216 is gone, pub failed 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:393 nano_ctx_send: pipe id 1555308217 is gone, pub failed 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:393 nano_ctx_send: pipe id 1555308217 is gone, pub failed 2023-02-08 14:41:32 [106026] INFO /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/sub_handler.c:81 decode_sub_msg: topic: [$SYS/#] len: [6] 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:393 nano_ctx_send: pipe id 1555308218 is gone, pub failed 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:393 nano_ctx_send: pipe id 1555308218 is gone, pub failed 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1040 nano_pipe_recv_cb: qos msg not found! 2023-02-08 14:41:32 [106026] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1040 nano_pipe_recv_cb: qos msg not found! 2023-02-08 14:41:32 [106026] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1040 nano_pipe_recv_cb: qos msg not found! 2023-02-08 14:41:32 [106026] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1040 nano_pipe_recv_cb: qos msg not found! 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1040 nano_pipe_recv_cb: qos msg not found! 2023-02-08 14:41:32 [106026] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1040 nano_pipe_recv_cb: qos msg not found! 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 #0 0x55f1b85f79d5 in nano_pipe_recv_cb /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:988 #1 0x55f1b85ce227 in nni_task_exec /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:144 #2 0x55f1b85b174e in nni_aio_finish_impl /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/aio.c:454 #3 0x55f1b85b17d0 in nni_aio_finish_sync /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/aio.c:469 #4 0x55f1b86d1d09 in tcptran_pipe_recv_cb /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:805 #5 0x55f1b85cda2f in nni_taskq_thread /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:50 #6 0x55f1b85cede7 in nni_thr_wrap /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:94 #7 0x55f1b85d7f9c in nni_plat_thr_main /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:266 #8 0x7f5f33072b42 in start_thread nptl/pthread_create.c:442 #9 0x7f5f331049ff (/lib/x86_64-linux-gnu/libc.so.6+0x1269ff) 0x611000021744 is located 4 bytes inside of 256-byte region [0x611000021740,0x611000021840) freed by thread T12 here: #0 0x7f5f332de517 in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:127 #1 0x55f1b85d365e in nni_free /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_alloc.c:33 #2 0x55f1b85a27d1 in nng_free /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/nng.c:78 #3 0x55f1b85ec80e in conn_param_free /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:867 #4 0x55f1b859b1ba in server_cb /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:534 #5 0x55f1b85cda2f in nni_taskq_thread /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:50 #6 0x55f1b85cede7 in nni_thr_wrap /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:94 #7 0x55f1b85d7f9c in nni_plat_thr_main /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:266 #8 0x7f5f33072b42 in start_thread nptl/pthread_create.c:442 previously allocated by thread T12 here: #0 0x7f5f332de867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145 #1 0x55f1b85d3604 in nni_alloc /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_alloc.c:20 #2 0x55f1b85a276b in nng_alloc /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/nng.c:60 #3 0x55f1b85ec405 in conn_param_alloc /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:836 #4 0x55f1b86ce9a7 in tcptran_pipe_nego_cb /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:347 #5 0x55f1b85cda2f in nni_taskq_thread /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:50 #6 0x55f1b85cede7 in nni_thr_wrap /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:94 #7 0x55f1b85d7f9c in nni_plat_thr_main /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:266 #8 0x7f5f33072b42 in start_thread nptl/pthread_create.c:442 Thread T13 created by T0 here: 2023-02-08 14:41:32 [106026] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1040 nano_pipe_recv_cb: qos msg not found! 2023-02-08 14:41:32 [106026] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1040 nano_pipe_recv_cb: qos msg not found! 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:436 nano_ctx_send: pipe 1555308227 occupied! resending in cb! 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:436 nano_ctx_send: pipe 1555308227 occupied! resending in cb! 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:436 nano_ctx_send: pipe 1555308227 occupied! resending in cb! 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:436 nano_ctx_send: pipe 1555308227 occupied! resending in cb! 2023-02-08 14:41:32 [106026] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1040 nano_pipe_recv_cb: qos msg not found! 2023-02-08 14:41:32 [106026] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1040 nano_pipe_recv_cb: qos msg not found! 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:41:32 [106026] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 #0 0x7f5f33282685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216 #1 0x55f1b85d80cc in nni_plat_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x55f1b85cf093 in nni_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:121 #3 0x55f1b85cdd51 in nni_taskq_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:95 #4 0x55f1b85ceab1 in nni_taskq_sys_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:294 #5 0x55f1b85b8a57 in nni_init_helper /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:35 #6 0x55f1b85d8471 in nni_plat_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x55f1b85b8ad8 in nni_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:58 #8 0x55f1b85fc85c in nni_proto_mqtt_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol.c:37 #9 0x55f1b85f8c00 in nng_nmq_tcp0_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1258 #10 0x55f1b859d744 in broker /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:865 #11 0x55f1b85a1c72 in broker_start /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:1592 #12 0x55f1b856c3bf in main /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/nanomq.c:142 #13 0x7f5f33007d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 Thread T12 created by T0 here: #0 0x7f5f33282685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216 #1 0x55f1b85d80cc in nni_plat_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x55f1b85cf093 in nni_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:121 #3 0x55f1b85cdd51 in nni_taskq_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:95 #4 0x55f1b85ceab1 in nni_taskq_sys_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:294 #5 0x55f1b85b8a57 in nni_init_helper /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:35 #6 0x55f1b85d8471 in nni_plat_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x55f1b85b8ad8 in nni_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:58 #8 0x55f1b85fc85c in nni_proto_mqtt_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol.c:37 #9 0x55f1b85f8c00 in nng_nmq_tcp0_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1258 #10 0x55f1b859d744 in broker /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:865 #11 0x55f1b85a1c72 in broker_start /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:1592 #12 0x55f1b856c3bf in main /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/nanomq.c:142 #13 0x7f5f33007d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 SUMMARY: AddressSanitizer: heap-use-after-free /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:988 in nano_pipe_recv_cb Shadow bytes around the buggy address: 0x0c227fffc290: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd 0x0c227fffc2a0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c227fffc2b0: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa 0x0c227fffc2c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c227fffc2d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c227fffc2e0: fa fa fa fa fa fa fa fa[fd]fd fd fd fd fd fd fd 0x0c227fffc2f0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c227fffc300: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa 0x0c227fffc310: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c227fffc320: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c227fffc330: fa fa fa fa fa fa fa fa 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 ==106026==ABORTING ``` - target-1675835022.225551 - target file : [target-1675835022.225551.txt](https://github.com/emqx/nanomq/files/10704571/target-1675835022.225551.txt) ``` ================================================================= ==106173==ERROR: AddressSanitizer: heap-use-after-free on address 0x61d0000107a8 at pc 0x561806b7cee9 bp 0x7f874aff9a60 sp 0x7f874aff9a50 READ of size 8 at 0x61d0000107a8 thread T6 2023-02-08 14:43:41 [106173] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:313 tcptran_pipe_nego_cb: Illegal CONNECT Packet type 9c 2023-02-08 14:43:41 [106173] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:313 tcptran_pipe_nego_cb: Illegal CONNECT Packet type 9c #0 0x561806b7cee8 in nano_pipe_start /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:714 #1 0x561806b51308 in nni_listener_add_pipe /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/socket.c:1604 #2 0x561806b41b4a in listener_accept_cb /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/listener.c:357 #3 0x561806b54a2f in nni_taskq_thread /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:50 #4 0x561806b55de7 in nni_thr_wrap /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:94 #5 0x561806b5ef9c in nni_plat_thr_main /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:266 #6 0x7f8751144b42 in start_thread nptl/pthread_create.c:442 #7 0x7f87511d69ff (/lib/x86_64-linux-gnu/libc.so.6+0x1269ff) 0x61d0000107a8 is located 808 bytes inside of 2320-byte region [0x61d000010480,0x61d000010d90) freed by thread T14 here: #0 0x7f87513b0517 in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:127 #1 0x561806b5a65e in nni_free /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_alloc.c:33 #2 0x561806b48ae6 in pipe_destroy /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/pipe.c:82 #3 0x561806b4a7d5 in reap_worker /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/reap.c:58 #4 0x561806b55de7 in nni_thr_wrap /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:94 #5 0x561806b5ef9c in nni_plat_thr_main /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:266 #6 0x7f8751144b42 in start_thread nptl/pthread_create.c:442 previously allocated by thread T6 here: #0 0x7f87513b0a37 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154 #1 0x561806b5a635 in nni_zalloc /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_alloc.c:26 #2 0x561806b49271 in pipe_create /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/pipe.c:251 #3 0x561806b49de4 in nni_pipe_create_listener /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/pipe.c:329 #4 0x561806b510e4 in nni_listener_add_pipe /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/socket.c:1581 #5 0x561806b41b4a in listener_accept_cb /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/listener.c:357 #6 0x561806b54a2f in nni_taskq_thread /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:50 #7 0x561806b55de7 in nni_thr_wrap /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:94 #8 0x561806b5ef9c in nni_plat_thr_main /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:266 #9 0x7f8751144b42 in start_thread nptl/pthread_create.c:442 Thread T6 created by T0 here: #0 0x7f8751354685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216 #1 0x561806b5f0cc in nni_plat_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x561806b56093 in nni_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:121 #3 0x561806b54d51 in nni_taskq_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:95 #4 0x561806b55ab1 in nni_taskq_sys_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:294 #5 0x561806b3fa57 in nni_init_helper /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:35 #6 0x561806b5f471 in nni_plat_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x561806b3fad8 in nni_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:58 #8 0x561806b8385c in nni_proto_mqtt_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol.c:37 #9 0x561806b7fc00 in nng_nmq_tcp0_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1258 #10 0x561806b24744 in broker /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:865 #11 0x561806b28c72 in broker_start /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:1592 #12 0x561806af33bf in main /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/nanomq.c:142 #13 0x7f87510d9d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 Thread T14 created by T0 here: #0 0x7f8751354685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216 #1 0x561806b5f0cc in nni_plat_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x561806b56093 in nni_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:121 #3 0x561806b4aa56 in nni_reap_sys_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/reap.c:110 #4 0x561806b3fa65 in nni_init_helper /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:36 #5 0x561806b5f471 in nni_plat_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:422 #6 0x561806b3fad8 in nni_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:58 #7 0x561806b8385c in nni_proto_mqtt_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol.c:37 #8 0x561806b7fc00 in nng_nmq_tcp0_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1258 #9 0x561806b24744 in broker /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:865 #10 0x561806b28c72 in broker_start /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:1592 #11 0x561806af33bf in main /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/nanomq.c:142 #12 0x7f87510d9d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 SUMMARY: AddressSanitizer: heap-use-after-free /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:714 in nano_pipe_start Shadow bytes around the buggy address: 0x0c3a7fffa0a0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3a7fffa0b0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3a7fffa0c0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3a7fffa0d0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3a7fffa0e0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd =>0x0c3a7fffa0f0: fd fd fd fd fd[fd]fd fd fd fd fd fd fd fd fd fd 0x0c3a7fffa100: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3a7fffa110: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3a7fffa120: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3a7fffa130: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3a7fffa140: 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 ==106173==ABORTING ``` ** Environment Details ** - NanoMQ version : v0.15.0-0 - Operating system and version : Linux lab-virtual-machine 5.15.0-58-generic x86_64 x86_64 x86_64 GNU/Linux - Compiler and language used : I using ASAN build Option with Ninja Compile - testing scenario Run the broker(asan build) with the ./nanomq start command, put the target file and the python file in the same path, and run python. **Client SDK** Using MQTT Raw Packet **Additional context** Add any other context about the problem here.
[Bugs] ASAN Logs
https://api.github.com/repos/nanomq/nanomq/issues/1051/comments
3
2023-02-10T07:15:04Z
2023-02-17T09:13:48Z
https://github.com/nanomq/nanomq/issues/1051
1,579,120,596
1,051
[ "emqx", "nanomq" ]
**Describe the bug** I have acquired many asan logs, but it takes too much time to analyze them all, so I will only attach the logs. **Expected behavior** **Actual Behavior** Heap Overflow, Use-After-Free Vuln **To Reproduce** ALL SUMMARY ``` SUMMARY: AddressSanitizer: heap-buffer-overflow /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/supplemental/mqtt/mqtt_codec.c:2738 in read_uint32 SUMMARY: AddressSanitizer: heap-buffer-overflow /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:1553 in nmq_subinfo_decode SUMMARY: AddressSanitizer: heap-buffer-overflow /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:1511 in nmq_subinfo_decode SUMMARY: AddressSanitizer: heap-use-after-free /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:683 in tcptran_pipe_recv_cb SUMMARY: AddressSanitizer: heap-buffer-overflow /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:1612 in nmq_unsubinfo_decode SUMMARY: AddressSanitizer: heap-use-after-free /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/nng.c:2328 in conn_param_get_protover SUMMARY: AddressSanitizer: heap-use-after-free /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:988 in nano_pipe_recv_cb SUMMARY: AddressSanitizer: heap-use-after-free /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:714 in nano_pipe_start ``` - target-1675833835.820333 target file : [target-1675833835.820333.txt](https://github.com/emqx/nanomq/files/10704473/target-1675833835.820333.txt) ``` ================================================================= ==104514==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60400000c2f9 at pc 0x555b1ec9ea39 bp 0x7f68380f57a0 sp 0x7f68380f5790 READ of size 1 at 0x60400000c2f9 thread T10 #0 0x555b1ec9ea38 in read_uint32 /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/supplemental/mqtt/mqtt_codec.c:2738 #1 0x555b1eca3280 in property_parse /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/supplemental/mqtt/mqtt_codec.c:3501 #2 0x555b1eca4998 in decode_buf_properties /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/supplemental/mqtt/mqtt_codec.c:3758 #3 0x555b1ec66540 in conn_handler /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:616 #4 0x555b1ed4aa51 in tcptran_pipe_nego_cb /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:349 #5 0x555b1ec49a2f in nni_taskq_thread /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:50 #6 0x555b1ec4ade7 in nni_thr_wrap /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:94 #7 0x555b1ec53f9c in nni_plat_thr_main /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:266 #8 0x7f68401c4b42 in start_thread nptl/pthread_create.c:442 #9 0x7f68402569ff (/lib/x86_64-linux-gnu/libc.so.6+0x1269ff) 0x60400000c2f9 is located 0 bytes to the right of 41-byte region [0x60400000c2d0,0x60400000c2f9) allocated by thread T10 here: #0 0x7f6840430867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145 #1 0x555b1ec4f604 in nni_alloc /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_alloc.c:20 #2 0x555b1ec1e76b in nng_alloc /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/nng.c:60 #3 0x555b1ed4a765 in tcptran_pipe_nego_cb /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:331 #4 0x555b1ec49a2f in nni_taskq_thread /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:50 #5 0x555b1ec4ade7 in nni_thr_wrap /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:94 #6 0x555b1ec53f9c in nni_plat_thr_main /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:266 #7 0x7f68401c4b42 in start_thread nptl/pthread_create.c:442 Thread T10 created by T0 here: #0 0x7f68403d4685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216 #1 0x555b1ec540cc in nni_plat_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x555b1ec4b093 in nni_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:121 #3 0x555b1ec49d51 in nni_taskq_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:95 #4 0x555b1ec4aab1 in nni_taskq_sys_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:294 #5 0x555b1ec34a57 in nni_init_helper /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:35 #6 0x555b1ec54471 in nni_plat_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x555b1ec34ad8 in nni_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:58 #8 0x555b1ec7885c in nni_proto_mqtt_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol.c:37 #9 0x555b1ec74c00 in nng_nmq_tcp0_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1258 #10 0x555b1ec19744 in broker /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:865 #11 0x555b1ec1dc72 in broker_start /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:1592 #12 0x555b1ebe83bf in main /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/nanomq.c:142 #13 0x7f6840159d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 SUMMARY: AddressSanitizer: heap-buffer-overflow /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/supplemental/mqtt/mqtt_codec.c:2738 in read_uint32 Shadow bytes around the buggy address: 0x0c087fff9800: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fa 0x0c087fff9810: fa fa 00 00 00 00 07 fa fa fa fd fd fd fd fd fd 0x0c087fff9820: fa fa fd fd fd fd fd fd fa fa fd fd fd fd fd fd 0x0c087fff9830: fa fa fd fd fd fd fd fd fa fa fd fd fd fd fd fa 0x0c087fff9840: fa fa fd fd fd fd fd fd fa fa fd fd fd fd fd fd =>0x0c087fff9850: fa fa fd fd fd fd fd fa fa fa 00 00 00 00 00[01] 0x0c087fff9860: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c087fff9870: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c087fff9880: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c087fff9890: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c087fff98a0: 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 ==104514==ABORTING ``` - target-1675833960.892048 target file : [target-1675833960.892048.txt](https://github.com/emqx/nanomq/files/10704539/target-1675833960.892048.txt) ``` ================================================================= ==104566==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x608000014c86 at pc 0x55bdfed70dd8 bp 0x7f2eb82f27f0 sp 0x7f2eb82f27e0 READ of size 1 at 0x608000014c86 thread T13 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:26:00 [104566] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:313 tcptran_pipe_nego_cb: Illegal CONNECT Packet type a6 2023-02-08 14:26:00 [104566] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:313 tcptran_pipe_nego_cb: Illegal CONNECT Packet type a6 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:393 nano_ctx_send: pipe id 1898504648 is gone, pub failed 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:393 nano_ctx_send: pipe id 1898504648 is gone, pub failed 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:26:00 [104566] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1040 nano_pipe_recv_cb: qos msg not found! 2023-02-08 14:26:00 [104566] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1040 nano_pipe_recv_cb: qos msg not found! 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:26:00 [104566] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:721 conn_handler: in connect handler 2023-02-08 14:26:00 [104566] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:721 conn_handler: in connect handler 2023-02-08 14:26:00 [104566] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:721 conn_handler: in connect handler 2023-02-08 14:26:00 [104566] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:721 conn_handler: in connect handler 2023-02-08 14:26:00 [104566] INFO /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/sub_handler.c:81 decode_sub_msg: topic: [(null)] len: [0] 2023-02-08 14:26:00 [104566] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/sub_handler.c:85 decode_sub_msg: NOT utf8-encoded string OR null string. 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:26:00 [104566] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/sub_handler.c:85 decode_sub_msg: NOT utf8-encoded string OR null string. 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 #0 0x55bdfed70dd7 in nmq_subinfo_decode /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:1553 #1 0x55bdfed77a03 in nano_pipe_recv_cb /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:988 #2 0x55bdfed4e227 in nni_task_exec /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:144 #3 0x55bdfed3174e in nni_aio_finish_impl /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/aio.c:454 #4 0x55bdfed317d0 in nni_aio_finish_sync /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/aio.c:469 #5 0x55bdfee51d09 in tcptran_pipe_recv_cb /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:805 #6 0x55bdfed4da2f in nni_taskq_thread /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:50 #7 0x55bdfed4ede7 in nni_thr_wrap /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:94 #8 0x55bdfed57f9c in nni_plat_thr_main /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:266 #9 0x7f2ec1c4ab42 in start_thread nptl/pthread_create.c:442 #10 0x7f2ec1cdc9ff (/lib/x86_64-linux-gnu/libc.so.6+0x1269ff) 0x608000014c86 is located 3093 bytes to the right of 81-byte region [0x608000014020,0x608000014071) allocated by thread T13 here: #0 0x7f2ec1eb6a37 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154 #1 0x55bdfed53635 in nni_zalloc /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_alloc.c:26 #2 0x55bdfed3c4cf in nni_chunk_grow /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/message.c:158 #3 0x55bdfed3d744 in nni_msg_alloc /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/message.c:397 #4 0x55bdfee50cb3 in tcptran_pipe_recv_cb /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:649 #5 0x55bdfed4da2f in nni_taskq_thread /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:50 #6 0x55bdfed4ede7 in nni_thr_wrap /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:94 #7 0x55bdfed57f9c in nni_plat_thr_main /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:266 #8 0x7f2ec1c4ab42 in start_thread nptl/pthread_create.c:442 Thread T13 created by T0 here: 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:26:00 [104566] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 #0 0x7f2ec1e5a685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216 #1 0x55bdfed580cc in nni_plat_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x55bdfed4f093 in nni_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:121 #3 0x55bdfed4dd51 in nni_taskq_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:95 #4 0x55bdfed4eab1 in nni_taskq_sys_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:294 #5 0x55bdfed38a57 in nni_init_helper /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:35 #6 0x55bdfed58471 in nni_plat_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x55bdfed38ad8 in nni_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:58 #8 0x55bdfed7c85c in nni_proto_mqtt_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol.c:37 #9 0x55bdfed78c00 in nng_nmq_tcp0_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1258 #10 0x55bdfed1d744 in broker /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:865 #11 0x55bdfed21c72 in broker_start /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:1592 #12 0x55bdfecec3bf in main /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/nanomq.c:142 #13 0x7f2ec1bdfd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 SUMMARY: AddressSanitizer: heap-buffer-overflow /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:1553 in nmq_subinfo_decode Shadow bytes around the buggy address: 0x0c107fffa940: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c107fffa950: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c107fffa960: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c107fffa970: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c107fffa980: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x0c107fffa990:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c107fffa9a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c107fffa9b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c107fffa9c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c107fffa9d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c107fffa9e0: 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 ==104566==ABORTING ``` - target-1675834211.862917 target file : [target-1675834211.862917.txt](https://github.com/emqx/nanomq/files/10704553/target-1675834211.862917.txt) ``` #0 0x7f1b8eba3685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216 #1 0x5596dfc7b0cc in nni_plat_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x5596dfc72093 in nni_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:121 #3 0x5596dfc70d51 in nni_taskq_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:95 #4 0x5596dfc71ab1 in nni_taskq_sys_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:294 #5 0x5596dfc5ba57 in nni_init_helper /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:35 #6 0x5596dfc7b471 in nni_plat_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x5596dfc5bad8 in nni_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:58 #8 0x5596dfc9f85c in nni_proto_mqtt_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol.c:37 #9 0x5596dfc9bc00 in nng_nmq_tcp0_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1258 #10 0x5596dfc40744 in broker /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:865 #11 0x5596dfc44c72 in broker_start /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:1592 #12 0x5596dfc0f3bf in main /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/nanomq.c:142 #13 0x7f1b8e928d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 Thread T8 created by T0 here: #0 0x7f1b8eba3685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216 #1 0x5596dfc7b0cc in nni_plat_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x5596dfc72093 in nni_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:121 #3 0x5596dfc70d51 in nni_taskq_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:95 #4 0x5596dfc71ab1 in nni_taskq_sys_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:294 #5 0x5596dfc5ba57 in nni_init_helper /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:35 #6 0x5596dfc7b471 in nni_plat_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x5596dfc5bad8 in nni_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:58 #8 0x5596dfc9f85c in nni_proto_mqtt_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol.c:37 #9 0x5596dfc9bc00 in nng_nmq_tcp0_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1258 #10 0x5596dfc40744 in broker /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:865 #11 0x5596dfc44c72 in broker_start /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:1592 #12 0x5596dfc0f3bf in main /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/nanomq.c:142 #13 0x7f1b8e928d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 Thread T13 created by T0 here: #0 0x7f1b8eba3685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216 #1 0x5596dfc7b0cc in nni_plat_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x5596dfc72093 in nni_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:121 #3 0x5596dfc70d51 in nni_taskq_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:95 #4 0x5596dfc71ab1 in nni_taskq_sys_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:294 #5 0x5596dfc5ba57 in nni_init_helper /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:35 #6 0x5596dfc7b471 in nni_plat_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x5596dfc5bad8 in nni_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:58 #8 0x5596dfc9f85c in nni_proto_mqtt_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol.c:37 #9 0x5596dfc9bc00 in nng_nmq_tcp0_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1258 #10 0x5596dfc40744 in broker /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:865 #11 0x5596dfc44c72 in broker_start /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:1592 #12 0x5596dfc0f3bf in main /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/nanomq.c:142 #13 0x7f1b8e928d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 SUMMARY: AddressSanitizer: heap-use-after-free /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:683 in tcptran_pipe_recv_cb Shadow bytes around the buggy address: 0x0c2280000020: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd 0x0c2280000030: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c2280000040: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa 0x0c2280000050: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c2280000060: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fa =>0x0c2280000070: fa fa fa fa fa fa fa fa[fd]fd fd fd fd fd fd fd 0x0c2280000080: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c2280000090: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa 0x0c22800000a0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c22800000b0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c22800000c0: fa fa fa fa fa fa fa fa 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 ==104810==ABORTING ``` - target-1675834507.839404 - target file : [target-1675834507.839404.txt](https://github.com/emqx/nanomq/files/10704560/target-1675834507.839404.txt) ``` ================================================================= ==105305==ERROR: AddressSanitizer: heap-use-after-free on address 0x611000040144 at pc 0x5620868a7dcb bp 0x7f7b8b9f36b0 sp 0x7f7b8b9f36a0 READ of size 1 at 0x611000040144 thread T12 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:35:07 [105305] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1040 nano_pipe_recv_cb: qos msg not found! 2023-02-08 14:35:07 [105305] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1040 nano_pipe_recv_cb: qos msg not found! 2023-02-08 14:35:07 [105305] INFO /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/sub_handler.c:81 decode_sub_msg: topic: [DuXMO8g9N99v] len: [12] 2023-02-08 14:35:07 [105305] INFO /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/sub_handler.c:81 decode_sub_msg: topic: [ZyAMY1ewuO8bzRi1Fp9rtam] len: [23] 2023-02-08 14:35:07 [105305] INFO /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/sub_handler.c:81 decode_sub_msg: topic: [MtjcVYfRuTD] len: [11] 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:436 nano_ctx_send: pipe 1677216904 occupied! resending in cb! 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:436 nano_ctx_send: pipe 1677216904 occupied! resending in cb! 2023-02-08 14:35:07 [105305] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1040 nano_pipe_recv_cb: qos msg not found! 2023-02-08 14:35:07 [105305] ERROR /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1040 nano_pipe_recv_cb: qos msg not found! 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:436 nano_ctx_send: pipe 1677216904 occupied! resending in cb! 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:436 nano_ctx_send: pipe 1677216904 occupied! resending in cb! 2023-02-08 14:35:07 [105305] INFO /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/sub_handler.c:81 decode_sub_msg: topic: [hvE24hGZnvz3xOyppCuO77YHAMaymI] len: [30] 2023-02-08 14:35:07 [105305] INFO /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/sub_handler.c:81 decode_sub_msg: topic: [Uc7jgsncDqGGaamqQT76kqN] len: [23] 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:436 nano_ctx_send: pipe 1677216904 occupied! resending in cb! 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:436 nano_ctx_send: pipe 1677216904 occupied! resending in cb! 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581 tcptran_pipe_recv_cb: nni aio recv error!! 31 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 2023-02-08 14:35:07 [105305] WARN /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817 tcptran_pipe_recv_cb: tcptran_pipe_recv_cb: recv error rv: 137 #0 0x5620868a7dca in conn_param_get_protover /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/nng.c:2328 #1 0x562086890b08 in server_cb /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:298 #2 0x5620868c6227 in nni_task_exec /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:144 #3 0x5620868a974e in nni_aio_finish_impl /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/aio.c:454 #4 0x5620868a97d0 in nni_aio_finish_sync /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/aio.c:469 #5 0x5620868f0426 in nano_pipe_recv_cb /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1088 #6 0x5620868c6227 in nni_task_exec /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:144 #7 0x5620868a974e in nni_aio_finish_impl /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/aio.c:454 #8 0x5620868a97d0 in nni_aio_finish_sync /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/aio.c:469 #9 0x5620869c9d09 in tcptran_pipe_recv_cb /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:805 #10 0x5620868c5a2f in nni_taskq_thread /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:50 #11 0x5620868c6de7 in nni_thr_wrap /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:94 #12 0x5620868cff9c in nni_plat_thr_main /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:266 #13 0x7f7b94b98b42 in start_thread nptl/pthread_create.c:442 #14 0x7f7b94c2a9ff (/lib/x86_64-linux-gnu/libc.so.6+0x1269ff) 0x611000040144 is located 4 bytes inside of 256-byte region [0x611000040140,0x611000040240) freed by thread T9 here: #0 0x7f7b94e04517 in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:127 #1 0x5620868cb65e in nni_free /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_alloc.c:33 #2 0x56208689a7d1 in nng_free /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/nng.c:78 #3 0x5620868e480e in conn_param_free /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:867 #4 0x5620868931ba in server_cb /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:534 #5 0x5620868c5a2f in nni_taskq_thread /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:50 #6 0x5620868c6de7 in nni_thr_wrap /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:94 #7 0x5620868cff9c in nni_plat_thr_main /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:266 #8 0x7f7b94b98b42 in start_thread nptl/pthread_create.c:442 previously allocated by thread T10 here: #0 0x7f7b94e04867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145 #1 0x5620868cb604 in nni_alloc /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_alloc.c:20 #2 0x56208689a76b in nng_alloc /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/nng.c:60 #3 0x5620868e4405 in conn_param_alloc /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:836 #4 0x5620869c69a7 in tcptran_pipe_nego_cb /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:347 #5 0x5620868c5a2f in nni_taskq_thread /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:50 #6 0x5620868c6de7 in nni_thr_wrap /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:94 #7 0x5620868cff9c in nni_plat_thr_main /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:266 #8 0x7f7b94b98b42 in start_thread nptl/pthread_create.c:442 Thread T12 created by T0 here: #0 0x7f7b94da8685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216 #1 0x5620868d00cc in nni_plat_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x5620868c7093 in nni_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:121 #3 0x5620868c5d51 in nni_taskq_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:95 #4 0x5620868c6ab1 in nni_taskq_sys_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:294 #5 0x5620868b0a57 in nni_init_helper /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:35 #6 0x5620868d0471 in nni_plat_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x5620868b0ad8 in nni_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:58 #8 0x5620868f485c in nni_proto_mqtt_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol.c:37 #9 0x5620868f0c00 in nng_nmq_tcp0_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1258 #10 0x562086895744 in broker /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:865 #11 0x562086899c72 in broker_start /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:1592 #12 0x5620868643bf in main /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/nanomq.c:142 #13 0x7f7b94b2dd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 Thread T9 created by T0 here: #0 0x7f7b94da8685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216 #1 0x5620868d00cc in nni_plat_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x5620868c7093 in nni_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:121 #3 0x5620868c5d51 in nni_taskq_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:95 #4 0x5620868c6ab1 in nni_taskq_sys_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:294 #5 0x5620868b0a57 in nni_init_helper /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:35 #6 0x5620868d0471 in nni_plat_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x5620868b0ad8 in nni_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:58 #8 0x5620868f485c in nni_proto_mqtt_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol.c:37 #9 0x5620868f0c00 in nng_nmq_tcp0_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1258 #10 0x562086895744 in broker /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:865 #11 0x562086899c72 in broker_start /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:1592 #12 0x5620868643bf in main /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/nanomq.c:142 #13 0x7f7b94b2dd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 Thread T10 created by T0 here: #0 0x7f7b94da8685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216 #1 0x5620868d00cc in nni_plat_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x5620868c7093 in nni_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:121 #3 0x5620868c5d51 in nni_taskq_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:95 #4 0x5620868c6ab1 in nni_taskq_sys_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:294 #5 0x5620868b0a57 in nni_init_helper /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:35 #6 0x5620868d0471 in nni_plat_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x5620868b0ad8 in nni_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:58 #8 0x5620868f485c in nni_proto_mqtt_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol.c:37 #9 0x5620868f0c00 in nng_nmq_tcp0_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1258 #10 0x562086895744 in broker /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:865 #11 0x562086899c72 in broker_start /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:1592 #12 0x5620868643bf in main /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/nanomq.c:142 #13 0x7f7b94b2dd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 SUMMARY: AddressSanitizer: heap-use-after-free /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/nng.c:2328 in conn_param_get_protover Shadow bytes around the buggy address: 0x0c227fffffd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c227fffffe0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c227ffffff0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2280000000: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c2280000010: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fa fa =>0x0c2280000020: fa fa fa fa fa fa fa fa[fd]fd fd fd fd fd fd fd 0x0c2280000030: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c2280000040: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa 0x0c2280000050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2280000060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2280000070: 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 ==105305==ABORTING ``` ** Environment Details ** - NanoMQ version : v0.15.0-0 - Operating system and version : Linux lab-virtual-machine 5.15.0-58-generic x86_64 x86_64 x86_64 GNU/Linux - Compiler and language used : I using ASAN build Option with Ninja Compile - testing scenario : Run the broker(asan build) with the ./nanomq start command, put the target file and the python file in the same path, and run python. **Client SDK** Using MQTT Raw Packet **Additional context** Add any other context about the problem here.
[Bugs] ASAN Logs
https://api.github.com/repos/nanomq/nanomq/issues/1050/comments
0
2023-02-10T07:13:26Z
2023-02-15T03:16:13Z
https://github.com/nanomq/nanomq/issues/1050
1,579,118,827
1,050
[ "emqx", "nanomq" ]
**Describe the bug** Heap overflow occurred in utf8_check function of mqtt_parser.c Confirmed with address sanitizer **Expected behavior** **Actual Behavior** Heap Overflow(CWE-122) **To Reproduce** asan log ``` ================================================================= ==105767==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6080000082f6 at pc 0x557da4a7ce23 bp 0x7f623bbf7970 sp 0x7f623bbf7960 READ of size 1 at 0x6080000082f6 thread T8 #0 0x557da4a7ce22 in utf8_check /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:379 #1 0x557da4a7c03b in copyn_utf8_str /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:234 #2 0x557da4a7f54d in conn_handler /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:711 #3 0x557da4b62a51 in tcptran_pipe_nego_cb /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:349 #4 0x557da4a61a2f in nni_taskq_thread /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:50 #5 0x557da4a62de7 in nni_thr_wrap /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:94 #6 0x557da4a6bf9c in nni_plat_thr_main /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:266 #7 0x7f6242d0ab42 in start_thread nptl/pthread_create.c:442 #8 0x7f6242d9c9ff (/lib/x86_64-linux-gnu/libc.so.6+0x1269ff) 0x6080000082f6 is located 0 bytes to the right of 86-byte region [0x6080000082a0,0x6080000082f6) allocated by thread T8 here: #0 0x7f6242f76867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145 #1 0x557da4a67604 in nni_alloc /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_alloc.c:20 #2 0x557da4a3676b in nng_alloc /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/nng.c:60 #3 0x557da4b62765 in tcptran_pipe_nego_cb /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:331 #4 0x557da4a61a2f in nni_taskq_thread /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:50 #5 0x557da4a62de7 in nni_thr_wrap /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:94 #6 0x557da4a6bf9c in nni_plat_thr_main /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:266 #7 0x7f6242d0ab42 in start_thread nptl/pthread_create.c:442 Thread T8 created by T0 here: #0 0x7f6242f1a685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216 #1 0x557da4a6c0cc in nni_plat_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x557da4a63093 in nni_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:121 #3 0x557da4a61d51 in nni_taskq_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:95 #4 0x557da4a62ab1 in nni_taskq_sys_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:294 #5 0x557da4a4ca57 in nni_init_helper /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:35 #6 0x557da4a6c471 in nni_plat_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x557da4a4cad8 in nni_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:58 #8 0x557da4a9085c in nni_proto_mqtt_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol.c:37 #9 0x557da4a8cc00 in nng_nmq_tcp0_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1258 #10 0x557da4a31744 in broker /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:865 #11 0x557da4a35c72 in broker_start /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:1592 #12 0x557da4a003bf in main /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/nanomq.c:142 #13 0x7f6242c9fd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 SUMMARY: AddressSanitizer: heap-buffer-overflow /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:379 in utf8_check Shadow bytes around the buggy address: 0x0c107fff9000: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fd 0x0c107fff9010: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fd 0x0c107fff9020: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fd 0x0c107fff9030: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa 0x0c107fff9040: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa =>0x0c107fff9050: fa fa fa fa 00 00 00 00 00 00 00 00 00 00[06]fa 0x0c107fff9060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c107fff9070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c107fff9080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c107fff9090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c107fff90a0: 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 ==105767==ABORTING ``` ```py import time import socket def check_input(input, sleep_time = 0.01): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) while True: try: s.connect(('127.0.0.1', 1883)) s.send(input) s.close() break except ConnectionResetError: continue except ConnectionRefusedError: break time.sleep(sleep_time) def check_crash_log(crash_log): for c in reversed(crash_log): c_bytes = bytearray.fromhex(c) status = check_input(c_bytes, 0.25) if status == False: print('[+] A crash was detected') return c_bytes print('[-] No crash..') exit(-1) with open('target-1675834728.174418.txt', 'r') as f: crash_log = f.readlines() check_crash_log(crash_log) ``` target file : [target-1675834728.174418.txt](https://github.com/emqx/nanomq/files/10682467/target-1675834728.174418.txt) ** Environment Details ** - NanoMQ version : v0.15.0-0 - Operating system and version : Linux lab-virtual-machine 5.15.0-58-generic x86_64 x86_64 x86_64 GNU/Linux - Compiler and language used : I using ASAN build Option with Ninja Compile - testing scenario : Run the broker(asan build) with the ./nanomq start command, put the target file and the python file in the same path, and run python. **Client SDK** Using MQTT Raw Packet **Additional context**
[Bug] Heap-based Buffer Overflow in mqtt_parser.c - `utf8_check`
https://api.github.com/repos/nanomq/nanomq/issues/1045/comments
1
2023-02-08T06:29:39Z
2023-02-13T08:29:22Z
https://github.com/nanomq/nanomq/issues/1045
1,575,561,222
1,045
[ "emqx", "nanomq" ]
**Describe the bug** Heap overflow occurred in copyn_utf8_str function of mqtt_parser.c Confirmed with address sanitizer **Expected behavior** A clear and concise description of what you expected to happen. **Actual Behavior** Heap Overflow(CWE-122) **To Reproduce** ![](https://user-images.githubusercontent.com/32904385/217441440-a6a2d91d-349b-456c-aecc-6a56b0d31ec7.png) asan log ``` ================================================================= ==104416==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000014a22 at pc 0x561da5470f06 bp 0x7f29911f39b0 sp 0x7f29911f39a0 READ of size 1 at 0x603000014a22 thread T12 #0 0x561da5470f05 in copyn_utf8_str /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:225 #1 0x561da547454d in conn_handler /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:711 #2 0x561da5557a51 in tcptran_pipe_nego_cb /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:349 #3 0x561da5456a2f in nni_taskq_thread /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:50 #4 0x561da5457de7 in nni_thr_wrap /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:94 #5 0x561da5460f9c in nni_plat_thr_main /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:266 #6 0x7f299a31eb42 in start_thread nptl/pthread_create.c:442 #7 0x7f299a3b09ff (/lib/x86_64-linux-gnu/libc.so.6+0x1269ff) 0x603000014a22 is located 0 bytes to the right of 18-byte region [0x603000014a10,0x603000014a22) allocated by thread T13 here: #0 0x7f299a58a867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145 #1 0x561da545c604 in nni_alloc /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_alloc.c:20 #2 0x561da542b76b in nng_alloc /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/nng.c:60 #3 0x561da5557765 in tcptran_pipe_nego_cb /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:331 #4 0x561da5456a2f in nni_taskq_thread /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:50 #5 0x561da5457de7 in nni_thr_wrap /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:94 #6 0x561da5460f9c in nni_plat_thr_main /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:266 #7 0x7f299a31eb42 in start_thread nptl/pthread_create.c:442 Thread T12 created by T0 here: #0 0x7f299a52e685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216 #1 0x561da54610cc in nni_plat_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x561da5458093 in nni_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:121 #3 0x561da5456d51 in nni_taskq_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:95 #4 0x561da5457ab1 in nni_taskq_sys_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:294 #5 0x561da5441a57 in nni_init_helper /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:35 #6 0x561da5461471 in nni_plat_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x561da5441ad8 in nni_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:58 #8 0x561da548585c in nni_proto_mqtt_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol.c:37 #9 0x561da5481c00 in nng_nmq_tcp0_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1258 #10 0x561da5426744 in broker /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:865 #11 0x561da542ac72 in broker_start /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:1592 #12 0x561da53f53bf in main /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/nanomq.c:142 #13 0x7f299a2b3d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 Thread T13 created by T0 here: #0 0x7f299a52e685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216 #1 0x561da54610cc in nni_plat_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x561da5458093 in nni_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:121 #3 0x561da5456d51 in nni_taskq_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:95 #4 0x561da5457ab1 in nni_taskq_sys_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:294 #5 0x561da5441a57 in nni_init_helper /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:35 #6 0x561da5461471 in nni_plat_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x561da5441ad8 in nni_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:58 #8 0x561da548585c in nni_proto_mqtt_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol.c:37 #9 0x561da5481c00 in nng_nmq_tcp0_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1258 #10 0x561da5426744 in broker /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:865 #11 0x561da542ac72 in broker_start /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:1592 #12 0x561da53f53bf in main /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/nanomq.c:142 #13 0x7f299a2b3d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 SUMMARY: AddressSanitizer: heap-buffer-overflow /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:225 in copyn_utf8_str Shadow bytes around the buggy address: 0x0c067fffa8f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fffa900: fd fd fd fd fa fa fd fd fd fd fa fa fd fd fd fa 0x0c067fffa910: fa fa fd fd fd fd fa fa fd fd fd fa fa fa fd fd 0x0c067fffa920: fd fd fa fa fd fd fd fa fa fa fd fd fd fd fa fa 0x0c067fffa930: 00 00 00 00 fa fa fd fd fd fa fa fa fd fd fd fd =>0x0c067fffa940: fa fa 00 00[02]fa fa fa fa fa fa fa fa fa fa fa 0x0c067fffa950: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fffa960: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fffa970: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fffa980: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c067fffa990: 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 ==104416==ABORTING ``` ```py import time import socket def check_input(input, sleep_time = 0.01): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) while True: try: s.connect(('127.0.0.1', 1883)) s.send(input) s.close() break except ConnectionResetError: continue except ConnectionRefusedError: break time.sleep(sleep_time) def check_crash_log(crash_log): for c in reversed(crash_log): c_bytes = bytearray.fromhex(c) status = check_input(c_bytes, 0.25) if status == False: print('[+] A crash was detected') return c_bytes print('[-] No crash..') exit(-1) with open('target-1675833483.502341.txt', 'r') as f: crash_log = f.readlines() check_crash_log(crash_log) ``` target file : [target-1675833483.502341.txt](https://github.com/emqx/nanomq/files/10681946/target-1675833483.502341.txt) ** Environment Details ** - NanoMQ version : v0.15.0-0 - Operating system and version : Linux lab-virtual-machine 5.15.0-58-generic x86_64 x86_64 x86_64 GNU/Linux - Compiler and language used : I using ASAN build Option with Ninja Compile - testing scenario : Run the broker(asan build) with the ./nanomq start command, put the target file and the python file in the same path, and run python. **Client SDK** Using MQTT Raw Packet **Additional context**
[Bug] Heap-based Buffer Overflow in `mqtt_parser.c` - `copyn_utf8_str()`
https://api.github.com/repos/nanomq/nanomq/issues/1043/comments
1
2023-02-08T05:23:15Z
2023-02-15T04:31:35Z
https://github.com/nanomq/nanomq/issues/1043
1,575,501,548
1,043
[ "emqx", "nanomq" ]
**Describe the bug** Heap overflow occurred in read_byte function of mqtt_code.c Confirmed with address sanitizer **Expected behavior** **Actual Behavior** Heap Overflow(CWE-122) **To Reproduce** ![](https://user-images.githubusercontent.com/32904385/217438822-a770c8bf-58c6-4d26-9a63-5b5569fe12dd.png) asan log ``` ================================================================= ==104134==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60f000010b2f at pc 0x55e80f3d0747 bp 0x7f98a11f28b0 sp 0x7f98a11f28a0 READ of size 1 at 0x60f000010b2f thread T13 #0 0x55e80f3d0746 in read_byte /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/supplemental/mqtt/mqtt_codec.c:2712 #1 0x55e80f3d68f1 in decode_buf_properties /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/supplemental/mqtt/mqtt_codec.c:3754 #2 0x55e80f398540 in conn_handler /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/mqtt_parser.c:616 #3 0x55e80f47ca51 in tcptran_pipe_nego_cb /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:349 #4 0x55e80f37ba2f in nni_taskq_thread /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:50 #5 0x55e80f37cde7 in nni_thr_wrap /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:94 #6 0x55e80f385f9c in nni_plat_thr_main /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:266 #7 0x7f98aaac8b42 in start_thread nptl/pthread_create.c:442 #8 0x7f98aab5a9ff (/lib/x86_64-linux-gnu/libc.so.6+0x1269ff) 0x60f000010b2f is located 0 bytes to the right of 175-byte region [0x60f000010a80,0x60f000010b2f) allocated by thread T13 here: #0 0x7f98aad34867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145 #1 0x55e80f381604 in nni_alloc /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_alloc.c:20 #2 0x55e80f35076b in nng_alloc /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/nng.c:60 #3 0x55e80f47c765 in tcptran_pipe_nego_cb /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:331 #4 0x55e80f37ba2f in nni_taskq_thread /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:50 #5 0x55e80f37cde7 in nni_thr_wrap /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:94 #6 0x55e80f385f9c in nni_plat_thr_main /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:266 #7 0x7f98aaac8b42 in start_thread nptl/pthread_create.c:442 Thread T13 created by T0 here: #0 0x7f98aacd8685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216 #1 0x55e80f3860cc in nni_plat_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:279 #2 0x55e80f37d093 in nni_thr_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/thread.c:121 #3 0x55e80f37bd51 in nni_taskq_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:95 #4 0x55e80f37cab1 in nni_taskq_sys_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/taskq.c:294 #5 0x55e80f366a57 in nni_init_helper /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:35 #6 0x55e80f386471 in nni_plat_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/platform/posix/posix_thread.c:422 #7 0x55e80f366ad8 in nni_init /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/core/init.c:58 #8 0x55e80f3aa85c in nni_proto_mqtt_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol.c:37 #9 0x55e80f3a6c00 in nng_nmq_tcp0_open /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/sp/protocol/mqtt/nmq_mqtt.c:1258 #10 0x55e80f34b744 in broker /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:865 #11 0x55e80f34fc72 in broker_start /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/apps/broker.c:1592 #12 0x55e80f31a3bf in main /home/lab/Desktop/broker/nanomq3/nanomq/nanomq/nanomq.c:142 #13 0x7f98aaa5dd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 SUMMARY: AddressSanitizer: heap-buffer-overflow /home/lab/Desktop/broker/nanomq3/nanomq/nng/src/supplemental/mqtt/mqtt_codec.c:2712 in read_byte Shadow bytes around the buggy address: 0x0c1e7fffa110: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fd 0x0c1e7fffa120: fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa 0x0c1e7fffa130: fa fa fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c1e7fffa140: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa 0x0c1e7fffa150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c1e7fffa160: 00 00 00 00 00[07]fa fa fa fa fa fa fa fa fa fa 0x0c1e7fffa170: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c1e7fffa180: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c1e7fffa190: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c1e7fffa1a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c1e7fffa1b0: 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 ==104134==ABORTING ``` ```py import time import socket def check_input(input, sleep_time = 0.01): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) while True: try: s.connect(('127.0.0.1', 1883)) s.send(input) s.close() break except ConnectionResetError: continue except ConnectionRefusedError: break time.sleep(sleep_time) def check_crash_log(crash_log): for c in reversed(crash_log): c_bytes = bytearray.fromhex(c) status = check_input(c_bytes, 0.25) if status == False: print('[+] A crash was detected') return c_bytes print('[-] No crash..') exit(-1) with open('target-1675832337.790905.txt', 'r') as f: crash_log = f.readlines() check_crash_log(crash_log) ``` target file : [target-1675832337.790905.txt](https://github.com/emqx/nanomq/files/10681881/target-1675832337.790905.txt) ** Environment Details ** - NanoMQ version : v0.15.0-0 - Operating system and version : Linux lab-virtual-machine 5.15.0-58-generic x86_64 x86_64 x86_64 GNU/Linux - Compiler and language used : I using ASAN build Option with Ninja Compile - testing scenario Run the broker(asan build) with the `./nanomq start` command, put the target file and the python file in the same path, and run python. **Client SDK** Using MQTT Raw Packet **Additional context**
[Bug] Heap-based Buffer Overflow in `mqtt_code.c`(`read_byte`)
https://api.github.com/repos/nanomq/nanomq/issues/1042/comments
2
2023-02-08T05:12:05Z
2023-02-13T08:28:37Z
https://github.com/nanomq/nanomq/issues/1042
1,575,489,854
1,042
[ "emqx", "nanomq" ]
**Describe the bug** segments fault with CWE-476 (NULL Pointer Dereference) occurred in the process of decoding `subinfo_decode` and `unsubinfo_decode` **Expected behavior** Dos **Actual Behavior** Describe what occurred. **To Reproduce** ```python import subprocess import time import socket def check_input(input, sleep_time = 0.01): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) while True: try: s.connect(('127.0.0.1', 1883)) s.send(input) s.close() break except ConnectionResetError: continue except ConnectionRefusedError: break time.sleep(sleep_time) def check_crash_log(crash_log): for c in reversed(crash_log): c_bytes = bytearray.fromhex(c) status = check_input(c_bytes, 0.25) if status == False: print('[+] A crash was detected') return c_bytes print('[-] No crash..') exit(-1) with open('target-1675744763.830481.txt', 'r') as f: crash_log = f.readlines() check_crash_log(crash_log) ``` target file [target-1675744763.830481.txt](https://github.com/emqx/nanomq/files/10671921/target-1675744763.830481.txt) img file backtrace : ![bt](https://user-images.githubusercontent.com/32904385/217160464-96e8f166-d2a5-4c96-b6a8-bd27e813af77.png) debug : ![a1](https://user-images.githubusercontent.com/32904385/217160530-6ce9a678-942f-432b-8ea5-b2a82d4d8a6e.png) ![a2](https://user-images.githubusercontent.com/32904385/217160555-e084b391-e3ec-4cd7-894b-cb3127e09e94.png) ** Environment Details ** - NanoMQ version : v0.15.0-0 - Operating system and version : Linux lab-virtual-machine 5.15.0-58-generic x86_64 x86_64 x86_64 GNU/Linux - Compiler and language used : I using Debugging guide(debug NanoMQ with GDB.) Option with ninja compile - testing scenario Run the broker with the `./nanomq start` command, put the target file and the python file in the same path, and run python. **Client SDK** Using MQTT Raw Packet **Additional context** Add any other context about the problem here.
Segment Fault occurs due to NULL Pointer reference in `subinfo_decode` & `unsubinfo_decode` while broker is parsing mqtt
https://api.github.com/repos/nanomq/nanomq/issues/1038/comments
3
2023-02-07T05:57:05Z
2023-03-17T07:30:21Z
https://github.com/nanomq/nanomq/issues/1038
1,573,731,822
1,038
[ "emqx", "nanomq" ]
**Describe the bug** MQTT 3.1.1/5.0 support status is inconsistent in the documents, such as the bellow documents ! **docs/en_US/quick-start.md** ![docs_en_US_quick-start md](https://user-images.githubusercontent.com/6647157/217132740-56ba477a-4218-445a-973c-01ef5265216e.png) **docs/en_US/toolkit.md** ![docs_en_US_toolkit md](https://user-images.githubusercontent.com/6647157/217132915-2029de4d-9ff8-47e0-ad7b-4815d4fa7090.png) **docs/en_US/README.md** ![docs_en_US_README md](https://user-images.githubusercontent.com/6647157/217133132-bf0e5926-6491-427d-9942-b85627b14c34.png) **README.md** ![image](https://user-images.githubusercontent.com/6647157/217133446-df97cb6b-3c9f-45c2-afd9-0866e2004cb5.png) **docs/zh_CN/*.md** also have the same problems.
[Docs] Support status of MQTT 3.1.1/5.0 is inconsistent
https://api.github.com/repos/nanomq/nanomq/issues/1036/comments
0
2023-02-07T02:44:18Z
2023-02-17T08:57:37Z
https://github.com/nanomq/nanomq/issues/1036
1,573,586,759
1,036
[ "emqx", "nanomq" ]
We use Paho.MQTT.Client Js SDK. The browser client occasionally displays the following exceptions: chunk-libs.d564d476.js:46 Error: AMQJS0011E Invalid state not connected. at S.send (chunk-libs.d564d476.js:54:33989) at x.send (chunk-libs.d564d476.js:54:52364) at a.mqtt_send (chunk-551c1f8b.9d4808e5.js:12:281308) And NanoMQ server log displays the following exceptions: 2023-02-04 16:27:40 [13942] WARN /home/runner/work/nanomq/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:581: nni aio recv error!! 31 2023-02-04 16:27:40 [13942] WARN /home/runner/work/nanomq/nanomq/nng/src/sp/transport/mqtt/broker_tcp.c:817: tcptran_pipe_recv_cb: recv error rv: 137 How can I solve it?
Client error: AMQJS0011E Invalid state not connected
https://api.github.com/repos/nanomq/nanomq/issues/1033/comments
1
2023-02-04T10:26:11Z
2024-04-18T06:32:38Z
https://github.com/nanomq/nanomq/issues/1033
1,570,872,624
1,033
[ "emqx", "nanomq" ]
Compile nanomq with option quic ``` cmake -G Ninja -DNNG_ENABLE_QUIC=ON .. ninja ``` Get linker error. ``` [437/438] Linking C executable nanomq_cli/nanomq_cli FAILED: nanomq_cli/nanomq_cli : && /usr/bin/cc -O3 -DNDEBUG -rdynamic nanomq_cli/CMakeFiles/nanomq_cli.dir/bench.c.o nanomq_cli/CMakeFiles/nanomq_cli.dir/client.c.o nanomq_cli/CMakeFiles/nanomq_cli.dir/dds2mqtt/dds_client.c.o nanomq_cli/CMakeFiles/nanomq_cli.dir/dds2mqtt/dds_mqtt_type_conversion.c.o nanomq_cli/CMakeFiles/nanomq_cli.dir/dds2mqtt/dds_utils.c.o nanomq_cli/CMakeFiles/nanomq_cli.dir/dds2mqtt/mqtt_client.c.o nanomq_cli/CMakeFiles/nanomq_cli.dir/dds2mqtt/publisher.c.o nanomq_cli/CMakeFiles/nanomq_cli.dir/dds2mqtt/subscriber.c.o nanomq_cli/CMakeFiles/nanomq_cli.dir/dds2mqtt/vector.c.o nanomq_cli/CMakeFiles/nanomq_cli.dir/main.c.o nanomq_cli/CMakeFiles/nanomq_cli.dir/nnb_opt.c.o nanomq_cli/CMakeFiles/nanomq_cli.dir/nng_proxy.c.o nanomq_cli/CMakeFiles/nanomq_cli.dir/nngcat.c.o nanomq_cli/CMakeFiles/nanomq_cli.dir/quic_client.c.o nanomq_cli/CMakeFiles/nanomq_cli.dir/rule_ctrl.c.o nanomq_cli/CMakeFiles/nanomq_cli.dir/zmq_gateway.c.o -o nanomq_cli/nanomq_cli -Wl,-rpath,/home/lee/workspace/nanomq/build/nng/src/supplemental/quic/msquic/msquic/bin/Release: nng/src/supplemental/quic/msquic/msquic/bin/Release/libmsquic.so.2.2.0 nng/libnng.a -lrt -lpthread -lnsl -latomic -ldl && : /usr/bin/ld: nng/libnng.a(quic_api.c.o): in function `quic_open': quic_api.c:(.text+0x25c5): undefined reference to `MsQuicOpenVersion' /usr/bin/ld: quic_api.c:(.text+0x2680): undefined reference to `MsQuicClose' /usr/bin/ld: nng/libnng.a(quic_api.c.o): in function `quic_close': quic_api.c:(.text+0x2707): undefined reference to `MsQuicClose' collect2: error: ld returned 1 exit status [438/438] Linking C executable nanomq/nanomq ninja: build stopped: subcommand failed. ```
nanomq_cli link msquic failed.
https://api.github.com/repos/nanomq/nanomq/issues/1023/comments
0
2023-01-28T05:36:35Z
2023-01-28T06:57:28Z
https://github.com/nanomq/nanomq/issues/1023
1,560,702,099
1,023