Skip to content

Assertion failed: dummy == 0 at src/signaler.cpp:369 #4759

Open
@gisldq

Description

@gisldq

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

  1. void *context = zmq_ctx_new();
  2. void *responder = zmq_socket(context, ZMQ_REP);
  3. while (true)
  4. {
  5. zmq_msg_t recv_msg;
    
  6.   zmq_msg_init(&recv_msg);
  7.   int nbytes = zmq_msg_recv(&recv_msg, responder, 0);
  8.   if (nbytes < 0)
  9. {
  10.       zmq_msg_close(&recv_msg);
  11.       continue;
  12. }          
  13.   size_t nReqNum = zmq_msg_size(&recv_msg);
  14.   char* chRecCmd1 = new char[nReqNum + 1];
  15.   memcpy(chRecCmd1, zmq_msg_data(&recv_msg), nReqNum);
  16.   chRecCmd1[nReqNum] = '\0';
  17.   //some bizcode....
  18.      
  19.   delete[] chRecCmd1;
  20.   chRecCmd1 = NULL;
  21. }

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.
image

What's the expected result?

Expected result is: No crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions