[zeromq-dev] Want to submit pull request for a feature, running into GSL/Zproject problems

2017-09-29 Thread Kevin Wang

Hi,

I've sent some emails about malamute not having the ability to remove 
subscriptions to a stream. No one answered them, so I took it into my 
own hands to learn how ZProject works and do it myself, as the 
functionality already exists, just not to the clients.


I changed the files mlm_client.xml, mlm_client.c, mlm_server.xml, 
mlm_server.c, and mlm_proto.xml.
After running GSL on them and compiling, I ran into a lot of compilation 
errors, which don't make any sense to me, all of which come from the 
mlm_proto code.


I manually edited mlm_proto.c and the feature works! But I'd like to do 
it correctly and make a pull request for this.


All I added in mlm_proto.xml was the following under stream operations:

    
    Cancels and removes all subscriptions to a stream .
    Server replies with OK or ERROR.
    Name of stream
    

Generating the c code and compiling resulted in errors like this:

src/mlm_proto.c: In function ‘mlm_proto_new_zpl’:
src/mlm_proto.c:488:40: error: passing argument 1 of ‘zmsg_decode’ from 
incompatible pointer type [-Werror=incompatible-pointer-types]

 zmsg_t *msg = zmsg_decode (bvalue, strlen (s) / 2);
    ^
In file included from /usr/local/include/czmq_library.h:156:0,
 from /usr/local/include/czmq.h:37,
 from src/../include/mlm_library.h:24,
 from src/../include/malamute.h:17,
 from src/mlm_classes.h:24,
 from src/mlm_proto.c:35:
/usr/local/include/zmsg.h:48:5: note: expected ‘zframe_t * {aka struct 
_zframe_t *}’ but argument is of type ‘byte * {aka unsigned char *}’

 zmsg_decode (zframe_t *frame);

Following the line numbers, I see that a few new functions were defined, 
like mlm_proto_new_zpl(zconfig_t *config).


Can anybody help guide me through this??

Many thanks,
Kevin
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
https://lists.zeromq.org/mailman/listinfo/zeromq-dev


[zeromq-dev] EGMP and different subnets

2017-09-29 Thread Yamian Quintero
Hi fellows and thanks for accepting me in your list.

I'm trying to get 0mq sending messages via EPGM using PUB/SUB sockets. I'm 
using the latest stable release 4.2.2.
If both hosts are in the same subnetwork, the messages do flow properly. If the 
hosts are in different subnets, no message reach the second subnet (no traffic 
at all is seen in tcpdump on that multicast address).
If I use pgmsend/pgmrecv that is built with OpenPGM examples, the messages do 
reach the second host properly, using the same multicast address and port.
My code is just a slightly modified version of the weather server sample.

This is my PUB server:

   void *pub = zmq_socket (ctx, ZMQ_PUB);
   char *message_body = (char*)MESSAGE_BODY;


   rc = zmq_bind (pub, "epgm://192.168.215.99;239.192.1.1:5556");
   if (rc != 0){
cout << "Error: " << zmq_strerror (errno) << " while binding 
to: " << config.connection_url << endl;
exit(1);
   }
   msleep (SETTLE_TIME);

   srand(time(0));
   int zip;
   int temp;
   char *message = new char[255];
   while (loop){
zip =  + (rand()%5);
temp = (rand()%215) - 80;
memset((char*)message, 255, 0);
sprintf(message, "%d %d", zip, temp);
send_str(pub, message);
msleep(1000);
   }

   delete [] message;


This is my code for the SUB client:

   void *sub = zmq_socket (ctx, ZMQ_SUB);

   rc = zmq_connect (sub, "epgm://192.168.216.100;239.192.1.1:5556");

   if (rc != 0){
cout << "Error: " << zmq_strerror (errno) << " while connecting 
to: " << "epgm://192.168.216.100;239.192.1.1:5556"<< endl;
exit(1);
   }
   rc = zmq_setsockopt (sub, ZMQ_SUBSCRIBE, TOPIC, strlen(TOPIC));
   if (rc != 0){
cout << "Error: " << zmq_strerror (errno) << " while 
subscribing to: " << TOPIC << endl;
exit(1);
   }

   for (int i=0; i<5; i++){
 print_str_recv(sub);
   }


The interesting part is what we observe in the routers.

If I use pgmsend/pgmrecv from libpgm-5.2.122, as soon as I start pgmrecv, this 
is the mroute as seen in the router:

DEV-SW-01#sh ip mroute
IP Multicast Routing Table
Flags: D - Dense, S - Sparse, B - Bidir Group, s - SSM Group, C - Connected,
   L - Local, P - Pruned, R - RP-bit set, F - Register flag,
   T - SPT-bit set, J - Join SPT, M - MSDP created entry,
   X - Proxy Join Timer Running, A - Candidate for MSDP Advertisement,
   U - URD, I - Received Source Specific Host Report,
   Z - Multicast Tunnel, z - MDT-data group sender,
   Y - Joined MDT-data group, y - Sending to MDT-data group
   V - RD & Vector, v - Vector
Outgoing interface flags: H - Hardware switched, A - Assert winner
Timers: Uptime/Expires
Interface state: Interface, Next-Hop or VCD, State/Mode

(*, 239.192.1.1), 00:00:12/00:02:57, RP 10.222.41.1, flags: SJC
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list:
Vlan1, Forward/Sparse, 00:00:12/00:02:57

Vlan1 is where the pgmrecv's host is connected to.

When I send a message from the other host, the mroute does have an active 
source, with the proper incoming interface:

DEV-SW-01#sh ip mroute
IP Multicast Routing Table
Flags: D - Dense, S - Sparse, B - Bidir Group, s - SSM Group, C - Connected,
   L - Local, P - Pruned, R - RP-bit set, F - Register flag,
   T - SPT-bit set, J - Join SPT, M - MSDP created entry,
   X - Proxy Join Timer Running, A - Candidate for MSDP Advertisement,
   U - URD, I - Received Source Specific Host Report,
   Z - Multicast Tunnel, z - MDT-data group sender,
   Y - Joined MDT-data group, y - Sending to MDT-data group
   V - RD & Vector, v - Vector
Outgoing interface flags: H - Hardware switched, A - Assert winner
Timers: Uptime/Expires
Interface state: Interface, Next-Hop or VCD, State/Mode

(*, 239.192.1.1), 00:02:29/stopped, RP 10.222.41.1, flags: SJC
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list:
Vlan1, Forward/Sparse, 00:02:29/00:02:08

(192.168.216.100, 239.192.1.1), 00:00:08/00:02:51, flags: T
  Incoming interface: Vlan215, RPF nbr 0.0.0.0
  Outgoing interface list:
Vlan1, Forward/Sparse, 00:00:08/00:02:51

Vlan215 is where the pgmsend's host is connected to.


If I repeat this process, using the 0mq-based code, there is something weird 
happening in the mroute.

When I start the PUB server, the mroute looks just as in the pgmrecv case:

DEV-SW-01#sh ip mroute
IP Multicast Routing Table
Flags: D - Dense, S - Sparse, B - Bidir Group, s - SSM Group, C - Connected,
   L - Local, P - Pruned, R - RP-bit set, F - Register flag,
   T - SPT-bit set, J - Join SPT, M - MSDP created entry,
   X - Proxy Join Timer Running, A - Candidate for MSDP Advertisement,
   U - URD, I - Received Source Specific Host Report,
   Z - Multicast Tunnel, z - MDT

Re: [zeromq-dev] How to cite ZeroMQ in publications

2017-09-29 Thread Luca Boccassi
That's probably the best bet, the full title is "ZeroMQ Messaging for
Many Applications" published by O'Reilly

On Mon, 2017-09-25 at 22:20 +, Frittum Johannes wrote:
> Hi Hans,
> 
> Pieter’s book should be citeable (but does not cover recent
> development).
> 
> Warm regards
> Johannes Frittum
> 
> Von: zeromq-dev [mailto:zeromq-dev-boun...@lists.zeromq.org] Im
> Auftrag von Kevin Sapper
> Gesendet: Montag, 25. September 2017 21:30
> An: ZeroMQ development list
> Betreff: Re: [zeromq-dev] How to cite ZeroMQ in publications
> 
> Hi Hans,
> I don't know of any papers but if you like to cite ZeroMQ, IMO its
> best to reference the formal ZeroMQ Message Transport Protocol (https
> ://rfc.zeromq.org/spec:23/ZMTP).
> Cheers
> Kevin
> 
> 2017-09-25 15:47 GMT+02:00 Hans Fangohr  hans.fang...@xfel.eu>>:
> Hi all,
> 
> I searched mailing list archives and webpages but can’t find any
> guidance on how to cite ZeroMQ in publications.
> 
> Is there a preference or even a paper  / book / technical report?
> 
> Thank you,
> 
> Hans
> 
> 
> ___
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
> 
> Wichtiger Hinweis: Diese E-Mail Nachricht kann Betriebs- oder
> Geschäftsgeheimnisse oder sonstige vertrauliche Informationen
> enthalten. Wenn Sie nicht der Adressat sind und diese Nachricht
> irrtümlich erhalten haben, ist Ihnen eine Verwendung des Inhalts,
> eine Vervielfältigung oder Weitergabe dieser Nachricht ausdrücklich
> untersagt. Bitte benachrichtigen Sie uns und vernichten Sie die
> empfangene Nachricht. Vielen Dank. Please Note: This e-mail message
> may contain trade secrets or privileged, undisclosed or otherwise
> confidential information. If you are not the intended recipient and
> have received this message in error or by mistake any unauthorized
> use, reproduction or distribution of this message is strictly
> prohibited. Please notify us immediately and destroy the original
> transmittal. Thank you for your cooperation. Austro Control
> Österreichische Gesellschaft für Zivilluftfahrt mit beschränkter
> Haftung Sitz/Registered address: Wien/ Vienna; Registriert
> unter/registered under: FN 71000m Competent court/Firmenbuchgericht:
> HG Wien/commercial court Vienna; Rechtsform/legal form: GmbH
> Postanschrift/postal address: Wagramer Straße 19 - 1220 Wien/Vienna
> DVR: 0447277 ‬
> ___
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev

-- 
Kind regards,
Luca Boccassi

signature.asc
Description: This is a digitally signed message part
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
https://lists.zeromq.org/mailman/listinfo/zeromq-dev


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

2017-09-29 Thread Luca Boccassi
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#L243 )
> 
>   Stack trace of thread 8576:
>   #0  0x7f56d22a78a0 raise (libc.so.6)
>   #1  0x7f56d22a8f09 abort (libc.so.6)
>   #2  0x7f5686c7cc99 n/a 
> (/home/flex/core-1.5.0-SNAPSHOT/lib/native/libzmq.so.5)
>   #3  0x7f56d26255a0 _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, "", &topic, ×tamp, &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.

-- 
Kind regards,
Luca Boccassi

signature.asc
Description: This is a digitally signed message part
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
https://lists.zeromq.org/mailman/listinfo/zeromq-dev


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

2017-09-29 Thread Luca Boccassi
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#L243 )
> 
>   Stack trace of thread 8576:
>   #0  0x7f56d22a78a0 raise (libc.so.6)
>   #1  0x7f56d22a8f09 abort (libc.so.6)
>   #2  0x7f5686c7cc99 n/a 
> (/home/flex/core-1.5.0-SNAPSHOT/lib/native/libzmq.so.5)
>   #3  0x7f56d26255a0 _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, "", &topic, ×tamp, &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.

-- 
Kind regards,
Luca Boccassi

signature.asc
Description: This is a digitally signed message part
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
https://lists.zeromq.org/mailman/listinfo/zeromq-dev


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

2017-09-29 Thread Marcin Romaszewicz
On Fri, Sep 29, 2017 at 2:38 AM, Bachmair Florian - flexSolution GmbH <
florian.bachm...@flexsolution.eu> 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#L243 )
>
>  Stack trace of thread 8576:
>  #0  0x7f56d22a78a0 raise (libc.so.6)
>  #1  0x7f56d22a8f09 abort (libc.so.6)
>  #2  0x7f5686c7cc99 n/a (/home/flex/core-1.5.0-
> SNAPSHOT/lib/native/libzmq.so.5)
>  #3  0x7f56d26255a0 _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?
>

You need to send it a message telling it to quit.


> 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, "", &topic, ×tamp, &id, &value);
>
> onMessageReceived(topic, timestamp, id,value);
> }
> }
>
> Thanks Florian
>
>
>
>
> ___
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
https://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] thread safety using inproc sockets for inter-thread communication

2017-09-29 Thread Wes Young
[i’m only able to skim this atm but..]

have you looked at how zauth works in czmq (using the actor models):

https://github.com/zeromq/czmq/blob/master/src/zauth.c
https://rfc.zeromq.org/spec:27/ZAP/

it sounds similar [at-least as an example], or at-least any of the “actors” in 
zeromq kinda work.. (although sounds like zauth is the closest because it’s 
inproc).

may not be 1-1 but at-least some more up to date examples..

> On Sep 27, 2017, at 5:52 PM, Bill Torpey  wrote:
> 
> 
> Can anyone suggest a solution?  I can’t really see any other way to do 
> inter-thread communication safely with ZeroMQ.
> 
> Any hints, tips, suggestions would be much appreciated!  And, let me know if 
> this would be better discussed in GitHub issues.

--
wes
wesyoung.me



signature.asc
Description: Message signed with OpenPGP
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
https://lists.zeromq.org/mailman/listinfo/zeromq-dev


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

2017-09-29 Thread Bachmair Florian - flexSolution GmbH

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#L243 )


 Stack trace of thread 8576:
 #0  0x7f56d22a78a0 raise (libc.so.6)
 #1  0x7f56d22a8f09 abort (libc.so.6)
 #2  0x7f5686c7cc99 n/a 
(/home/flex/core-1.5.0-SNAPSHOT/lib/native/libzmq.so.5)

 #3  0x7f56d26255a0 _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, "", &topic, ×tamp, &id, &value);

onMessageReceived(topic, timestamp, id,value);
}
}

Thanks Florian



___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
https://lists.zeromq.org/mailman/listinfo/zeromq-dev