Re: [zeromq-dev] SOLVED-malloc() memory corruption at zsock_new_req

2016-11-16 Thread Bachmair Florian - flexSolution GmbH

My bad, i used:

char *endpoint = (char*) malloc(sizeof(30));

instead of

char *endpoint = (char*) malloc(sizeof(char)*30);


I was lead to an library issue cause it worked fine on my developer machine.


Am 17.11.2016 um 08:03 schrieb Bachmair Florian - flexSolution GmbH:

Error occurs only on arm(raspberry pi 2)


Am 17.11.2016 um 07:53 schrieb Bachmair Florian - flexSolution GmbH:
Hi. I'm using czmq via a jni wrapper, and when I execute this 
method(See methode at the bottom of this message), the application 
crashes at the RED Codeline with


Any Ideas why this happens?

*** Error in `java': malloc(): memory corruption: 0x64e01218 ***
=== Backtrace: =
/usr/lib/libc.so.6(+0x65180)[0x76e36180]
/usr/lib/libc.so.6(+0x6bc3c)[0x76e3cc3c]
/usr/lib/libc.so.6(+0x6df90)[0x76e3ef90]
/usr/lib/libc.so.6(__libc_calloc+0xd4)[0x76e41cd8]
=== Memory map: 
8000-9000 r-xp  fd:00 58702 /opt/jdk1.8.0_111/bin/java
0001-00011000 rw-p  fd:00 58702 /opt/jdk1.8.0_111/bin/java
01735000-01756000 rw-p  00:00 0  [heap]
61a43000-61a46000 ---p  00:00 0
61a46000-61a93000 rw-p  00:00 0
61a93000-61a96000 ---p  00:00 0
61a96000-61ae3000 rw-p  00:00 0
61ae3000-61ae4000 ---p  00:00 0
61ae4000-622e3000 rw-p  00:00 0
622e3000-622e4000 ---p  00:00 0
622e4000-62ae3000 rw-p  00:00 0
62ae3000-62ae4000 ---p  00:00 0
62ae4000-632e3000 rw-p  00:00 0
632e3000-632e4000 ---p  00:00 0
632e4000-63ae3000 rw-p  00:00 0
63ae3000-63c14000 r-xp  fd:00 11181 /usr/lib/libstdc++.so.6.0.22
63c14000-63c23000 ---p 00131000 fd:00 11181 /usr/lib/libstdc++.so.6.0.22
63c23000-63c28000 r--p 0013 fd:00 11181 /usr/lib/libstdc++.so.6.0.22
63c28000-63c2a000 rw-p 00135000 fd:00 11181 /usr/lib/libstdc++.so.6.0.22
63c2a000-63c2c000 rw-p  00:00 0
63c2c000-63c75000 r-xp  fd:00 7 
/usr/lib/libpgm-5.2.so.0.0.122
63c75000-63c84000 ---p 00049000 fd:00 7 
/usr/lib/libpgm-5.2.so.0.0.122
63c84000-63c85000 r--p 00048000 fd:00 7 
/usr/lib/libpgm-5.2.so.0.0.122
63c85000-63c86000 rw-p 00049000 fd:00 7 
/usr/lib/libpgm-5.2.so.0.0.122

63c86000-63c8a000 rw-p  00:00 0
63c8a000-63d2 r-xp  fd:00 26440 
/usr/local/lib/libczmq.so.3.0.0
63d2-63d3 ---p 00096000 fd:00 26440 
/usr/local/lib/libczmq.so.3.0.0
63d3-63d32000 rw-p 00096000 fd:00 26440 
/usr/local/lib/libczmq.so.3.0.0

63d32000-63d8c000 r-xp  fd:00 11166 /usr/lib/libsodium.so.18.1.1
63d8c000-63d9b000 ---p 0005a000 fd:00 11166 /usr/lib/libsodium.so.18.1.1
63d9b000-63d9c000 r--p 00059000 fd:00 11166 /usr/lib/libsodium.so.18.1.1
63d9c000-63d9d000 rw-p 0005a000 fd:00 11166 /usr/lib/libsodium.so.18.1.1
63d9d000-63ded000 r-xp  fd:00 11283 /usr/lib/libzmq.so.5.0.1
63ded000-63dfd000 ---p 0005 fd:00 11283 /usr/lib/libzmq.so.5.0.1
63dfd000-63dff000 r--p 0005 fd:00 11283 /usr/lib/libzmq.so.5.0.1
63dff000-63e0 rw-p 00052000 fd:00 11283 /usr/lib/libzmq.so.5.0.1
63e0-63ea rw-p  00:00 0
63ea-63f0 ---p  00:00 0
63f0-63f3f000 rw-p  00:00 0
63f3f000-6400 ---p  00:00 0
6400-6410 rw-p  00:00 0
6410-6420 rw-p  00:00 0
6420-642de000 rw-p  00:00 0
642de000-6430 ---p  00:00 0
6433c000-643cc000 r-xp  00:20 14253 
/tmp/sqlite-3.7.151-arm-libsqlitejdbc.so
643cc000-643ce000 rw-p 0009 00:20 14253 
/tmp/sqlite-3.7.151-arm-libsqlitejdbc.so

643ce000-643cf000 rw-p  00:00 0
643cf000-643dd000 r-xp  fd:00 58921 
/opt/jdk1.8.0_111/jre/lib/arm/libnio.so
643dd000-643e4000 ---p e000 fd:00 58921 
/opt/jdk1.8.0_111/jre/lib/arm/libnio.so
643e4000-643e5000 rw-p d000 fd:00 58921 
/opt/jdk1.8.0_111/jre/lib/arm/libnio.so
643e5000-6440 r--s 001d2000 fd:00 58856 
/opt/jdk1.8.0_111/jre/lib/ext/nashorn.jar

6440-6450 rw-p  00:00 0
6450-645fe000 rw-p  00:00 0
645fe000-6460 ---p  00:00 0
6460-6462c000 rw-p  00:00 0
6462c000-6470 ---p  00:00 0
6470a000-6470d000 r-xp  fd:00 10836 /usr/lib/libcap.so.2.25
6470d000-6471c000 ---p 3000 fd:00 10836 /usr/lib/libcap.so.2.25
6471c000-6471d000 rw-p 2000 fd:00 10836 /usr/lib/libcap.so.2.25
6471d000-6472d000 r-xp  fd:00 11074 
/usr/lib/libnss_myhostname.so.2
6472d000-6473c000 ---p 0001 fd:00 11074 
/usr/lib/libnss_myhostname.so.2
6473c000-6473d000 r--p f000 fd:00 11074 
/usr/lib/libnss_myhostname.so.2
6473d000-6473e000 rw-p 0001 fd:00 11074 
/usr/lib/libnss_myhostname.so.2

6473e000-64751000 r-xp  fd:00 11140 /usr/lib/libresolv-2.24.so
64751000-6476 ---p 00013000 fd:00 11140 /usr/lib/libresolv-2.24.so
6476-64761000 r--p 00012000 fd:00 11140 /usr/lib/libresolv-2.24.so
64761000-64762000 rw-p 00013000 fd:00 11140 /usr/lib/libresolv-2.24.so
64762000-64764000 rw-p  00:00 0
64764000-64777000 r-xp  fd:00 5892

Re: [zeromq-dev] malloc() memory corruption at zsock_new_req

2016-11-16 Thread Bachmair Florian - flexSolution GmbH

Error occurs only on arm(raspberry pi 2)


Am 17.11.2016 um 07:53 schrieb Bachmair Florian - flexSolution GmbH:
Hi. I'm using czmq via a jni wrapper, and when I execute this 
method(See methode at the bottom of this message), the application 
crashes at the RED Codeline with


Any Ideas why this happens?

*** Error in `java': malloc(): memory corruption: 0x64e01218 ***
=== Backtrace: =
/usr/lib/libc.so.6(+0x65180)[0x76e36180]
/usr/lib/libc.so.6(+0x6bc3c)[0x76e3cc3c]
/usr/lib/libc.so.6(+0x6df90)[0x76e3ef90]
/usr/lib/libc.so.6(__libc_calloc+0xd4)[0x76e41cd8]
=== Memory map: 
8000-9000 r-xp  fd:00 58702 /opt/jdk1.8.0_111/bin/java
0001-00011000 rw-p  fd:00 58702 /opt/jdk1.8.0_111/bin/java
01735000-01756000 rw-p  00:00 0  [heap]
61a43000-61a46000 ---p  00:00 0
61a46000-61a93000 rw-p  00:00 0
61a93000-61a96000 ---p  00:00 0
61a96000-61ae3000 rw-p  00:00 0
61ae3000-61ae4000 ---p  00:00 0
61ae4000-622e3000 rw-p  00:00 0
622e3000-622e4000 ---p  00:00 0
622e4000-62ae3000 rw-p  00:00 0
62ae3000-62ae4000 ---p  00:00 0
62ae4000-632e3000 rw-p  00:00 0
632e3000-632e4000 ---p  00:00 0
632e4000-63ae3000 rw-p  00:00 0
63ae3000-63c14000 r-xp  fd:00 11181 /usr/lib/libstdc++.so.6.0.22
63c14000-63c23000 ---p 00131000 fd:00 11181 /usr/lib/libstdc++.so.6.0.22
63c23000-63c28000 r--p 0013 fd:00 11181 /usr/lib/libstdc++.so.6.0.22
63c28000-63c2a000 rw-p 00135000 fd:00 11181 /usr/lib/libstdc++.so.6.0.22
63c2a000-63c2c000 rw-p  00:00 0
63c2c000-63c75000 r-xp  fd:00 7 /usr/lib/libpgm-5.2.so.0.0.122
63c75000-63c84000 ---p 00049000 fd:00 7 /usr/lib/libpgm-5.2.so.0.0.122
63c84000-63c85000 r--p 00048000 fd:00 7 /usr/lib/libpgm-5.2.so.0.0.122
63c85000-63c86000 rw-p 00049000 fd:00 7 /usr/lib/libpgm-5.2.so.0.0.122
63c86000-63c8a000 rw-p  00:00 0
63c8a000-63d2 r-xp  fd:00 26440 
/usr/local/lib/libczmq.so.3.0.0
63d2-63d3 ---p 00096000 fd:00 26440 
/usr/local/lib/libczmq.so.3.0.0
63d3-63d32000 rw-p 00096000 fd:00 26440 
/usr/local/lib/libczmq.so.3.0.0

63d32000-63d8c000 r-xp  fd:00 11166 /usr/lib/libsodium.so.18.1.1
63d8c000-63d9b000 ---p 0005a000 fd:00 11166 /usr/lib/libsodium.so.18.1.1
63d9b000-63d9c000 r--p 00059000 fd:00 11166 /usr/lib/libsodium.so.18.1.1
63d9c000-63d9d000 rw-p 0005a000 fd:00 11166 /usr/lib/libsodium.so.18.1.1
63d9d000-63ded000 r-xp  fd:00 11283 /usr/lib/libzmq.so.5.0.1
63ded000-63dfd000 ---p 0005 fd:00 11283 /usr/lib/libzmq.so.5.0.1
63dfd000-63dff000 r--p 0005 fd:00 11283 /usr/lib/libzmq.so.5.0.1
63dff000-63e0 rw-p 00052000 fd:00 11283 /usr/lib/libzmq.so.5.0.1
63e0-63ea rw-p  00:00 0
63ea-63f0 ---p  00:00 0
63f0-63f3f000 rw-p  00:00 0
63f3f000-6400 ---p  00:00 0
6400-6410 rw-p  00:00 0
6410-6420 rw-p  00:00 0
6420-642de000 rw-p  00:00 0
642de000-6430 ---p  00:00 0
6433c000-643cc000 r-xp  00:20 14253 
/tmp/sqlite-3.7.151-arm-libsqlitejdbc.so
643cc000-643ce000 rw-p 0009 00:20 14253 
/tmp/sqlite-3.7.151-arm-libsqlitejdbc.so

643ce000-643cf000 rw-p  00:00 0
643cf000-643dd000 r-xp  fd:00 58921 
/opt/jdk1.8.0_111/jre/lib/arm/libnio.so
643dd000-643e4000 ---p e000 fd:00 58921 
/opt/jdk1.8.0_111/jre/lib/arm/libnio.so
643e4000-643e5000 rw-p d000 fd:00 58921 
/opt/jdk1.8.0_111/jre/lib/arm/libnio.so
643e5000-6440 r--s 001d2000 fd:00 58856 
/opt/jdk1.8.0_111/jre/lib/ext/nashorn.jar

6440-6450 rw-p  00:00 0
6450-645fe000 rw-p  00:00 0
645fe000-6460 ---p  00:00 0
6460-6462c000 rw-p  00:00 0
6462c000-6470 ---p  00:00 0
6470a000-6470d000 r-xp  fd:00 10836 /usr/lib/libcap.so.2.25
6470d000-6471c000 ---p 3000 fd:00 10836 /usr/lib/libcap.so.2.25
6471c000-6471d000 rw-p 2000 fd:00 10836 /usr/lib/libcap.so.2.25
6471d000-6472d000 r-xp  fd:00 11074 
/usr/lib/libnss_myhostname.so.2
6472d000-6473c000 ---p 0001 fd:00 11074 
/usr/lib/libnss_myhostname.so.2
6473c000-6473d000 r--p f000 fd:00 11074 
/usr/lib/libnss_myhostname.so.2
6473d000-6473e000 rw-p 0001 fd:00 11074 
/usr/lib/libnss_myhostname.so.2

6473e000-64751000 r-xp  fd:00 11140 /usr/lib/libresolv-2.24.so
64751000-6476 ---p 00013000 fd:00 11140 /usr/lib/libresolv-2.24.so
6476-64761000 r--p 00012000 fd:00 11140 /usr/lib/libresolv-2.24.so
64761000-64762000 rw-p 00013000 fd:00 11140 /usr/lib/libresolv-2.24.so
64762000-64764000 rw-p  00:00 0
64764000-64777000 r-xp  fd:00 58928 
/opt/jdk1.8.0_111/jre/lib/arm/libnet.so
64777000-6477f000 ---p 00013000 fd:00 58928 
/opt/jdk1.8.0_111/jre/lib/arm/libnet.so
6477f000-6478 rw-p 00013000 fd:00 58928 
/opt/jdk1.8.0_111/jre/lib/arm/libnet.so

6478-64781000 ---p  00:00 0
64781000-6480 rw-p  00:

[zeromq-dev] malloc() memory corruption at zsock_new_req

2016-11-16 Thread Bachmair Florian - flexSolution GmbH
Hi. I'm using czmq via a jni wrapper, and when I execute this method(See 
methode at the bottom of this message), the application crashes at the 
RED Codeline with


Any Ideas why this happens?

*** Error in `java': malloc(): memory corruption: 0x64e01218 ***
=== Backtrace: =
/usr/lib/libc.so.6(+0x65180)[0x76e36180]
/usr/lib/libc.so.6(+0x6bc3c)[0x76e3cc3c]
/usr/lib/libc.so.6(+0x6df90)[0x76e3ef90]
/usr/lib/libc.so.6(__libc_calloc+0xd4)[0x76e41cd8]
=== Memory map: 
8000-9000 r-xp  fd:00 58702 /opt/jdk1.8.0_111/bin/java
0001-00011000 rw-p  fd:00 58702 /opt/jdk1.8.0_111/bin/java
01735000-01756000 rw-p  00:00 0  [heap]
61a43000-61a46000 ---p  00:00 0
61a46000-61a93000 rw-p  00:00 0
61a93000-61a96000 ---p  00:00 0
61a96000-61ae3000 rw-p  00:00 0
61ae3000-61ae4000 ---p  00:00 0
61ae4000-622e3000 rw-p  00:00 0
622e3000-622e4000 ---p  00:00 0
622e4000-62ae3000 rw-p  00:00 0
62ae3000-62ae4000 ---p  00:00 0
62ae4000-632e3000 rw-p  00:00 0
632e3000-632e4000 ---p  00:00 0
632e4000-63ae3000 rw-p  00:00 0
63ae3000-63c14000 r-xp  fd:00 11181 /usr/lib/libstdc++.so.6.0.22
63c14000-63c23000 ---p 00131000 fd:00 11181 /usr/lib/libstdc++.so.6.0.22
63c23000-63c28000 r--p 0013 fd:00 11181 /usr/lib/libstdc++.so.6.0.22
63c28000-63c2a000 rw-p 00135000 fd:00 11181 /usr/lib/libstdc++.so.6.0.22
63c2a000-63c2c000 rw-p  00:00 0
63c2c000-63c75000 r-xp  fd:00 7 /usr/lib/libpgm-5.2.so.0.0.122
63c75000-63c84000 ---p 00049000 fd:00 7 /usr/lib/libpgm-5.2.so.0.0.122
63c84000-63c85000 r--p 00048000 fd:00 7 /usr/lib/libpgm-5.2.so.0.0.122
63c85000-63c86000 rw-p 00049000 fd:00 7 /usr/lib/libpgm-5.2.so.0.0.122
63c86000-63c8a000 rw-p  00:00 0
63c8a000-63d2 r-xp  fd:00 26440 /usr/local/lib/libczmq.so.3.0.0
63d2-63d3 ---p 00096000 fd:00 26440 /usr/local/lib/libczmq.so.3.0.0
63d3-63d32000 rw-p 00096000 fd:00 26440 /usr/local/lib/libczmq.so.3.0.0
63d32000-63d8c000 r-xp  fd:00 11166 /usr/lib/libsodium.so.18.1.1
63d8c000-63d9b000 ---p 0005a000 fd:00 11166 /usr/lib/libsodium.so.18.1.1
63d9b000-63d9c000 r--p 00059000 fd:00 11166 /usr/lib/libsodium.so.18.1.1
63d9c000-63d9d000 rw-p 0005a000 fd:00 11166 /usr/lib/libsodium.so.18.1.1
63d9d000-63ded000 r-xp  fd:00 11283 /usr/lib/libzmq.so.5.0.1
63ded000-63dfd000 ---p 0005 fd:00 11283 /usr/lib/libzmq.so.5.0.1
63dfd000-63dff000 r--p 0005 fd:00 11283 /usr/lib/libzmq.so.5.0.1
63dff000-63e0 rw-p 00052000 fd:00 11283 /usr/lib/libzmq.so.5.0.1
63e0-63ea rw-p  00:00 0
63ea-63f0 ---p  00:00 0
63f0-63f3f000 rw-p  00:00 0
63f3f000-6400 ---p  00:00 0
6400-6410 rw-p  00:00 0
6410-6420 rw-p  00:00 0
6420-642de000 rw-p  00:00 0
642de000-6430 ---p  00:00 0
6433c000-643cc000 r-xp  00:20 14253 
/tmp/sqlite-3.7.151-arm-libsqlitejdbc.so
643cc000-643ce000 rw-p 0009 00:20 14253 
/tmp/sqlite-3.7.151-arm-libsqlitejdbc.so

643ce000-643cf000 rw-p  00:00 0
643cf000-643dd000 r-xp  fd:00 58921 
/opt/jdk1.8.0_111/jre/lib/arm/libnio.so
643dd000-643e4000 ---p e000 fd:00 58921 
/opt/jdk1.8.0_111/jre/lib/arm/libnio.so
643e4000-643e5000 rw-p d000 fd:00 58921 
/opt/jdk1.8.0_111/jre/lib/arm/libnio.so
643e5000-6440 r--s 001d2000 fd:00 58856 
/opt/jdk1.8.0_111/jre/lib/ext/nashorn.jar

6440-6450 rw-p  00:00 0
6450-645fe000 rw-p  00:00 0
645fe000-6460 ---p  00:00 0
6460-6462c000 rw-p  00:00 0
6462c000-6470 ---p  00:00 0
6470a000-6470d000 r-xp  fd:00 10836 /usr/lib/libcap.so.2.25
6470d000-6471c000 ---p 3000 fd:00 10836 /usr/lib/libcap.so.2.25
6471c000-6471d000 rw-p 2000 fd:00 10836 /usr/lib/libcap.so.2.25
6471d000-6472d000 r-xp  fd:00 11074 /usr/lib/libnss_myhostname.so.2
6472d000-6473c000 ---p 0001 fd:00 11074 /usr/lib/libnss_myhostname.so.2
6473c000-6473d000 r--p f000 fd:00 11074 /usr/lib/libnss_myhostname.so.2
6473d000-6473e000 rw-p 0001 fd:00 11074 /usr/lib/libnss_myhostname.so.2
6473e000-64751000 r-xp  fd:00 11140 /usr/lib/libresolv-2.24.so
64751000-6476 ---p 00013000 fd:00 11140 /usr/lib/libresolv-2.24.so
6476-64761000 r--p 00012000 fd:00 11140 /usr/lib/libresolv-2.24.so
64761000-64762000 rw-p 00013000 fd:00 11140 /usr/lib/libresolv-2.24.so
64762000-64764000 rw-p  00:00 0
64764000-64777000 r-xp  fd:00 58928 
/opt/jdk1.8.0_111/jre/lib/arm/libnet.so
64777000-6477f000 ---p 00013000 fd:00 58928 
/opt/jdk1.8.0_111/jre/lib/arm/libnet.so
6477f000-6478 rw-p 00013000 fd:00 58928 
/opt/jdk1.8.0_111/jre/lib/arm/libnet.so

6478-64781000 ---p  00:00 0
64781000-6480 rw-p  00:00 0
6480-648ff000 rw-p  00:00 0
648ff000-6490 ---p  00:00 0
6490a000-6493 r--s 0057 fd:01

Re: [zeromq-dev] ZMQ_FD and inproc:// socket

2016-11-16 Thread Max Kozlovsky
Are you sure there is really a problem? We are using inproc sockets with
custom epoll based event loop and it seems to be working fine.

On the other hand I imagine there would be difficulties with trying to
integrate with some existing event processing library because the behavior
differs from what is expected from real sockets.



On Wed, Nov 16, 2016 at 6:17 PM, Justin Karneges  wrote:

> What Max says is true, BUT there is actually a specific bug with inproc
> sockets not working with ZMQ_FD.
>
> (I'm the one that filed the original issue)
>
> On Wed, Nov 16, 2016, at 05:59 PM, Max Kozlovsky wrote:
>
> Hi,
>
> It is kind of tricky.
>
> The availability of data on the file descriptor returned with ZMQ_FD
> signals that there is a zmq socket state change, i.e. the receive queue
> goes from empty to non-empty. Any operation on the socket
> (send/receive/getsockopt with ZMQ_EVENTS) may clear the notification. No
> further notifications will be received until there is another state change.
> This means the application has to continue sending/receiving data until
> getsockopt with ZMQ_EVENTS says further operations are not possible. The
> application should not access the file descriptor directly beyond using it
> as poll/epoll file descriptor.
>
> I am not familiar with boost::aio, but you'll need to do at least the
> following:
> 1) define your own read handler which is called when the file descriptor
> signals data availability, which will call zmq_msg_recv() on corresponding
> zmq socket.
> 2) either exhaust the incoming data completely each time read handler is
> called, or somehow mark the file descriptor as having the data available so
> your read handler is called again when the control is returned to the
> library.
>
> Max
>
>
>
> On Tue, Nov 15, 2016 at 5:06 AM, Arnaud Kapp  wrote:
>
> Hello,
>
> I'm using zmqpp in my project, and I have a special case where I need to
> integrate
> with boost::asio (this is what azmq does, but for now I just need it once,
> so I don't want
> to switch libraries).
>
> The idea was to rely on ZMQ_FD and add the corresponding FD to ASIO's
> event loop.
> However, I've found that async_read_some() wasn't triggered. It turns out
> it's likely an issue
> in libzmq: https://github.com/zeromq/libzmq/issues/1434
>
> After taking a quick look at AZQM it seems it's also using ZMQ_FD.
> Can anyone tell me what's the trick to get them to work?
> Thanks,
>
>
> --
> Kapp Arnaud - Xaqq
>
>
> ___
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
> *___*
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
>
> ___
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Re: [zeromq-dev] ZMQ_FD and inproc:// socket

2016-11-16 Thread Justin Karneges
What Max says is true, BUT there is actually a specific bug with inproc
sockets not working with ZMQ_FD.

(I'm the one that filed the original issue)

On Wed, Nov 16, 2016, at 05:59 PM, Max Kozlovsky wrote:
> Hi,
>
> It is kind of tricky.
>
> The availability of data on the file descriptor returned with ZMQ_FD
> signals that there is a zmq socket state change, i.e. the receive
> queue goes from empty to non-empty. Any operation on the socket
> (send/receive/getsockopt with ZMQ_EVENTS) may clear the notification.
> No further notifications will be received until there is another state
> change. This means the application has to continue sending/receiving
> data until getsockopt with ZMQ_EVENTS says further operations are not
> possible. The application should not access the file descriptor
> directly beyond using it as poll/epoll file descriptor.
>
> I am not familiar with boost::aio, but you'll need to do at least the
> following:
> 1) define your own read handler which is called when the file
>descriptor signals data availability, which will call
>zmq_msg_recv() on corresponding zmq socket.
> 2) either exhaust the incoming data completely each time read handler
>is called, or somehow mark the file descriptor as having the data
>available so your read handler is called again when the control is
>returned to the library.
>
> Max
>
>
>
> On Tue, Nov 15, 2016 at 5:06 AM, Arnaud Kapp
>  wrote:
>> Hello,
>>
>> I'm using zmqpp in my project, and I have a special case where I need
>> to integrate
>> with boost::asio (this is what azmq does, but for now I just need it
>> once, so I don't want
>> to switch libraries).
>>
>> The idea was to rely on ZMQ_FD and add the corresponding FD to ASIO's
>> event loop.
>> However, I've found that async_read_some() wasn't triggered. It turns
>> out it's likely an issue
>> in libzmq: https://github.com/zeromq/libzmq/issues/1434
>>
>> After taking a quick look at AZQM it seems it's also using ZMQ_FD.
>> Can anyone tell me what's the trick to get them to work?
>> Thanks,
>>
>>
>> --
>> Kapp Arnaud - Xaqq
>>
>>
>> ___
>>  zeromq-dev mailing list
>> zeromq-dev@lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Re: [zeromq-dev] ZMQ_FD and inproc:// socket

2016-11-16 Thread Max Kozlovsky
Hi,

It is kind of tricky.

The availability of data on the file descriptor returned with ZMQ_FD
signals that there is a zmq socket state change, i.e. the receive queue
goes from empty to non-empty. Any operation on the socket
(send/receive/getsockopt with ZMQ_EVENTS) may clear the notification. No
further notifications will be received until there is another state change.
This means the application has to continue sending/receiving data until
getsockopt with ZMQ_EVENTS says further operations are not possible. The
application should not access the file descriptor directly beyond using it
as poll/epoll file descriptor.

I am not familiar with boost::aio, but you'll need to do at least the
following:
1) define your own read handler which is called when the file descriptor
signals data availability, which will call zmq_msg_recv() on corresponding
zmq socket.
2) either exhaust the incoming data completely each time read handler is
called, or somehow mark the file descriptor as having the data available so
your read handler is called again when the control is returned to the
library.

Max



On Tue, Nov 15, 2016 at 5:06 AM, Arnaud Kapp  wrote:

> Hello,
>
> I'm using zmqpp in my project, and I have a special case where I need to
> integrate
> with boost::asio (this is what azmq does, but for now I just need it once,
> so I don't want
> to switch libraries).
>
> The idea was to rely on ZMQ_FD and add the corresponding FD to ASIO's
> event loop.
> However, I've found that async_read_some() wasn't triggered. It turns out
> it's likely an issue
> in libzmq: https://github.com/zeromq/libzmq/issues/1434
>
> After taking a quick look at AZQM it seems it's also using ZMQ_FD.
> Can anyone tell me what's the trick to get them to work?
>
> Thanks,
>
> --
> Kapp Arnaud - Xaqq
>
> ___
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev