[zeromq-dev] Assertion failed: pfd.revents & POLLIN (src/signaler.cpp:243)

Luca Boccassi luca.boccassi at gmail.com
Mon Oct 9 11:33:52 CEST 2017


On Mon, 2017-10-09 at 07:08 +0200, Bachmair Florian - flexSolution GmbH
wrote:
> Thanks for the reply!
> 
> But how can I listen to both sockets, pipe and subscriber?
> 
> Are there any examples how to do that?

You can use the zpoller class, the doc page I linked before in the
example already uses it, you can just add a new socket to it with
zpoller_add (), and then expand the example to also compare it with
your other socket.

> On 2017-09-29 22:14, Luca Boccassi wrote:
> > On Fri, 2017-09-29 at 11:38 +0200, Bachmair Florian - flexSolution
> > GmbH
> > wrote:
> > > Hi!
> > > 
> > > When I stop my application in roughly 1 out of 20 tries I get
> > > this
> > > error:
> > > 
> > > Assertion failed: pfd.revents & POLLIN (src/signaler.cpp:243)
> > > (here
> > > is
> > > the corresponding line of code:
> > > https://github.com/zeromq/libzmq/blob/v4.2.0/src/signaler.cpp#L24
> > > 3 )
> > > 
> > >        Stack trace of thread 8576:
> > >            #0  0x00007f56d22a78a0 raise (libc.so.6)
> > >            #1  0x00007f56d22a8f09 abort (libc.so.6)
> > >            #2  0x00007f5686c7cc99 n/a
> > > (/home/flex/core-1.5.0-SNAPSHOT/lib/native/libzmq.so.5)
> > >            #3  0x00007f56d26255a0 _IO_2_1_stderr_ (libc.so.6)
> > > 
> > > 
> > > Before I stop my application I disconnect from ALL publishers
> > > with
> > > 
> > > zsock_disconnect(subscriber, "tcp://%s:%d", c_ip, port);
> > > 
> > > after that I destroy my sockets and actors
> > > 
> > > zsock_destroy(&publisher);
> > >      zsock_destroy(&req);
> > >      zsock_destroy(&subscriber);
> > > 
> > >      //this is never finished
> > >      zactor_destroy(&actorRep);
> > >      zactor_destroy(&actorSub);
> > > 
> > > 
> > > I guess its a problem with stopping the actors, how do I
> > > propperly
> > > stop
> > > this actor?
> > > 
> > > void sub_actor(zsock_t *pipe, void *args) {
> > >       zsock_signal(pipe, 0);
> > >       while (!zsys_interrupted) {
> > >           char* topic;
> > >           char* timestamp;
> > >           char* value;
> > >           char* id;
> > >           zsock_recv(subscriber, "ssss", &topic, &timestamp, &id,
> > > &value);
> > > 
> > >           onMessageReceived(topic, timestamp, id,value);
> > >       }
> > > }
> > > 
> > > Thanks Florian
> > 
> > As the docs say, the zactor function must listen for $TERM on the
> > pipe
> > zsock_t:
> > 
> > http://czmq.zeromq.org/czmq4-0:zactor
> > https://github.com/zeromq/czmq#czmq-actors
> > 
> > zactor_destroy() from the parent will, under the hood, send the
> > $TERM
> > message and wait for the zactor to correctly close.
> > 
> > 
> > 
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > https://lists.zeromq.org/mailman/listinfo/zeromq-dev
> 
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev

-- 
Kind regards,
Luca Boccassi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20171009/3ebd8d8b/attachment.sig>


More information about the zeromq-dev mailing list