[zeromq-dev] Failed to use zeromq2.2 to communicate with zeromq4.0.1

舒友村 shuyoucun at bwstor.com.cn
Tue Nov 26 10:41:47 CET 2013


Hi Pieter,
      I do some tests about communication in different zeromq version. I
found that zeromq2.2 peer received the content of message from zeromq4.0.3
peer is different from that received it from zeromq2.2 peer when the same
message is sent. Just like the following.
      In zeromq4.0.3 peer(client).
    int main (void)
{
    void *context = zmq_init (1);
    void *responder = zmq_socket (context, ZMQ_DEALER);
    int rc = zmq_connect (responder, "tcp://10.10.37.117:5555");
    assert (rc == 0);
    zmq_send(responder, "hello", 5, 0);
    sleep(10);
    return 0;
}
  In zeromq2.2 peer(server).
 int main (void)
{
        void *context = zmq_init(1);
        void *responder = zmq_socket (context, ZMQ_ROUTER);
        int rc = zmq_bind (responder, "tcp://*:5555");

        while (1) {
                zmq_msg_t msg;
                zmq_msg_init(&msg);
                zmq_recv (responder, &msg, 0);
                printf ("%s\n", zmq_msg_data(&msg));
                sleep (1);
        }
        return 0;
}

I found that it would receive 3 empty message in zeromq2.2 peer before
receiving the "hello",
but if the peer is installed zeromq4.0.3 ,just like following
 int main (void)
{
        void *context = zmq_init(1);
        void *responder = zmq_socket (context, ZMQ_ROUTER);
        int rc = zmq_bind (responder, "tcp://*:5555");
        assert (rc == 0);

        while (1) {
                char buffer[10];
                zmq_recv(responder, buffer, 10, 0);
                printf ("%s\n", buffer);
                sleep (1);          //  Do some 'work'
        }
}
there is only 1 empty message before receiving "hello". and if it is
between zeromq2.2 and zeromq2.2. the result is the same to between
zerom4.0.3 and zeromq4.0.3....
I want to know if it is expected to this result? if like this, I think my
updating one peer from zeromq2.2 to zeromq4.0.3 and the other peer retains
zerom2.2, when zeromq4.0.3 send message to zerom2.2 peer, my application
cannot explain the message. Or any problem my usage? thanks...


On Sun, Nov 24, 2013 at 7:37 PM, Pieter Hintjens <ph at imatix.com> wrote:

> Hi,
>
> Sorry for the slow response.
>
> So there are some problems with your test case.
>
> - zmq_send in ZMQ/2.x sends a zmq_msg_t structure, not a memory buffer
> - the ROUTER socket will return an identity blob as first part; you
> cannot print this as a string
>
> When I fix these problems and run the test case, it crashes as follows:
>
> Assertion failed: buffer_size == header_size (stream_engine.cpp:484)
>
> Which is issue 569, https://zeromq.jira.com/browse/LIBZMQ-569.
>
> I'll cut a new stable release with this fix. In the mean time you can
> build the stable version from https://github.com/zeromq/zeromq4-x
>
> -Pieter
>
> On Fri, Nov 22, 2013 at 4:05 PM, 舒友村 <shuyoucun at bwstor.com.cn> wrote:
> > Hi , The following is my test case.
> > The peer installed zeromq2.2:
> > int main (void)
> > {
> >     //  Socket to talk to clients
> >     void *context = zmq_init (1);
> >     void *responder = zmq_socket (context, ZMQ_DEALER);
> >     int rc = zmq_connect (responder, "tcp://10.10.19.154:5555");
> >     assert (rc == 0);
> >
> >     char buffer [10];
> >     zmq_send(responder, "hello", 0);
> >     sleep(10);
> >     return 0;
> > }
> >
> > The peer installed zeromq4.0.1
> > int main (void)
> > {
> > void *context = zmq_init(1);
> > void *responder = zmq_socket (context, ZMQ_ROUTER);
> > int rc = zmq_bind (responder, "tcp://*:5555");
> > assert (rc == 0);
> >
> > while (1) {
> > char buffer [10];
> > memset(buffer, 0, 10);
> > zmq_recv (responder, buffer,10, 0);
> > printf ("%s\n", buffer);
> > sleep (1);          //  Do some 'work'
> > }
> > return 0;
> > }
> > when connecting ,the crash happened in the peer which installed
> > zeromq4.0.1..Just like the following.
> > Assertion failed: buffer_size == header_size (stream_engine.cpp:485)
> > Aborted
> > Thanks...
> >
> >
> > On Fri, Nov 22, 2013 at 8:12 PM, Pieter Hintjens <ph at imatix.com> wrote:
> >>
> >> OK, can you show us some very simple code that causes the problem for
> >> you? Then I'll test this on various versions of ZMQ.
> >>
> >> On Fri, Nov 22, 2013 at 3:55 AM, 舒友村 <shuyoucun at bwstor.com.cn> wrote:
> >> > Hi, Sorry, I donot understand "test off libzmq master" clearly. I have
> >> > do
> >> > the test: used zeromq3.2.4 as the ROUTER peer, it doest crash when
> >> > DEALER
> >> > peer connect to ROUTER peer, but the ROUTER socket receive nothing
> from
> >> > DEALER peer when use zmq_send() to send messages. Does not the
> >> > zeromq3.2.4
> >> > support to communicate wtih zeromq2.2? Thanks..
> >> >
> >> >
> >> > On Thu, Nov 21, 2013 at 11:36 PM, Pieter Hintjens <ph at imatix.com>
> wrote:
> >> >>
> >> >> There was a bug in ZeroMQ 4.0.1 which might be causing this. Could
> you
> >> >> test off libzmq master and tell us if it still crashes?
> >> >>
> >> >> On Thu, Nov 21, 2013 at 4:31 PM, 舒友村 <shuyoucun at bwstor.com.cn>
> wrote:
> >> >> > HI, I used the DEALER and ROUTER sockets. when the DEALER socket
> >> >> > (zeromq2.2
> >> >> > )connect to ROUTER(zeromq4.0.1), the abort happened in handshake
> when
> >> >> > connecting.I donot know whether it is not support this
> usage.Thanks..
> >> >> >
> >> >> >
> >> >> > On Thu, Nov 21, 2013 at 6:48 PM, Pieter Hintjens <ph at imatix.com>
> >> >> > wrote:
> >> >> >>
> >> >> >> Hi, what socket types are you using on each side?
> >> >> >>
> >> >> >> -Pieter
> >> >> >> _______________________________________________
> >> >> >> zeromq-dev mailing list
> >> >> >> zeromq-dev at lists.zeromq.org
> >> >> >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> > --
> >> >> >
> >> >> > best!
> >> >> >
> >> >> >
> >> >> >
> >> >> > 舒友村
> >> >> >
> >> >> > _______________________________________________
> >> >> > zeromq-dev mailing list
> >> >> > zeromq-dev at lists.zeromq.org
> >> >> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> -
> >> >> Pieter Hintjens
> >> >> CEO of iMatix.com
> >> >> Founder of ZeroMQ community
> >> >> blog: http://hintjens.com
> >> >> _______________________________________________
> >> >> zeromq-dev mailing list
> >> >> zeromq-dev at lists.zeromq.org
> >> >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >> >
> >> >
> >> >
> >> >
> >> > --
> >> >
> >> > best!
> >> >
> >> >
> >> >
> >> > 舒友村
> >> >
> >> > _______________________________________________
> >> > zeromq-dev mailing list
> >> > zeromq-dev at lists.zeromq.org
> >> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >> >
> >>
> >>
> >>
> >> --
> >> -
> >> Pieter Hintjens
> >> CEO of iMatix.com
> >> Founder of ZeroMQ community
> >> blog: http://hintjens.com
> >> _______________________________________________
> >> zeromq-dev mailing list
> >> zeromq-dev at lists.zeromq.org
> >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >
> >
> >
> >
> > --
> >
> > best!
> >
> >
> >
> > 舒友村
> >
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >
>
>
>
> --
> -
> Pieter Hintjens
> CEO of iMatix.com
> Founder of ZeroMQ community
> blog: http://hintjens.com
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



-- 

best!


舒友村
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20131126/cd59ff4c/attachment.html>


More information about the zeromq-dev mailing list