Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gisldq opened this issue Dec 9, 2024 · 1 comment
Open

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

gisldq opened this issue Dec 9, 2024 · 1 comment

Comments

@gisldq
Copy link

gisldq commented Dec 9, 2024

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.

@gisldq gisldq changed the title Assertion failed at src/signaler.cpp:369 Assertion failed: dummy == 0 at src/signaler.cpp:369 Dec 9, 2024
@keith-dev
Copy link
Contributor

Isn't line 17 asking for trouble?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants