Henry,

Could you log an issue for this problem?

For what it's worth, you can make this code simpler using CZMQ:

#include "czmq.h"

int main () {
    zctx_t *ctx = zctx_new ();

    //  Sink socket
    void *sink = zsocket_new (ctx, ZMQ_PULL);
    zsocket_bind (sink, "tcp://*:5565");

    //  Pub socket
    void *publisher = zsocket_new (ctx, ZMQ_PUB);
    zsocket_bind (publisher, "tcp://*:5566");

    while (1) {
        //  Read message contents
        zmsg_t *msg = zmsg_recv (sink);
        if (!msg)
            break;          //  Interrupted
        zmsg_send (&msg, publisher);
     }
     zctx_destroy (&ctx);
     return 0;
}




On Mon, Oct 17, 2011 at 5:40 PM, Henry Geddes <[email protected]> wrote:
> Ok so we tried our stupider code:
>
>  4 #include "zhelpers.h"
>  5 #include <stdio.h>
>  6
>  7 int main () {
>  8     //s_version ();
>  9
>  10     void *context = zmq_init (1);
>  11
>  12     // Sink socket
>  13     void *sink = zmq_socket (context, ZMQ_PULL);
>  14     zmq_bind (sink, "tcp://*:5565");
>  15
>  16     // Pub socket
>  17     void *publisher = zmq_socket (context, ZMQ_PUB);
>  18     zmq_bind (publisher, "tcp://*:5566");
>  19
>  20     while (1) {
>  21         // Read message contents
>  22         char *contents = s_recv (sink);
>  23         if (strlen(contents)) s_send(publisher, contents);
>  24         free (contents);
>  25     }
>  26     // We never get here but clean up anyhow
>  27
>  28     zmq_close (publisher);
>  29     zmq_close (sink);
>  30     zmq_term (context);
>  31     return 0;
>  32 }
>
> We checked out the master branch and have tested with that.  We have not seen 
> the unhandled error.  We have had this fall over once so far and currently 
> are testing to see if it does again.
>
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Pieter Hintjens
> Sent: Monday, October 17, 2011 2:36 PM
> To: ZeroMQ development list
> Subject: Re: [zeromq-dev] C Based ZeroMQ Aggregation Server Problems...
>
> On Mon, Oct 17, 2011 at 4:23 PM, Ian Barber <[email protected]> wrote:
>
>>> I have noticed this error "E: unhandled error on recv: 11/Resource 
>>> temporarily unavailable" but it does not seem to correlate with the issue.
>>
>> Ah, that's interesting - Pieter is this related the nbytes == 1 fix
>> you put in recently? Henry, could you possibly try this against
>> zeromq2-1 master?
>
> Yes, the message will appear randomly but have no other effect afaik.
> I'll make a new stable release pretty soon.
>
> Henry,
>
> You don't need to be doing zero-copy here: just recv the message on
> one socket, send it on the other, then close it. No copying will
> happen. Zero-copy is useful when sending large application buffers.
>
> Do you know if the sink blocks when receiving off the PULL socket?
> This sounds like a bug, I can't think of any normal condition that
> would cause this. Can you confirm where the sink process is blocked?
>
> -Pieter
> _______________________________________________
> zeromq-dev mailing list
> [email protected]
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _______________________________________________
> zeromq-dev mailing list
> [email protected]
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to