GithubHelp home page GithubHelp logo

zeromq / zeromq3-x Goto Github PK

View Code? Open in Web Editor NEW
227.0 48.0 97.0 13.99 MB

ØMQ/3.2 release branch - bug fixes only

License: GNU General Public License v3.0

CMake 1.81% Shell 0.29% C++ 95.52% C 1.88% Batchfile 0.51%

zeromq3-x's Introduction

Welcome
-------

The 0MQ lightweight messaging kernel is a library which extends the
standard socket interfaces with features traditionally provided by
specialised messaging middleware products. 0MQ sockets provide an
abstraction of asynchronous message queues, multiple messaging patterns,
message filtering (subscriptions), seamless access to multiple transport
protocols and more.


Building and installation
-------------------------

See the INSTALL file included with the distribution.


Resources
---------

Extensive documentation is provided with the distribution. Refer to
doc/zmq.html, or "man zmq" after you have installed 0MQ on your system.

Website: http://www.zeromq.org/

Development mailing list: [email protected]
Announcements mailing list: [email protected]

Git repository: http://github.com/zeromq/libzmq

0MQ developers can also be found on the IRC channel #zeromq, on the
Freenode network (irc.freenode.net).

Copying
-------

Free use of this software is granted under the terms of the GNU Lesser General
Public License (LGPL). For details see the files `COPYING` and `COPYING.LESSER`
included with the 0MQ distribution.

zeromq3-x's People

Contributors

calid avatar cremes avatar dhammika avatar feniix avatar fidlej avatar gitfoxi avatar hintjens avatar hitstergtd avatar hurtonm avatar ianbarber avatar ipechorin avatar jdc8 avatar jondyte avatar martinpales avatar mato avatar methodmissing avatar mika-fischer avatar minrk avatar mkoppanen avatar neopallium avatar ninoles avatar pijyoi avatar ptroja avatar shripchenko avatar sterad avatar steve-o avatar sustrik avatar swebster avatar thijsterlouw avatar vaughan0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zeromq3-x's Issues

ZMQ_FAIL_UNROUTABLE is poorly designed and broken.

Fix the design of the ZMQ_FAIL_UNROUTABLE socket option to actually fail in a deterministic manner. Also, rework the feature to fail with a common EAGAIN error code, so that the common send() code in socket_base.cpp could detect it and use the block-with-timeout logic to wait for the unknown peer to appear.

segfault when zmq_poll() with closed socket

Hi.

I have meet a segfault with my program.

this situation like below.

  1. call zmq_poll() with a monitor socket gained by zmq_monitor_socket() and then some callback is triggered.
  2. this callback checks connection and then if it is disconnected, close this socket.
  3. after that, call zmq_poll() with same pollitems.
  4. Bang!

I have rebuilt ZMQ::LibZMQ3 with ZMQ_TRACE, and this is output from that.

[perlzmq (29306)] START mg_free (Message)
[perlzmq (29306)] + zmq message 2e41f50
[perlzmq (29306)] END mg_free (Message)
[perlzmq (29306)] START zmq_poll
[perlzmq (29306)] + processing element 0
[perlzmq (29306)] + mg 0: 48468640
[perlzmq (29306)] + mg->mg_ptr 0: 0
Segmentation fault (core dumped)

Actually... it may be my fault, too.

but I think that we can handle this situation more gracefully :)

eventfd has increased permanently with zmq_socket_monitor()

Hello.

I have met a strange problem after I upgrade ZeroMQ 3.2.5 version from RPM.

when I call zmq_socket_monitor(), eventfd has increased permanently even if the socket connected to monitor is closed.

So I downgrade it to 3.2.4 with RPM, after that It is disappeared :-/

Could you please let me know how can I trace this problem little a bit?

CMake build not working on Linux

As I am using CMake to manage my project, it is good to integrate the CMake building process into my project. However, the CMake file contains several errors which make it impossible to compile. Please fix.

Patch to make it Android friendly

Hi,

I have been working on porting pyzmq to Android (see work progress here: zeromq/pyzmq#227 (comment)). The symptoms without the patch are:

  • pyzmq copies libzmq.so.3 to it's own zmq/libzmq.so
  • running python "import zmq" will load that file a first time, but I suspect zmq/libzmq.so will dynamically link against libzmq.so.3 and try to open the non-existing file anyway.
  • a symlink from libzmq.so.3 to libzmq.so solves that problem but this is not clean IMHO
  • linking libzmq.so with -avoid-version on Android solves that problem, so I post the following patch

Starting from libzmq3.x (https://github.com/zeromq/zeromq3-x), the following patch that will add -avoid-version to LDFLAGS:

diff --git a/configure.in b/configure.in
index 7152015..60416ff 100644
--- a/configure.in
+++ b/configure.in
@@ -75,8 +75,9 @@ libzmq_werror="yes"
 # By default use DSO visibility
 libzmq_dso_visibility="yes"

-# Whether we are on mingw or not.
+# Whether we are on mingw or android or not.
 libzmq_on_mingw32="no"
+libzmq_on_android="no"

 # Set some default features required by 0MQ code.
 CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $CPPFLAGS"
@@ -96,6 +97,7 @@ case "${host_os}" in
         case "${host_os}" in
             *android*)
                 AC_DEFINE(ZMQ_HAVE_ANDROID, 1, [Have Android OS])
+                libzmq_on_android="yes"
             ;;
         esac
         ;;
@@ -373,6 +375,7 @@ AC_LANG_POP([C++])

 AM_CONDITIONAL(BUILD_PGM, test "x$libzmq_pgm_ext" = "xyes")
 AM_CONDITIONAL(ON_MINGW, test "x$libzmq_on_mingw32" = "xyes")
+AM_CONDITIONAL(ON_ANDROID, test "x$libzmq_on_android" = "xyes")

 # Checks for library functions.
 AC_TYPE_SIGNAL
diff --git a/src/Makefile.am b/src/Makefile.am
index c69a556..23c8cbe 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -138,8 +138,12 @@ libzmq_la_SOURCES = \
 if ON_MINGW
 libzmq_la_LDFLAGS = -no-undefined -avoid-version -version-info @LTVER@ @LIBZMQ_EXTRA_LDFLAGS@
 else
+if ON_ANDROID
+libzmq_la_LDFLAGS = -avoid-version -version-info @LTVER@ @LIBZMQ_EXTRA_LDFLAGS@
+else
 libzmq_la_LDFLAGS = -version-info @LTVER@ @LIBZMQ_EXTRA_LDFLAGS@
 endif
+endif

 libzmq_la_CXXFLAGS = @LIBZMQ_EXTRA_CXXFLAGS@

Then I also need to make use of that patch not yet released in 3.x: zeromq/libzmq@eb6c668

I have never made git pull request and do not have any folder on git... I will try to keep it that way for now, that's why I post my patch here.

EDITS:

  • added defaulting "libzmq_on_android" to "no"
  • fixing page formatting
  • I hope those many edits do not generate many emails to a mailing list, if so please warn me.

LIBZMQ-456 fix missing from 3.2.2

According to the NEWS file, these were intended to go into 3.2.2, but src/xsub.cpp does not reflect the changes.

500f6cffe36504a70980a1ac4904fe4e9c3b727c patch for issue 456
0bf8a4d2d2474a738f883db718a4d65beb7138e9 Code formatting

Autoconf fails on configure.in

When running autogen.sh on OSX with autoconf 2.69 & automake 1.13.1, autoconf complains

configure.in:13: error: 'AM_CONFIG_HEADER': this macro is obsolete.
You should use the 'AC_CONFIG_HEADERS' macro instead.

This indeed solves my problem, but it would probably break automake on other setups. Any thoughts how to fix this in a compatible way?

Android Things 1.06 Compiling zeromq

Hi,

I'm trying to compile zeromq3 on Android things 1.06 under termux and receive the below.
The error references the function tempman, is there a suitable substitution to make? I'm thinking try the recommendation and do a PR.

addr_ = tempnam(NULL, NULL);

git clone https://github.com/zeromq/zeromq3-x.git
cd zeromq3-x/
./autogen.sh
./configure --enable-static --disable-shared --host=arm-linux-androideabi --prefix=$OUTPUT_DIR LDFLAGS="-L$OUTPUT_DIR/lib" CPPFLAGS="-fPIC -I$OUTPUT_DIR/include" LIBS="-lgcc"
make
make install
Making all in src
make[1]: Entering directory '/data/data/com.termux/files/home/zeromq3-x/src'
make  all-am
make[2]: Entering directory '/data/data/com.termux/files/home/zeromq3-x/src'
  CXX      libzmq_la-address.lo
  CXX      libzmq_la-clock.lo
  CXX      libzmq_la-ctx.lo
  CXX      libzmq_la-decoder.lo
  CXX      libzmq_la-devpoll.lo
  CXX      libzmq_la-dist.lo
  CXX      libzmq_la-encoder.lo
  CXX      libzmq_la-epoll.lo
  CXX      libzmq_la-err.lo
  CXX      libzmq_la-fq.lo
  CXX      libzmq_la-io_object.lo
  CXX      libzmq_la-io_thread.lo
  CXX      libzmq_la-ip.lo
  CXX      libzmq_la-ipc_address.lo
  CXX      libzmq_la-ipc_connecter.lo
  CXX      libzmq_la-ipc_listener.lo
ipc_listener.cpp:124:17: error: 'tempnam' is deprecated: tempnam is unsafe, use
      mkstemp or tmpfile instead [-Werror,-Wdeprecated-declarations]
        addr_ = tempnam(NULL, NULL);
                ^
/data/data/com.termux/files/usr/include/stdio.h:173:5: note: 'tempnam' has been
      explicitly marked deprecated here
    __warnattr("tempnam is unsafe, use mkstemp or tmpfile instead");
    ^
/data/data/com.termux/files/usr/include/sys/cdefs.h:160:40: note: expanded from
      macro '__warnattr'
#define __warnattr(msg) __attribute__((deprecated(msg)))
                                       ^
1 error generated.
make[2]: *** [Makefile:878: libzmq_la-ipc_listener.lo] Error 1
make[2]: Leaving directory '/data/data/com.termux/files/home/zeromq3-x/src'
make[1]: *** [Makefile:590: all] Error 2
make[1]: Leaving directory '/data/data/com.termux/files/home/zeromq3-x/src'
make: *** [Makefile:418: all-recursive] Error 1
$ make install
Making install in src
make[1]: Entering directory '/data/data/com.termux/files/home/zeromq3-x/src'
  CXX      libzmq_la-ipc_listener.lo
ipc_listener.cpp:124:17: error: 'tempnam' is deprecated: tempnam is unsafe, use
      mkstemp or tmpfile instead [-Werror,-Wdeprecated-declarations]
        addr_ = tempnam(NULL, NULL);
                ^
/data/data/com.termux/files/usr/include/stdio.h:173:5: note: 'tempnam' has been
      explicitly marked deprecated here
    __warnattr("tempnam is unsafe, use mkstemp or tmpfile instead");
    ^
/data/data/com.termux/files/usr/include/sys/cdefs.h:160:40: note: expanded from
      macro '__warnattr'
#define __warnattr(msg) __attribute__((deprecated(msg)))
                                       ^
1 error generated.
make[1]: *** [Makefile:878: libzmq_la-ipc_listener.lo] Error 1
make[1]: Leaving directory '/data/data/com.termux/files/home/zeromq3-x/src'
make: *** [Makefile:418: install-recursive] Error 1

socket_base.hpp:105:35: error: 'va_list' has not been declared

This patches tries to fix following compiler error with gcc 4.7.1/uClibc 0.9.33.2
on ARM (OpenWRT):

    In file included from device.cpp:51:0:
    socket_base.hpp:105:35: error: 'va_list' has not been declared
    make[5]: *** [libzmq_la-device.lo] Error 1
diff --git a/src/socket_base.hpp b/src/socket_base.hpp
index 35d2962..f0ee671 100644
--- a/src/socket_base.hpp
+++ b/src/socket_base.hpp
@@ -25,6 +25,7 @@

 #include <string>
 #include <map>
+#include <cstdarg>

 #include "own.hpp"
 #include "array.hpp"
-- 
1.7.9.5

Access Violation in mailbox_t::recv

Hi all,

We are using 0mq and it crashes with the following details:

Unhandled exception at 0x00007FFCCA9395FC (KERNELBASE.dll) in [OURPROCESS].dmp: 0x40000015:  %hs (parameters: 0x00000000522694C0).

libzmq.dll!zmq::mailbox_t::recv(zmq::command_t * cmd_, int timeout_) Line 86	C++
libzmq.dll!zmq::socket_base_t::process_commands(int timeout_, bool throttle_) Line 855	C++
libzmq.dll!zmq::socket_base_t::getsockopt(int option_, void * optval_, unsigned __int64 * optvallen_) Line 291	C++
libzmq.dll!zmq_poll(zmq_pollitem_t * items_, int nitems_, long timeout_) Line 892	C++
[OURPROCESS]::QPoller::Poll(__int64 timeout) Line 63	C++

Does anyone have any idea on what is going on ? The only thing that I can suspect is that for some reason the machine is running out of sockets. But after investigating the machine this seems unlikely.

The Windows version is Windows Server 2012 R2.

Documentation: getsockopt

The formatting for ZMQ_DELAY_ATTACH_ON_CONNECT and ZMQ_FD seems broken. Also, using a recursive grep, I cannot find the constant ZMQ_DELAY_ATTACH_ON_CONNECT anywhere in the source tree.

cmake

does CMakeLists.txt work for *nix platform?

Problem: ZeroMQ 3.2 downloads coming from VM that is about to be shut down

The downloads for ZeroMQ 3.2 are coming from download.zeromq.org which is a CNAME to an iMatix VM. That VM is about to be shut down (somewhere between late May and mid-June). When that VM is shut down the downloads for ZeroMQ 3.2 will not work if they are not changed.

Suggested solution:

  1. Tag at least the most recent (3.2.5) release in the GitHub repository to create a GitHub release at the commit representing 3.2.5.
  2. Arrange for the auto-builder to run on zeromq3-x and upload ready-to-build archives (and/or manually upload the existing archives)
  3. Update the download page to link to the GitHub release hosted archives.

Ewen

Create a Visual Studio 2012 solution

Right now this repository lacks a Visual Studio 2012 solution. I had to upgrade the 2010 solution to build zeromq. It would be great if someone commited one.

Thanks

How to link the zmq static library?

Hi,Sorry for my poor English!
This is a test main.c:
#include <zmq.h>
int main (void)
{
int major, minor, patch;
zmq_version (&major, &minor, &patch);
printf ("Current 0MQ version is %d.%d.%d\n", major, minor, patch);
return 0;
}
When I linked the libzmq.a(gcc main.c /usr/local/lib/libzmq.a),i get some errors(here is a part of errors) like:
/home/test1/armbuild/zeromq-3.2.4/src/ipc_connecter.cpp:116: undefined reference to `std::nothrow'
but i use :gcc main.c /usr/local/lib/libzmq.so
it works great,so how do i link the zmq static libraries?

"sa_family_t sa_family;" in pgm_socket.cpp is unused variable

In source file pgm_socket.cpp at line 89 is a variable declaration "sa_family_t sa_family;". This variable is not used. This causes a compilation warning when --enable-pgm has been specified. Since -Werror is the default, this causes an error.

Assertion failed: (msg_->flags () & msg_t::identity) == 0 (e:\tools\zmq\3.2\src\router.cpp:222)

Windows XP
ZMQ 3.2 rc-1
after restart device i get this assert in worker (REP)
this is simple test

#include "zmq.h"
#include <process.h>
#include <windows.h>
#include <assert.h>

unsigned __stdcall echo_srv( void* ){
  void *ctx = zmq_ctx_new();
  void *skt = zmq_socket(ctx,ZMQ_REP);
  assert(-1 != zmq_connect(skt, "tcp://127.0.0.1:5556"));
  while(true){
    zmq_msg_t msg;
    assert(-1 != zmq_msg_init(&msg));
    assert(-1 != zmq_msg_recv(&msg, skt,0));
    assert(-1 != zmq_msg_send(&msg, skt,0));
    zmq_msg_close(&msg);
  }
  zmq_close(skt);
  zmq_ctx_destroy(ctx);  

  _endthreadex( 0 );
  return 0;
}

void *context;
void *frontend;
void *backend;

unsigned __stdcall device( void* ){
  context = zmq_ctx_new();
  frontend = zmq_socket (context, ZMQ_ROUTER);
  backend  = zmq_socket (context, ZMQ_DEALER);
  assert (backend);
  assert (frontend);

  //  Bind both sockets to TCP ports
  assert (zmq_bind (frontend, "tcp://*:5555") == 0);
  assert (zmq_bind (backend,  "tcp://*:5556") == 0);
  //  Start a queue device 
  zmq_device (ZMQ_QUEUE, frontend, backend);

  zmq_close(backend);
  zmq_close(frontend);
  zmq_ctx_destroy(context);  

  _endthreadex( 0 );
  return 0;
}


void echo_cli(){
  void *ctx = zmq_ctx_new();
  void *skt = zmq_socket(ctx, ZMQ_REQ);
  assert(-1 != zmq_connect(skt, "tcp://127.0.0.1:5555"));
  zmq_msg_t msg;
  assert(-1 != zmq_msg_init_size(&msg, 5));
  memcpy(zmq_msg_data(&msg), "HELLO", 5);
  assert(-1 != zmq_msg_send(&msg, skt, 0));
  zmq_msg_close(&msg);

  assert(-1 != zmq_msg_init(&msg));
  assert(-1 != zmq_msg_recv(&msg, skt,0));
  assert( 5 == zmq_msg_size(&msg));
  assert( 0 == memcmp(zmq_msg_data(&msg), "HELLO", 5));
  zmq_msg_close(&msg);

  zmq_close(skt);
  zmq_ctx_destroy(ctx);  
}

int main(){ 
  HANDLE DeviceThread; unsigned DeviceThreadID;
  DeviceThread = (HANDLE)_beginthreadex( NULL, 0, &device, NULL, 0, &DeviceThreadID );
  Sleep(500);

  HANDLE EchoSrvThread; unsigned EchoSrvThreadID;
  EchoSrvThread = (HANDLE)_beginthreadex( NULL, 0, &echo_srv, NULL, 0, &EchoSrvThreadID );
  CloseHandle(EchoSrvThread);
  Sleep(500);

  echo_cli();

  // restart device
  TerminateThread(DeviceThread, -1);
  WaitForSingleObject( DeviceThread, INFINITE );
  CloseHandle(DeviceThread);
  zmq_close(frontend);
  zmq_close(backend);
  zmq_ctx_destroy(context);
  Sleep(1500);

  DeviceThread = (HANDLE)_beginthreadex( NULL, 0, &device, NULL, 0, &DeviceThreadID );
  Sleep(500); // assert it echo_srv while start device

  echo_cli();
}

test_connect_delay.cpp:260:2: error: no newline at end of file

centos5.9 X86_64

when execute command "make",out error info

make[1]: Entering directory /root/zeromq-3.2.3/tests' CXX test_connect_delay.o test_connect_delay.cpp:260:2: error: no newline at end of file make[1]: *** [test_connect_delay.o] Error 1 make[1]: Leaving directory/root/zeromq-3.2.3/tests'
make: *** [all-recursive] Error 1

Adding Julia support: #define vs enum for constants

Thanks for ZeroMQ!

I'm adding support for a new language, Julia: http://julialang.org/. Julia is a dynamic language that gets JIT-compiled by LLVM, achieving performance typical of C with all the nice features of a dynamic language. When linking to an external library like ZeroMQ, there's a zero-overhead "ccall" functionality, so that no C-wrapper needs to be written to access the library---calls to the library get compiled/linked inline via LLVM.

One of the things that would seem to make Julia's (and perhaps other languages?) ZeroMQ support cleaner would be to have the values of the various constants (e.g., all of the zmq_setsockopt options like ZMQ_SNDHWM) be exported to the library itself. We make no use of the zmq.h header, so we can't get the constants from there; currently the constants are (re)defined in Julia code (which may be true for quite a few other languages, too). Unfortunately, this introduces the risk that a constant might change its definition in some future version of ZeroMQ, and we'll then have problems.

This risk is avoided entirely if one can simply extract the values of constants from the library. I think this is possible if you use enum (or const int) rather than #define when specifying these constants. Would there be any downsides to making this switch? It might also help to have a constant for sizeof(zmq_msg_t), since currently Julia just allocates a blank buffer of the correct size and then has zmq_init* fill in the data.

If it would help to see our current code, it's here:
https://github.com/timholy/julia/tree/zmq/extras/zmq
The wrapper for ZeroMQ is just the one file, zmq.jl.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.