From 9a0d0c9ab9c812b2d2c15ea515ff4810089b29b0 Mon Sep 17 00:00:00 2001 From: Olaf Mandel Date: Fri, 14 Feb 2014 14:05:33 +0100 Subject: [PATCH 1/5] Add test case for #893 --- 893/README | 7 +++++++ 893/issue.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 893/README create mode 100644 893/issue.c diff --git a/893/README b/893/README new file mode 100644 index 0000000..d50da6c --- /dev/null +++ b/893/README @@ -0,0 +1,7 @@ +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. diff --git a/893/issue.c b/893/issue.c new file mode 100644 index 0000000..4c0382a --- /dev/null +++ b/893/issue.c @@ -0,0 +1,53 @@ +#include +#include + +#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 Date: Fri, 14 Feb 2014 14:08:08 +0100 Subject: [PATCH 2/5] #893: specify failure symptoms --- 893/README | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/893/README b/893/README index d50da6c..3e97971 100644 --- a/893/README +++ b/893/README @@ -4,4 +4,5 @@ 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 problem happens under Cygwin for n = 28, but not for n = 27: +the test hangs in the zmq_ctx_destroy() call. From ae9e8a13ca8afbc87c501ad6d2addb25ca6ee0c9 Mon Sep 17 00:00:00 2001 From: Olaf Mandel Date: Mon, 12 May 2014 12:08:42 +0200 Subject: [PATCH 3/5] README: allow for four-digit issue numbers --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 072deb9..6a7fa04 100644 --- a/README +++ b/README @@ -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. From 9fc2ac541f8826041552f54186d5697f7d1609ff Mon Sep 17 00:00:00 2001 From: Olaf Mandel Date: Mon, 12 May 2014 12:09:08 +0200 Subject: [PATCH 4/5] Add test case for #1028 See zeromq/libzmq#1028 for details. --- 1028/README.md | 60 +++++++++++++++++++++++++++++++++ 1028/issue1028.cxx | 82 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 142 insertions(+) create mode 100644 1028/README.md create mode 100644 1028/issue1028.cxx diff --git a/1028/README.md b/1028/README.md new file mode 100644 index 0000000..d8b8878 --- /dev/null +++ b/1028/README.md @@ -0,0 +1,60 @@ +Issue 1028 Description +====================== + +The `issue1028.cxx` test code sends two multi-part messages from a +`ZMQ_DEALER` to a `ZMQ_ROUTER` socket and outputs the message parts as they +are received. The `ZMQ_ROUTER` is bound, the `ZMQ_DEALER` connects. + +Several properties of the test can be selected by the number of command +line arguments *N*: the argument values are inconsequential, just the +number of arguments is used. There are eight different configurations for +the test, using eight (or more) arguments just wraps back to zero. + +* *N* = 0, 2, 4, 6: Use `tcp://` transport +* *N* = 1, 3, 5, 7: Use `inproc://` transport +* *N* = 0, 1, 4, 5: Create and bind `ZMQ_ROUTER` before sending messages +* *N* = 2, 3, 6, 7: Send messages before creating and binding `ZMQ_ROUTER` +* *N* = 0, 1, 2, 3: Send empty envelopes (first message part is zero) +* *N* = 4, 5, 6, 7: Send one-hop envelopes (first message part is non-zero) + +The issue becomes visible for 3 or 7 arguments: The first message part of +the first message is missing from the dump (the first "Got:"-lines are +the socket IDs assigned by the `ZMQ_ROUTER`, so those might be different +from what is shown here): + + Test uses inproc:// transport + Setting up sender + Sender set up, sending messages w/ empty envelope + Messages sent, setting up receiver + Receiver set up, receiving messages + Receiving message 1: + Got: " Ç )" + <== Where is the envelope separator? + Got: "Message data" + Receiving message 2: + Got: " Ç )" + Got: "" + Got: "Message data" + Done with sockets, cleaning up + Finished test + +For 7 arguments, it becomes obvious that the missing message part replaces +the socket identification: + + Test uses inproc:// transport + Setting up sender + Sender set up, sending messages w/ non-empty envelope + Messages sent, setting up receiver + Receiver set up, receiving messages + Receiving message 1: + Got: "socket-ID" <== This was the first message part + <== Again, the first message part is missing + Got: "" + Got: "Message data" + Receiving message 2: + Got: "socket-ID" <== The weird socket ID is used from now on + Got: "socket-ID" + Got: "" + Got: "Message data" + Done with sockets, cleaning up + Finished test diff --git a/1028/issue1028.cxx b/1028/issue1028.cxx new file mode 100644 index 0000000..8506456 --- /dev/null +++ b/1028/issue1028.cxx @@ -0,0 +1,82 @@ +#include +#include +#include +#include + +using std::cout; +using std::endl; +using std::string; + +int main(int argc, char**) +{ + char const* addr; + if((argc-1) % 2) { + addr = "inproc://address"; + cout << "Test uses inproc:// transport" << endl; + } else { + addr = "tcp://127.0.0.1:1234"; + cout << "Test uses tcp:// transport" << endl; + } + + cout << "Setting up sender" << endl; + void* ctx = zmq_ctx_new(); + assert(ctx != NULL); + void* sndr = zmq_socket(ctx, ZMQ_DEALER); + assert(sndr != NULL); + assert(0 == zmq_connect(sndr, addr)); + cout << "Sender set up, "; + + void* rcvr; + if((argc-1) % 4 < 2) { + cout << "setting up receiver" << endl; + rcvr = zmq_socket(ctx, ZMQ_ROUTER); + assert(rcvr != NULL); + assert(0 == zmq_bind(rcvr, addr)); + cout << "Receiver set up, "; + } + + if((argc-1) % 8 >= 4) { + cout << "sending messages w/ non-empty envelope" << endl; + assert(9 == zmq_send(sndr, "socket-ID", 9, ZMQ_SNDMORE)); + } else { + cout << "sending messages w/ empty envelope" << endl; + } + assert(0 == zmq_send(sndr, "", 0, ZMQ_SNDMORE)); + assert(12 == zmq_send(sndr, "Message data", 12, 0)); + if((argc-1) % 8 >= 4) + assert(9 == zmq_send(sndr, "socket-ID", 9, ZMQ_SNDMORE)); + assert(0 == zmq_send(sndr, "", 0, ZMQ_SNDMORE)); + assert(12 == zmq_send(sndr, "Message data", 12, 0)); + cout << "Messages sent, "; + + if((argc-1) % 4 >= 2) { + cout << "setting up receiver" << endl; + rcvr = zmq_socket(ctx, ZMQ_ROUTER); + assert(rcvr != NULL); + assert(0 == zmq_bind(rcvr, addr)); + cout << "Receiver set up, "; + } + + cout << "receiving messages" << endl; + for(int i=0; i<2; ++i) { + cout << "Receiving message " << i+1 << ":" << endl; + int more; + do { + char buffer[100]; + int n = zmq_recv(rcvr, buffer, sizeof(buffer), 0); + assert(n <= sizeof(buffer)); + cout << "Got: \"" << string(buffer, n) << "\"" << endl; + size_t size = sizeof(more); + assert(0 == zmq_getsockopt(rcvr, ZMQ_RCVMORE, &more, &size)); + } while(more); + } + cout << "Done with sockets, "; + + cout << "cleaning up" << endl; + assert(0 == zmq_close(sndr)); + assert(0 == zmq_close(rcvr)); + assert(0 == zmq_ctx_term(ctx)); + cout << "Finished test" << endl; + + return 0; +} From 6ec6edc4b350b651a9a6eb7664ee1347b2fd7f61 Mon Sep 17 00:00:00 2001 From: Olaf Mandel Date: Mon, 12 May 2014 14:36:56 +0200 Subject: [PATCH 5/5] Remove issue 1028: duplicate of 872 --- 1028/README.md | 60 --------------------------------- 1028/issue1028.cxx | 82 ---------------------------------------------- 2 files changed, 142 deletions(-) delete mode 100644 1028/README.md delete mode 100644 1028/issue1028.cxx diff --git a/1028/README.md b/1028/README.md deleted file mode 100644 index d8b8878..0000000 --- a/1028/README.md +++ /dev/null @@ -1,60 +0,0 @@ -Issue 1028 Description -====================== - -The `issue1028.cxx` test code sends two multi-part messages from a -`ZMQ_DEALER` to a `ZMQ_ROUTER` socket and outputs the message parts as they -are received. The `ZMQ_ROUTER` is bound, the `ZMQ_DEALER` connects. - -Several properties of the test can be selected by the number of command -line arguments *N*: the argument values are inconsequential, just the -number of arguments is used. There are eight different configurations for -the test, using eight (or more) arguments just wraps back to zero. - -* *N* = 0, 2, 4, 6: Use `tcp://` transport -* *N* = 1, 3, 5, 7: Use `inproc://` transport -* *N* = 0, 1, 4, 5: Create and bind `ZMQ_ROUTER` before sending messages -* *N* = 2, 3, 6, 7: Send messages before creating and binding `ZMQ_ROUTER` -* *N* = 0, 1, 2, 3: Send empty envelopes (first message part is zero) -* *N* = 4, 5, 6, 7: Send one-hop envelopes (first message part is non-zero) - -The issue becomes visible for 3 or 7 arguments: The first message part of -the first message is missing from the dump (the first "Got:"-lines are -the socket IDs assigned by the `ZMQ_ROUTER`, so those might be different -from what is shown here): - - Test uses inproc:// transport - Setting up sender - Sender set up, sending messages w/ empty envelope - Messages sent, setting up receiver - Receiver set up, receiving messages - Receiving message 1: - Got: " Ç )" - <== Where is the envelope separator? - Got: "Message data" - Receiving message 2: - Got: " Ç )" - Got: "" - Got: "Message data" - Done with sockets, cleaning up - Finished test - -For 7 arguments, it becomes obvious that the missing message part replaces -the socket identification: - - Test uses inproc:// transport - Setting up sender - Sender set up, sending messages w/ non-empty envelope - Messages sent, setting up receiver - Receiver set up, receiving messages - Receiving message 1: - Got: "socket-ID" <== This was the first message part - <== Again, the first message part is missing - Got: "" - Got: "Message data" - Receiving message 2: - Got: "socket-ID" <== The weird socket ID is used from now on - Got: "socket-ID" - Got: "" - Got: "Message data" - Done with sockets, cleaning up - Finished test diff --git a/1028/issue1028.cxx b/1028/issue1028.cxx deleted file mode 100644 index 8506456..0000000 --- a/1028/issue1028.cxx +++ /dev/null @@ -1,82 +0,0 @@ -#include -#include -#include -#include - -using std::cout; -using std::endl; -using std::string; - -int main(int argc, char**) -{ - char const* addr; - if((argc-1) % 2) { - addr = "inproc://address"; - cout << "Test uses inproc:// transport" << endl; - } else { - addr = "tcp://127.0.0.1:1234"; - cout << "Test uses tcp:// transport" << endl; - } - - cout << "Setting up sender" << endl; - void* ctx = zmq_ctx_new(); - assert(ctx != NULL); - void* sndr = zmq_socket(ctx, ZMQ_DEALER); - assert(sndr != NULL); - assert(0 == zmq_connect(sndr, addr)); - cout << "Sender set up, "; - - void* rcvr; - if((argc-1) % 4 < 2) { - cout << "setting up receiver" << endl; - rcvr = zmq_socket(ctx, ZMQ_ROUTER); - assert(rcvr != NULL); - assert(0 == zmq_bind(rcvr, addr)); - cout << "Receiver set up, "; - } - - if((argc-1) % 8 >= 4) { - cout << "sending messages w/ non-empty envelope" << endl; - assert(9 == zmq_send(sndr, "socket-ID", 9, ZMQ_SNDMORE)); - } else { - cout << "sending messages w/ empty envelope" << endl; - } - assert(0 == zmq_send(sndr, "", 0, ZMQ_SNDMORE)); - assert(12 == zmq_send(sndr, "Message data", 12, 0)); - if((argc-1) % 8 >= 4) - assert(9 == zmq_send(sndr, "socket-ID", 9, ZMQ_SNDMORE)); - assert(0 == zmq_send(sndr, "", 0, ZMQ_SNDMORE)); - assert(12 == zmq_send(sndr, "Message data", 12, 0)); - cout << "Messages sent, "; - - if((argc-1) % 4 >= 2) { - cout << "setting up receiver" << endl; - rcvr = zmq_socket(ctx, ZMQ_ROUTER); - assert(rcvr != NULL); - assert(0 == zmq_bind(rcvr, addr)); - cout << "Receiver set up, "; - } - - cout << "receiving messages" << endl; - for(int i=0; i<2; ++i) { - cout << "Receiving message " << i+1 << ":" << endl; - int more; - do { - char buffer[100]; - int n = zmq_recv(rcvr, buffer, sizeof(buffer), 0); - assert(n <= sizeof(buffer)); - cout << "Got: \"" << string(buffer, n) << "\"" << endl; - size_t size = sizeof(more); - assert(0 == zmq_getsockopt(rcvr, ZMQ_RCVMORE, &more, &size)); - } while(more); - } - cout << "Done with sockets, "; - - cout << "cleaning up" << endl; - assert(0 == zmq_close(sndr)); - assert(0 == zmq_close(rcvr)); - assert(0 == zmq_ctx_term(ctx)); - cout << "Finished test" << endl; - - return 0; -}