libzmq
libzmq copied to clipboard
zmq_connect () set the send timeout invalid in push mode
Please use this template for reporting suspected bugs or requests for help.
Issue description
In push/pull mode, set the timeout on the push side, and then conect.zmq_send always blocks when the pull side is not online.Even if non-blocking sending is set
Environment
- libzmq version (commit hash if unreleased): 4.3.3
- OS: Ubuntu 20.04
Minimal test code / Steps to reproduce the issue
#include "zhelpers.h"
#include <unistd.h>
int main(void)
{
int timeout = 30;
void *context = zmq_ctx_new();
void *publisher = zmq_socket(context, ZMQ_PUSH);
zmq_setsockopt(publisher, ZMQ_SNDTIMEO, &timeout, sizeof(timeout));
zmq_setsockopt(publisher, ZMQ_RCVTIMEO, &timeout, sizeof(timeout));
zmq_connect(publisher, "ipc:///tmp/pipeline.ipc"); // invalid
// zmq_bind(publisher, "ipc:///tmp/pipeline.ipc"); // Valid
char* msg = "We want to see this";
int rc = zmq_send(publisher, msg,strlen(msg), ZMQ_DONTWAIT);
if(rc<0)
{
printf("%s\n",zmq_strerror(zmq_errno()));
}
sleep(1);
zmq_close(publisher);
zmq_ctx_destroy(context);
return 0;
}
What's the actual result? (include assertion message & call stack if applicable)
zmq_send will always block
What's the expected result?
zmq_send exits in time out
This issue has been automatically marked as stale because it has not had activity for 365 days. It will be closed if no further activity occurs within 56 days. Thank you for your contributions.