Hi Everyone,
I am running a grpc client, which is sending a lot of requests with the audio payload. Most of the requests work fine but sometimes the client crashes with the below error.
#1 0x00007f1a8742a03a in __GI_abort () at abort.c:89
#2 0x00007f1a8746a7fa in __libc_message (do_abort=2, fmt=fmt @entry=0x7f1a87583f98 "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/posix/libc_fatal.c:175
#3 0x00007f1a87473e0b in malloc_printerr (ar_ptr=0x7f1a54000020, ptr=0x7f1a54018040, str=0x7f1a87580d35 "
corrupted size vs. prev_size", action=3) at malloc.c:5020
#4 _int_free (av=0x7f1a54000020, p=<optimized out>, have_lock=0) at malloc.c:4021
#5 0x00007f1a8747758c in __GI___libc_free (mem=<optimized out>) at malloc.c:2975
#6 0x00007f1a856cff8f in cca::TaskRequest::set_payload(void const*, unsigned long) () from /usr/local/unimrcp/plugin/vairecog.so
#7 0x00007f1a856d5926 in CCACallStream::GrpcThread() () from /usr/local/unimrcp/plugin/vairecog.so
#8 0x00007f1a856e45a7 in void std::_Mem_fn_base<void (CCACallStream::*)(), true>::operator()<, void>(CCACallStream*) const () from /usr/local/unimrcp/plugin/vairecog.so
I am using c++ async streaming client. I have two functions, in one i get payload that needs to be sent to the server. This function needs to be async. Another is my grpc thread, in which I am writing to grpc channel writer. My code crashes there when I am resetting the payload length to 0.
My code is something as follows:
cca::TaskRequest task_request;
// just adds payload to grpc object TaskRequest
void ProcessStreaming(void* audio_bytes, int length) {
task_request.set_payload(audio_bytes, length);
}
if (task_request.payload().length() != 0) {
writer->Write(task_request, reinterpret_cast<void*>(Type::WRITE));
task_request.set_payload("", 0); // crashes here
}
Here is proto definition of TaskRequest. There are more fields but I have just added the minimum info required.
message TaskRequest {
bytes payload = 1;
}
Thanks in advance for any help in understanding this error.
Deepankar