is there a stable version avaiable
when i test this library in android.i met some strange crash,firstly i think it's my code error,but when i enable asan build and i find two client library crash,so i report the issue to here. i just want to a stable version,may be i will search a new library for replace. at last i still paste the crash info here, i hope it's useful.
==32273==ERROR: AddressSanitizer: heap-use-after-free on address 0x004bf585cb40 at pc 0x007ef3e37318 bp 0x007fe4fa0dd0 sp 0x007fe4fa0568 READ of size 185 at 0x004bf585cb40 thread T0 #0 0x7ef3e37314 (/system/lib64/libclang_rt.asan-aarch64-android.so+0x74314) #1 0x63f5895a68 (/data/local/tmp/installer64+0x37a68)
0x004bf585cb40 is located 0 bytes inside of 185-byte region [0x004bf585cb40,0x004bf585cbf9) freed by thread T1 here: #0 0x7ef3e85e48 (/system/lib64/libclang_rt.asan-aarch64-android.so+0xc2e48) #1 0x63f5895b24 (/data/local/tmp/installer64+0x37b24) #2 0x63f5895984 (/data/local/tmp/installer64+0x37984) #3 0x63f5898914 (/data/local/tmp/installer64+0x3a914) #4 0x63f589488c (/data/local/tmp/installer64+0x3688c) #5 0x63f5892cf0 (/data/local/tmp/installer64+0x34cf0) #6 0x63f587ff48 (/data/local/tmp/installer64+0x21f48) #7 0x7ef3a499e0 (/apex/com.android.runtime/lib64/bionic/libc.so+0xe69e0) #8 0x7ef39e7b6c (/apex/com.android.runtime/lib64/bionic/libc.so+0x84b6c)
previously allocated by thread T1 here: #0 0x7ef3e861a4 (/system/lib64/libclang_rt.asan-aarch64-android.so+0xc31a4) #1 0x63f5895764 (/data/local/tmp/installer64+0x37764) #2 0x63f5898848 (/data/local/tmp/installer64+0x3a848) #3 0x63f589488c (/data/local/tmp/installer64+0x3688c) #4 0x63f5892cf0 (/data/local/tmp/installer64+0x34cf0) #5 0x63f587ff48 (/data/local/tmp/installer64+0x21f48) #6 0x7ef3a499e0 (/apex/com.android.runtime/lib64/bionic/libc.so+0xe69e0) #7 0x7ef39e7b6c (/apex/com.android.runtime/lib64/bionic/libc.so+0x84b6c)
this crash point in packet__read function, my source version is 2.0.14,i can sure the code line locate in packet_mosq.c last serval line rc = handle__packet(mosq); //Free data and reset values packet__cleanup(&mosq->in_packet); #ifdef WITH_BROKER keepalive__update(mosq); #else pthread_mutex_lock(&mosq->msgtime_mutex); mosq->last_msg_in = mosquitto_time(); pthread_mutex_unlock(&mosq->msgtime_mutex); #endif return rc; }
and another use-after-free crash in packet_write.
else if(((packet->command)&0xF0) == CMD_DISCONNECT){ do_client_disconnect(mosq, MOSQ_ERR_SUCCESS, NULL); packet__cleanup(packet); mosquitto__free(packet); return MOSQ_ERR_SUCCESS; #endif crash at packet__cleanup the packet object is not NULL
Thanks for the report. It would be much more useful if you could provide the example code you are using to create the crashes. The library has been working for many people for a long time now, so I'd hope any crash bugs were worked out. I'm still very interested in problems caused by using the library "incorrectly" so I can fix that aspect, or improve the documentation so it's clearer how to be using it.
these days i 'm test again, i have never find the same issue. i 'm try to find my memories, maybe i use the same client id,becase permission cause some info get failed. additional i'm run two clients on one devices with same client id.so i guess it maybe have some relationship about the crash stack.client code from the demo have no much different from example.just a little information.thanks