Assertion failed: dummy == 0 at src/signaler.cpp:369 #4759
Description
Please use this template for reporting suspected bugs or requests for help.
Issue description
When using libzmq for C++, we encountered a program crash.It said:Assertion failed: dummy == 0 (libzmq-4.3.5\src\signaler.cpp:369)
The error occurs sporadically and is not fixed, but it basically happens after receiving (RECV) a message.
I Use C++ libzmq, The other side is python.
Environment
- libzmq version (commit hash if unreleased): 4.3.5
- OS: windows server 2019
Minimal test code / Steps to reproduce the issue
- void *context = zmq_ctx_new();
- void *responder = zmq_socket(context, ZMQ_REP);
- while (true)
- {
-
zmq_msg_t recv_msg;
- zmq_msg_init(&recv_msg);
- int nbytes = zmq_msg_recv(&recv_msg, responder, 0);
- if (nbytes < 0)
- {
- zmq_msg_close(&recv_msg);
- continue;
- }
- size_t nReqNum = zmq_msg_size(&recv_msg);
- char* chRecCmd1 = new char[nReqNum + 1];
- memcpy(chRecCmd1, zmq_msg_data(&recv_msg), nReqNum);
- chRecCmd1[nReqNum] = '\0';
- //some bizcode....
- delete[] chRecCmd1;
- chRecCmd1 = NULL;
- }
What's the actual result? (include assertion message & call stack if applicable)
Assertion failed: dummy == 0 (libzmq-4.3.5\src\signaler.cpp:369)
Sometimes it crashed after Line18.Sometimes it crashed at or after Line20. It is not fixed in the same position.It seems crashed after recv a message but It never get into Line11(recv bytes are alwayes greater than 0,It seems i received the message successfully).
But I don't know why it crashed after success receving.Please help.
What's the expected result?
Expected result is: No crash.