Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions 893/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Compile libzmq with this configure options: configure --with-poller=select

Then compile the test case normally:

g++ -o issue issue.c -lzmq -lpthread

The problem happens under Cygwin for n = 28, but not for n = 27:
the test hangs in the zmq_ctx_destroy() call.
53 changes: 53 additions & 0 deletions 893/issue.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#include <assert.h>
#include <zmq.h>

#define n 28 /* n = 27 works */
#define m n

int main(void)
{
void* ctx;
void* sckts[n];
int rc;
int i;

assert(m <= n);

printf("# : create context\n");
ctx = zmq_ctx_new();
assert(ctx);

rc = zmq_ctx_get(ctx, ZMQ_MAX_SOCKETS);
assert(rc >= n);

printf("## : starting to create sockets\n");
for(i=0; i<n; ++i) {
if(i == 0)
sckts[i] = zmq_socket(ctx, ZMQ_REP);
else
sckts[i] = zmq_socket(ctx, ZMQ_REQ);
assert(sckts[i]);
}

printf("#### : starting to connect sockets\n");
for(i=0; i<m; ++i) {
if(i == 0)
rc = zmq_bind(sckts[i], "inproc://test");
else
rc = zmq_connect(sckts[i], "inproc://test");
assert(rc == 0);
}

printf("###### : starting to close sockets\n");
for(i=0; i<n; ++i) {
rc = zmq_close(sckts[i]);
assert(rc == 0);
}

printf("####### : destroy context\n");
rc = zmq_ctx_destroy(ctx);
assert(rc == 0);

printf("Success : all resources released\n");
return 0;
}
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
This is the git repo for issue test cases

Each issue has a subdirectory named 'nnn' where that is the issue number.
Each issue has a subdirectory named 'nnn' or 'nnnn' where that is the issue number.

Within that subdirectory, there should directories 2-1 and 3-0 for version-specific test cases.

Expand Down