I debugged this code with 2.1.11 and 3.1.1. and tracing packets with 
CocoaPacketAnalyzer.

After connect and sleep (1) both versions have 7 packets transferred. First 
packet to have payload is packet number 4 [ACK,PUSH]. 

In v2.1.11:
- packet 4:
00000   07 7e 57 4f 52 4b 45 52                             .~WORKER
- packet 6:
00000   07 7e 53 45 52 56 45 52                             .~SERVER

In v3.1.1:
- packet 4:
00000   07 00 53 45 52 56 45 52                             ..SERVER
- packet 5:
00000   07 00 57 4f 52 4b 45 52                             ..WORKER


After this I debugged more and found that v3.1.1 never sends anything and code 
will block forever in zmq_recvmsg.

In v2.1.11 in method zmq::xrep_t::xsend this.current_out gets a value. In 
v3.1.1 this.current_out is always 0x0 and code never goes inside "if 
(current_out)":

line #159: //  Push the message into the pipe. If there's no out pipe, just 
drop it.
line #160:     if (current_out) { 



This is not my code, it is zmq example code and it should work in 3.1.1 too. I 
see that the others have problems with zmq_recv blocking. Maybe it is the same 
bug?


> I'm looking for XREP bug, issue LIBZMQ-304. I only use XREP so I can't 
> continue to test 3.1.x. Following program crashes in Windows and hangs 
> forever in OSX.
> line: s_dump(worker) -> zmq_recvmsg(socket, &message, 0).
> 
> static void MA_Zmq_Test()
> {
>  long err;    
>  void *context = zmq_init (1);
> 
>  void *worker = zmq_socket (context, ZMQ_XREP);
>  err = zmq_setsockopt (worker, ZMQ_IDENTITY, "WORKER", 6);
>  //err = zmq_bind (worker, "ipc://rtrouter.ipc");
>  err = zmq_bind (worker, "tcp://127.0.0.1:5555");
> 
>  void *server = zmq_socket (context, ZMQ_XREP);
>  err = zmq_setsockopt (server, ZMQ_IDENTITY, "SERVER", 6);
>  //err = zmq_connect (server, "ipc://rtrouter.ipc");
>  err = zmq_connect (server, "tcp://127.0.0.1:5555");
> 
>  //zmq_sleep (1); // sleep in seconds
> #if VERSIONWIN
>  Sleep (1 * 1000);
> #else
>  sleep (1);
> #endif
>  s_sendmore (server, (char *)"WORKER");
>  s_sendmore (server, (char *)"");
>  s_send     (server, (char *)"send to worker");
>  s_dump     (worker);
>  ...

--
Regards,

Pasi Mankinen
Finland
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to