Giter Club home page Giter Club logo

jzmq's Introduction

What is JZMQ?

This is the Java language binding for libzmq (aka ZeroMQ, 0MQ).

Build Status

The latest javadocs.

Building and Installing JZMQ

To build you need to have the libzmq library already installed, then you run:

cd jzmq-jni/
./autogen.sh
./configure
make
make install
cd ..
mvn package

If you hope to install to your local maven, then you should run:

mvn install -Dgpg.skip=true

Building Windows 64bit with CMake & NMake

It is recommended to follow these steps with the Visual C++ 2015 Build Tools.

  1. create a new and empty directory:
d:\temp\>mkdir JZMQ
d:\temp\>cd JZMQ
d:\temp\JZMQ\>
  1. Clone the repository to your new directory
d:\temp\JZMQ\>git clone https://github.com/zeromq/jzmq.git
  1. dive into the checkedout repository and create a new build64 folder
d:\temp\JZMQ\>cd jzmq\jzmq-jni
d:\temp\JZMQ\jzmq\jzmq-jni\>mkdir build64
d:\temp\JZMQ\jzmq\jzmq-jni\>cd build64
  1. Now call CMake to generate the project
D:\temp\JZMQ\jzmq\jzmq-jni\build64>cmake .. -G "NMake Makefiles" -DZMQ_C_INCLUDE_PATH=<path to zmq include> -DZMQ_C_LIB_PATH=<path to zmq library>
-- The C compiler identification is MSVC 19.0.24210.0
-- The CXX compiler identification is MSVC 19.0.24210.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Java: C:/Program Files/Java/jdk1.8.0_91/bin/java.exe (found version "1.8.0.91")
-- Found JNI: C:/Program Files/Java/jdk1.8.0_91/lib/jawt.lib
-- Configuring done
-- Generating done
-- Build files have been written to: D:/temp/JZMQ/jzmq/jzmq-jni/build64
  1. Now finally call NMake to build the zmq.jar and jzmq.lib, jzmq.dll
D:\temp\JZMQ\jzmq\jzmq-jni\build64>nmake
Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation.  All rights reserved.

[ 10%] Generating config.hpp
[ 20%] Generating org/zeromq/ZMQ.class, org/zeromq/Utils.class, org/zeromq/ZMQ$$Context.class, org/zeromq/ZMQ$$Socket.class, org/zeromq/ZMQ$$PollItem.class, org/zeromq/ZMQ$$Poller.class, org/zeromq/ZM
Q$$Error.class, org/zeromq/ZMQException.class, org/zeromq/ZMQQueue.class, org/zeromq/ZMQForwarder.class, org/zeromq/ZMQStreamer.class, org/zeromq/EmbeddedLibraryTools.class, org/zeromq/App.class, org/
zeromq/ZContext.class, org/zeromq/ZDispatcher.class, org/zeromq/ZDispatcher$$1.class, org/zeromq/ZDispatcher$$SocketDispatcher$$1.class, org/zeromq/ZDispatcher$$SocketDispatcher$$2.class, org/zeromq/Z
Dispatcher$$SocketDispatcher$$ZMessageBuffer.class, org/zeromq/ZDispatcher$$SocketDispatcher.class, org/zeromq/ZDispatcher$$ZMessageHandler.class, org/zeromq/ZDispatcher$$ZSender.class, org/zeromq/ZFr
ame.class, org/zeromq/ZMsg.class, org/zeromq/ZLoop.class, org/zeromq/ZLoop$$IZLoopHandler.class, org/zeromq/ZLoop$$SPoller.class, org/zeromq/ZLoop$$STimer.class, org/zeromq/ZThread.class, org/zeromq/Z
Thread$$IAttachedRunnable.class, org/zeromq/ZThread$$IDetachedRunnable.class, org/zeromq/ZThread$$ShimThread.class
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
[ 30%] Generating org_zeromq_ZMQ.h, org_zeromq_ZMQ_Error.h, org_zeromq_ZMQ_Context.h, org_zeromq_ZMQ_Socket.h, org_zeromq_ZMQ_PollItem.h, org_zeromq_ZMQ_Poller.h
[ 40%] Generating lib/zmq.jar
Scanning dependencies of target jzmq
[ 40%] Generating org/zeromq/ZMQ.class, org/zeromq/Utils.class, org/zeromq/ZMQ$$Context.class, org/zeromq/ZMQ$$Socket.class, org/zeromq/ZMQ$$PollItem.class, org/zeromq/ZMQ$$Poller.class, org/zeromq/ZM
Q$$Error.class, org/zeromq/ZMQException.class, org/zeromq/ZMQQueue.class, org/zeromq/ZMQForwarder.class, org/zeromq/ZMQStreamer.class, org/zeromq/EmbeddedLibraryTools.class, org/zeromq/App.class, org/
zeromq/ZContext.class, org/zeromq/ZDispatcher.class, org/zeromq/ZDispatcher$$1.class, org/zeromq/ZDispatcher$$SocketDispatcher$$1.class, org/zeromq/ZDispatcher$$SocketDispatcher$$2.class, org/zeromq/Z
Dispatcher$$SocketDispatcher$$ZMessageBuffer.class, org/zeromq/ZDispatcher$$SocketDispatcher.class, org/zeromq/ZDispatcher$$ZMessageHandler.class, org/zeromq/ZDispatcher$$ZSender.class, org/zeromq/ZFr
ame.class, org/zeromq/ZMsg.class, org/zeromq/ZLoop.class, org/zeromq/ZLoop$$IZLoopHandler.class, org/zeromq/ZLoop$$SPoller.class, org/zeromq/ZLoop$$STimer.class, org/zeromq/ZThread.class, org/zeromq/Z
Thread$$IAttachedRunnable.class, org/zeromq/ZThread$$IDetachedRunnable.class, org/zeromq/ZThread$$ShimThread.class
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
[ 40%] Generating org_zeromq_ZMQ.h, org_zeromq_ZMQ_Error.h, org_zeromq_ZMQ_Context.h, org_zeromq_ZMQ_Socket.h, org_zeromq_ZMQ_PollItem.h, org_zeromq_ZMQ_Poller.h
[ 50%] Building CXX object CMakeFiles/jzmq.dir/src/main/c++/Context.cpp.obj
Context.cpp
[ 60%] Building CXX object CMakeFiles/jzmq.dir/src/main/c++/Poller.cpp.obj
Poller.cpp
D:\temp\JZMQ\jzmq\jzmq-jni\src\main\c++\Poller.cpp(76): warning C4244: '=': conversion from 'jint' to 'short', possible loss of data
[ 70%] Building CXX object CMakeFiles/jzmq.dir/src/main/c++/Socket.cpp.obj
Socket.cpp
D:\temp\JZMQ\jzmq\jzmq-jni\src\main\c++\Socket.cpp(266): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
D:\temp\JZMQ\jzmq\jzmq-jni\src\main\c++\Socket.cpp(272): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
D:\temp\JZMQ\jzmq\jzmq-jni\src\main\c++\Socket.cpp(847): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
D:\temp\JZMQ\jzmq\jzmq-jni\src\main\c++\Socket.cpp(875): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
[ 80%] Building CXX object CMakeFiles/jzmq.dir/src/main/c++/util.cpp.obj
util.cpp
[ 90%] Building CXX object CMakeFiles/jzmq.dir/src/main/c++/ZMQ.cpp.obj
ZMQ.cpp
[100%] Linking CXX shared library lib\jzmq.dll
   Creating library lib\jzmq.lib and object lib\jzmq.exp
   Creating library lib\jzmq.lib and object lib\jzmq.exp
[100%] Built target jzmq

Avoiding JNI

JZMQ uses JNI to wrap libzmq for the best performance. If performance isn't your primary goal, look at the JeroMQ project, which is a pure Java implementation that provides an identical API to JZMQ, and uses the same protocol.

Building Packages

To build a Debian package, run:

$ dpkg-buildpackage -rfakeroot

To build an RPM package, run:

$ rpmbuild -tb jzmq-X.Y.Z.tar.gz

Where X.Y.Z is replaced with the version that you've downloaded.

If configure can't find your libzmq installation, you can tell it where to look, using e.g. --with-zeromq=/usr/local.

You may want to take a look at http://www.zeromq.org/docs:tuning-zeromq for additional hints.

For more information, refer to the ØMQ website at http://www.zeromq.org/.

On Mac OS X you may need to compile and make install pkg-config if configure fails with "syntax error near unexpected token newline".
See http://stackoverflow.com/questions/3522248/how-do-i-compile-jzmq-for-zeromq-on-osx for details.

You may also need to symlink the header files of your standard Java installation (e.g. /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Headers/*.h) into a suitable directory (e.g. /usr/local/include) and point the JAVA_HOME environment variable to the parent directory (e.g./usr/local).

Acknowledgements

YourKit is kindly supporting ZeroMQ project with its full-featured Java Profiler.

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 Java binding for ØMQ.

jzmq's People

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  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

jzmq's Issues

C++ library version

Hi,
i would by nice to have correct version of c++ library in configure.in, 2.0.9 instead of 0.0.0.

And also tag in git repository can be made.

Can't build Java binding

Hi, having trouble with Java binding make:

g++ -DHAVE_CONFIG_H -I. -I. -I. -D_REENTRANT -D_THREAD_SAFE -I/opt/chiliad/discovery/java/include -I/opt/chiliad/discovery/java/include/linux -Wall -g -O2 -MT libjzmq_la-Socket.lo -MD -MP -MF .deps/libjzmq_la-Socket.Tpo -c Socket.cpp -fPIC -DPIC -o .libs/libjzmq_la-Socket.o
Socket.cpp: In function 'jlong Java_org_zeromq_ZMQ_00024Socket_getLongSockopt(JNIEnv_, jobject, jint)':
Socket.cpp:103: error: 'ZMQ_TYPE' was not declared in this scope
Socket.cpp:113: error: 'ZMQ_FD' was not declared in this scope
Socket.cpp:114: error: 'ZMQ_EVENTS' was not declared in this scope

Thanks for any advice.

Ability to use JZMQ in conjunction with NIO

Right now I'm writing a server using NIO, and I'm planning to send and receive messages out the other end with JZMQ. Now of course I use NIO's Selector api to check for sockets that are available to read and write to.
But JZMQ doesn't seams to have a compatible API.

So I was wondering if as a new feature it would be possible to get a SelectableChannel from a ZMQ.Socket which could be registered with a Selector and would be selectable alongside other NIO channels and would return when there are new messages available over the ZMQ.Socket.
Otherwise I'm basically going to have to write a separate thread dedicated to ZMQ messages and interrupt the other thread to exit .select() when there are incoming messages over ZMQ.

NoClassDefFoundError: Could not initialize class org.zeromq.ZMQ

Hallow,

I have very new in ZeroMQ. I colleague wrote a web application which i am suppose to go through and continue developing it.
We are running springMVC, after running mvn jetty:run, the system runs, but when ever the application enter a block which is suppose to run ZMQ, it throws a NoClassDefFoundError. I have been having this problem for the last 4 days, and its getting on my nerves.. Can any one please help..

NB: i have tried to run on three diff OS (Ubuntu 11.04, Ubuntu 10.10 and Windows Vista) and got the same error.

Thank you..

Create a release

Can we create a release for jzmq? In production applications, it's important that you be able to freeze the versions of your dependencies. Otherwise, changes in your dependencies can cause unexpected regressions.

GitHub has a feature where if you tag a git repository, it will automatically create a download for that tag. This would be totally sufficient for me and only takes a second.

Mac OS X: java.lang.UnsatisfiedLinkError: no jzmq in java.library.path

I've tried repeatedly installing jzmq on Mac OS X. Whatever I do, I hit a brick wall with this exception:
java.lang.UnsatisfiedLinkError: no jzmq in java.library.path

I have successfully installed (pkg-config and) libzmq and libjzmq into /usr/local/lib from today's github master branches. For jzmq, I did:
./autogen.sh && ./configure --with-zeromq=/usr/local/lib && make && sudo make install
But setting java.library.path in any way, even manually at the start of my Java code, or even setting LD_LIBRARY_PATH, has no effect at all - I keep getting that UnsatisfiedLinkError.

I would very much like to use jzmq for my projects, as I already have done a client and server implementation in Python and want to connect it to the Java world. (For the curious: http://gentlefn.github.com/gentle-tp-da92/)

Versions:

  • libzmq and jzmq: current github master
  • Mac OS X: 10.6.6, up-to-date
  • Java (most recent JDK provided by Apple): 1.6.0_22-b04-307-10M3261

Tagging the stable versions?

Hi,

is there a stable version of this? Can you tag them respectively to zeroMQ versions? I mean if last stable version is 2.0.10 where can I find the java classes for that?

I see you are using 2.1.0-SNAPSHOT in the sources already?

thanx in advance

Occasional message loss executing a recv right after executing a send on a REQ socket

The scenario has two processes, one being a C server listening on a 0MQ REP socket "tcp://127.0.0.1:5555" and the other a Java client that issues requests to this server through a 0MQ REQ socket.

Right after receiving a request, the server replies with an ACK message. The server recv call is non-blocking. This way, the server and client flow would be:

C Server:
if(recv(socket, &request, ZMQ_NOBLOCK) == 0) {
// proccess reply
zmg_msg_close(&request);
send(socket, &reply, 0);
zmg_msg_close(&reply);
}

Java Client:
requestSocket.send(request_data, 0);
serverReply = requestSocket.recv(0);

The problem is that, even though the server send() call always returns 0, sometimes the client never receives the reply, staying blocked at the recv() call. Curiously, when I added a Thread.sleep(500); between the client's send and recv calls, I couldn't reproduce the problem after a couple dozen attempts.

One thing that also bugs me is that all blocking send() and recv() calls on the C server's REP socket set errno to EAGAIN, even when the call returns 0 and the message is correctly received. The zmq Manual (http://api.zeromq.org/) says that EAGAIN means "Non-blocking mode was requested and no messages are available at the moment", but I'm not even using non-blocking mode, so what gives?

please,why this happend?

My os is ubuntu linux

uname -a
Linux zhxia-Desktop 2.6.38-10-generic #46-Ubuntu SMP Tue Jun 28 15:07:17 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

Making all in src
make[1]: Entering directory `/home/zhxia/apps/zeromq-jzmq-79e62be/src'
CLASSPATH=.:./.:$CLASSPATH /usr/bin/javac -d . org/zeromq/ZMQ.java org/zeromq/ZMQException.java org/zeromq/ZMQQueue.java org/zeromq/ZMQForwarder.java org/zeromq/ZMQStreamer.java
org/zeromq/ZMQ.java:322: warning: The method getContextHandle() from the type ZMQ.Context is never used locally
private long getContextHandle () {
^^^^^^^^^^^^^^^^^^^
org/zeromq/ZMQ.java:957: warning: The method getSocketHandle() from the type ZMQ.Socket is never used locally
private long getSocketHandle () {
^^^^^^^^^^^^^^^^^^
org/zeromq/ZMQ.java:963: warning: The field ZMQ.Socket.context is never read locally
private Context context = null;
^^^^^^^
org/zeromq/ZMQ.java:1276: warning: The field ZMQ.Poller.context is never read locally
private Context context = null;
^^^^^^^
org/zeromq/ZMQQueue.java:40: error: The method run() of type ZMQQueue must override a superclass method
public void run() {
^^^^^
org/zeromq/ZMQForwarder.java:39: error: The method run() of type ZMQForwarder must override a superclass method
public void run() {
^^^^^
6 problems (2 errors, 4 warnings)

Provide java.nio.ByteBuffer-friendly send/recv API

I had a thought while reviewing the source that the java.nio.ByteBuffer enhancements to Java 1.4 might be a better fit for the send/recv calls (or perhaps some variation on them).

Given that ByteBuffer lets you directly use native heap you can avoid the need to memcpy messages to/from the managed heap.

I know from the documentation that 0MQ is very focused on performance, so this enhancement could possibly boost the performance of the Java bindings (faster send/recv, use less managed heap, fewer GCs) and get them a bit closer to native performance.

Configure fails on FreeBSD due to missing -lpthread

When I try to build the package on FreeBSD 7.2-RELEASE, the configure script fails when checking for zmq_init. According to the log, libzmq has an unresolved reference to pthread_create. Setting CPPFLAGS=-lpthread fixes the problem.

ZMQ_TYPE, ZMQ_FD, ZMQ_EVENTS and zmq 2.0.9

Hello,
It seems that jzmq is no longer compatible with the stable release of 0MQ after adding ZMQ_TYPE, ZMQ_FD and ZMQ_EVENTS (the actual constants are missing from the zmq header files). Does a "stable" (2.0.x) branch of jzmq exist somewhere?

Rare java crash - invalid access in Poller_run_1poll

On Linux x86, jdk1.6u20/22 using latest zmq and jzmq, the bug happens occassionally (sometimes 4 times in a row, sometimes once a day). Happened with older (j)zmq too.

Compiled jzmq without optimalizations, made disassembly and identified the line and place of code of the invalid access. See details attached to https://gist.github.com/769657 (interesting places in files marked).

It seems that in Poller.cpp line 101, pitem[pc] points to the bad address (beginning of a guard page). The .revents matches the offset of [eax + 10] seen in the disasm.

By the way, the the cycle at Poller.cpp:100 seems suspicious, since above in the file it is notet that the sockets array can be sparse, and at :72 this sparseness is checked, so while the cycle at :70 runs from 0...ls_0mq, pc may be incremented less times.

However, at the :100 cycle pc seems to be incremented as many times as ls_0mq, and with ls_0mq > ls that may read unallocated memory.

Also, what happens if the check at :90 fails? Should it be an assertion?

Thanks,
Robin

Call to sleep() necessary to prevent race condition

I posted on the zeromq-dev mailing list an issue I found wherein calls to sleep() are necessary to prevent a race condition in recv(0):

http://lists.zeromq.org/pipermail/zeromq-dev/2011-February/009410.html

Unfortunately the issue has not been resolved, but Chuck's comments suggest it might be specific to jzmq.

To reproduce, comment out the calls to sleep() in ZMQQueueTest (https://github.com/zeromq/jzmq/blob/master/test/src/org/zeromq/ZMQQueueTest.java)

AFAICS, this should work fine, but even when a request arrives for a worker socket, the application is frozen.

socket.setLinger() sends wrong sized args to API

Maybe I'm missing something, but using 2.1.0 and the current version of the jzmq library, the native interface appears to be passing a 64-bit unsigned to the setsockopt() call. The API library then rejects this, since it wants a 32-bit signed parameter. Has this ever worked for anyone--I can't see how it ever could.

In any case, here's the change to Socket.cpp that fixed it for me. Could be a bit prettier, but it works.

/**

  • Called by Java's Socket::setLongSockopt(int option, long value).
    */
    JNIEXPORT void JNICALL Java_org_zeromq_ZMQ_00024Socket_setLongSockopt (JNIEnv *env,
    jobject obj,
    jint option,
    jlong value)
    {
    switch (option) {
    #if ZMQ_VERSION >= ZMQ_MAKE_VERSION(2,1,0)
    case ZMQ_LINGER:
    #endif
    case ZMQ_HWM:
    case ZMQ_SWAP:
    case ZMQ_AFFINITY:
    case ZMQ_RATE:
    case ZMQ_RECOVERY_IVL:
    case ZMQ_MCAST_LOOP:
    case ZMQ_SNDBUF:
    case ZMQ_RCVBUF:
    {
    void *s = get_socket (env, obj, 1);
    int rc = 0;
    int err = 0;

if ZMQ_VERSION >= ZMQ_MAKE_VERSION(2,1,0)

        if(option==ZMQ_LINGER) {
            uint64_t optval = (uint64_t) value;
            int ival=optval;
            size_t optvallen = sizeof(ival);
            rc = zmq_setsockopt (s, option, &ival, optvallen);
        } else {

endif

            uint64_t optval = (uint64_t) value;
            size_t optvallen = sizeof(optval);
            rc = zmq_setsockopt (s, option, &optval, optvallen);

if ZMQ_VERSION >= ZMQ_MAKE_VERSION(2,1,0)

        }

endif

        err = errno;

        if (rc != 0) {
            raise_exception (env, err);
        }
        return;
    }
default:
    raise_exception (env, EINVAL);
    return;
}

}

Native library loading

Hi,
can you check if the lib is loaded and load only if it's not?

I mean the code:
static {
System.loadLibrary ("jzmq");
}

I want to package the libs and the wrapper to single jar, than when I run it anywhere I just copy native libs from the jar to tmp and load it with System.load(absolute path). I don't want to play with library path in starting script...

upgrading java jzmq app from 2.0.7 to 2.0.10 issues

I recently attempted to upgrade my java app previously running on zmq/jzmq 2.0.7 to 2.0.10.
I rebuilt both zmq and jzmq using VS2010. When I refreshed my java app, I noticed the zmq java API no longer included the socket method

socket.setsockopt()

that was in the previous 2.0.7 examples given. However after removing this line the rest of my code compiled.

When running it however, it appears that running sockets using either Subscriber or Pair patterns no longer are receiving messages. Either I am not receiving any messages, or an exception (getMessage() = "0 - 0x0 - No error" is thrown.)

In an effort to diagnose, I recoded a basic publisher/subscriber. (below). In the example below, the subscriber does not display any messages; however the publisher appears to send messages without any issues.

This is speculation, but I suspect that these 2 items are related - i.e. since the socket.setsockopt() method has been removed from the java API, the subscriber no longer knows what sort of messages to process.

Can you help to diagnose?

thank you

import org.zeromq.ZMQ;
import org.zeromq.ZMQ.Context;
import org.zeromq.ZMQ.Socket;

public class test_subscriber {

public static final int ZMQ_BLOCK = 0;
public static final int ZMQ_NOBLOCK = 1;

public static void main(String[] args) {
    try
    {
        int io_threads = 6;
        String port = "tcp://127.0.0.1:1250";

        System.out.println("Create Context");
        Context ctx = ZMQ.context(io_threads);

        System.out.println("Create Socket");
        Socket socket = ctx.socket(ZMQ.SUB);

        System.out.println("Subscribe to All Topics");
        //socket.setsockopt(ZMQ.SUBSCRIBE, ""); <--- this line was required in 2.0.7 

        System.out.println("Socket binding on " + port);
        socket.bind (port);

        byte[] b = null;
        int counter = 0;
        while (b == null && ++counter < 7)
        {
            System.out.println("Receiving Messages on " + port);
            b = socket.recv(ZMQ_NOBLOCK);
            Thread.sleep(2000);
        }
        if (b != null)
        {
            String sb = new String(b);
            System.out.println("Received message: msg=" + sb + " on port " + port);
        }
        System.out.println("Cleanup");
        socket.close();
        ctx.term();
    }
    catch (Exception ex)
    {
        System.out.println("Exception: " + ex.getMessage());
    }       
}

}

import org.zeromq.ZMQ;
import org.zeromq.ZMQ.Context;
import org.zeromq.ZMQ.Socket;

public class test_publisher {

public static final int ZMQ_BLOCK = 0;
public static final int ZMQ_NOBLOCK = 1;

public static void main(String[] args) {
    try
    {
        int io_threads = 6;
        String port = "tcp://127.0.0.1:1250";

        System.out.println("Create Context");
        Context ctx = ZMQ.context(io_threads);

        System.out.println("Create Socket");
        Socket socket = ctx.socket(ZMQ.PUB);

        System.out.println("Socket connecting on " + port);
        socket.connect (port);

        String msg = "Hello World!";
        System.out.println("Sending Message " + msg + " on " + port);

        boolean success = socket.send(msg.getBytes(), ZMQ_BLOCK);
        System.out.println("Success = " + success);

        System.out.println("Cleanup");
        socket.close();
        ctx.term();
    }
    catch (Exception ex)
    {
        System.out.println("Exception: " + ex.getMessage());
    }       
}

}

Debian package failing to build on Ubuntu

At the moment, I'm having serious problems getting JZMQ to compile on Ubuntu (10.04.2 LTS Server, x86). I've installed 0MQ from source, but the debian package build for JZMQ is failing with:

dpkg-shlibdeps: error: no dependency information found for /usr/local/lib/libzmq.so.0 (used by debian/jzmq/usr/lib/libjzmq.so.0.0.0).

I've not had much experience building debian packages like this before, so the full stack trace is below in case that is able to help at all.

ubuntu@test-server:/tmp/jzmq$ dpkg-buildpackage -rfakeroot
dpkg-buildpackage: set CFLAGS to default value: -g -O2
dpkg-buildpackage: set CPPFLAGS to default value: 
dpkg-buildpackage: set LDFLAGS to default value: -Wl,-Bsymbolic-functions
dpkg-buildpackage: set FFLAGS to default value: -g -O2
dpkg-buildpackage: set CXXFLAGS to default value: -g -O2
dpkg-buildpackage: source package jzmq
dpkg-buildpackage: source version 2.1.0-1
dpkg-buildpackage: source changed by Alois Bělaška <[email protected]>
dpkg-buildpackage: host architecture i386
 fakeroot debian/rules clean
dh_testdir
dh_testroot
rm -f build-stamp configure-stamp
if [ -e Makefile ]; then make distclean; fi
rm -rf config.log
dh_clean
 dpkg-source -b jzmq
dpkg-source: info: using source format `1.0'
dpkg-source: warning: source directory 'jzmq' is not <sourcepackage>-<upstreamversion> 'jzmq-2.1.0'
dpkg-source: info: building jzmq in jzmq_2.1.0-1.tar.gz
dpkg-source: info: building jzmq in jzmq_2.1.0-1.dsc
 debian/rules build
dh_testdir
./configure  \
      --prefix=/usr \
      CFLAGS="-g -O2" \
      LDFLAGS="-Wl,--as-needed -Wl,-z,defs" \

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking how to create a ustar tar archive... gnutar
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 805306365
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for gawk... (cached) mawk
checking whether gcc and cc understand -c and -o together... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking dependency style of g++... (cached) gcc3
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for ZeroMQ... yes
checking zmq.h usability... yes
checking zmq.h presence... yes
checking for zmq.h... yes
checking for zmq_init in -lzmq... yes
checking for javac... /usr/bin/javac
checking for javah... /usr/bin/javah
checking for jar... /usr/bin/jar
checking for jni.h in /usr/lib/jvm/java-6-openjdk/include... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating perf/Makefile
config.status: creating src/config.hpp
config.status: executing depfiles commands
config.status: executing libtool commands
touch configure-stamp
dh_testdir
/usr/bin/make 
make[1]: Entering directory `/tmp/jzmq'
Making all in src
make[2]: Entering directory `/tmp/jzmq/src'
CLASSPATH=.:./.:$CLASSPATH /usr/bin/javac -d .    org/zeromq/ZMQ.java org/zeromq/ZMQException.java org/zeromq/ZMQQueue.java org/zeromq/ZMQForwarder.java org/zeromq/ZMQStreamer.java
echo timestamp > classdist_noinst.stamp
CLASSPATH=.:./.:$CLASSPATH /usr/bin/javah -jni -classpath . org.zeromq.ZMQ
CLASSPATH=.:./.:$CLASSPATH /usr/bin/javah -jni -classpath . org.zeromq.ZMQ
CLASSPATH=.:./.:$CLASSPATH /usr/bin/javah -jni -classpath . org.zeromq.ZMQ
CLASSPATH=.:./.:$CLASSPATH /usr/bin/javah -jni -classpath . org.zeromq.ZMQ
CLASSPATH=.:./.:$CLASSPATH /usr/bin/javah -jni -classpath . org.zeromq.ZMQ
/usr/bin/make  all-am
make[3]: Entering directory `/tmp/jzmq/src'
/bin/bash ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.   -D_REENTRANT -D_THREAD_SAFE  -I/usr/local/include   -I/usr/lib/jvm/java-6-openjdk/include -I/usr/lib/jvm/java-6-openjdk/include/linux -Wall -g -O2 -MT libjzmq_la-ZMQ.lo -MD -MP -MF .deps/libjzmq_la-ZMQ.Tpo -c -o libjzmq_la-ZMQ.lo `test -f 'ZMQ.cpp' || echo './'`ZMQ.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -D_REENTRANT -D_THREAD_SAFE -I/usr/local/include -I/usr/lib/jvm/java-6-openjdk/include -I/usr/lib/jvm/java-6-openjdk/include/linux -Wall -g -O2 -MT libjzmq_la-ZMQ.lo -MD -MP -MF .deps/libjzmq_la-ZMQ.Tpo -c ZMQ.cpp  -fPIC -DPIC -o .libs/libjzmq_la-ZMQ.o
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -D_REENTRANT -D_THREAD_SAFE -I/usr/local/include -I/usr/lib/jvm/java-6-openjdk/include -I/usr/lib/jvm/java-6-openjdk/include/linux -Wall -g -O2 -MT libjzmq_la-ZMQ.lo -MD -MP -MF .deps/libjzmq_la-ZMQ.Tpo -c ZMQ.cpp -o libjzmq_la-ZMQ.o >/dev/null 2>&1
mv -f .deps/libjzmq_la-ZMQ.Tpo .deps/libjzmq_la-ZMQ.Plo
/bin/bash ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.   -D_REENTRANT -D_THREAD_SAFE  -I/usr/local/include   -I/usr/lib/jvm/java-6-openjdk/include -I/usr/lib/jvm/java-6-openjdk/include/linux -Wall -g -O2 -MT libjzmq_la-Context.lo -MD -MP -MF .deps/libjzmq_la-Context.Tpo -c -o libjzmq_la-Context.lo `test -f 'Context.cpp' || echo './'`Context.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -D_REENTRANT -D_THREAD_SAFE -I/usr/local/include -I/usr/lib/jvm/java-6-openjdk/include -I/usr/lib/jvm/java-6-openjdk/include/linux -Wall -g -O2 -MT libjzmq_la-Context.lo -MD -MP -MF .deps/libjzmq_la-Context.Tpo -c Context.cpp  -fPIC -DPIC -o .libs/libjzmq_la-Context.o
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -D_REENTRANT -D_THREAD_SAFE -I/usr/local/include -I/usr/lib/jvm/java-6-openjdk/include -I/usr/lib/jvm/java-6-openjdk/include/linux -Wall -g -O2 -MT libjzmq_la-Context.lo -MD -MP -MF .deps/libjzmq_la-Context.Tpo -c Context.cpp -o libjzmq_la-Context.o >/dev/null 2>&1
mv -f .deps/libjzmq_la-Context.Tpo .deps/libjzmq_la-Context.Plo
/bin/bash ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.   -D_REENTRANT -D_THREAD_SAFE  -I/usr/local/include   -I/usr/lib/jvm/java-6-openjdk/include -I/usr/lib/jvm/java-6-openjdk/include/linux -Wall -g -O2 -MT libjzmq_la-Socket.lo -MD -MP -MF .deps/libjzmq_la-Socket.Tpo -c -o libjzmq_la-Socket.lo `test -f 'Socket.cpp' || echo './'`Socket.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -D_REENTRANT -D_THREAD_SAFE -I/usr/local/include -I/usr/lib/jvm/java-6-openjdk/include -I/usr/lib/jvm/java-6-openjdk/include/linux -Wall -g -O2 -MT libjzmq_la-Socket.lo -MD -MP -MF .deps/libjzmq_la-Socket.Tpo -c Socket.cpp  -fPIC -DPIC -o .libs/libjzmq_la-Socket.o
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -D_REENTRANT -D_THREAD_SAFE -I/usr/local/include -I/usr/lib/jvm/java-6-openjdk/include -I/usr/lib/jvm/java-6-openjdk/include/linux -Wall -g -O2 -MT libjzmq_la-Socket.lo -MD -MP -MF .deps/libjzmq_la-Socket.Tpo -c Socket.cpp -o libjzmq_la-Socket.o >/dev/null 2>&1
mv -f .deps/libjzmq_la-Socket.Tpo .deps/libjzmq_la-Socket.Plo
/bin/bash ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.   -D_REENTRANT -D_THREAD_SAFE  -I/usr/local/include   -I/usr/lib/jvm/java-6-openjdk/include -I/usr/lib/jvm/java-6-openjdk/include/linux -Wall -g -O2 -MT libjzmq_la-Poller.lo -MD -MP -MF .deps/libjzmq_la-Poller.Tpo -c -o libjzmq_la-Poller.lo `test -f 'Poller.cpp' || echo './'`Poller.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -D_REENTRANT -D_THREAD_SAFE -I/usr/local/include -I/usr/lib/jvm/java-6-openjdk/include -I/usr/lib/jvm/java-6-openjdk/include/linux -Wall -g -O2 -MT libjzmq_la-Poller.lo -MD -MP -MF .deps/libjzmq_la-Poller.Tpo -c Poller.cpp  -fPIC -DPIC -o .libs/libjzmq_la-Poller.o
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -D_REENTRANT -D_THREAD_SAFE -I/usr/local/include -I/usr/lib/jvm/java-6-openjdk/include -I/usr/lib/jvm/java-6-openjdk/include/linux -Wall -g -O2 -MT libjzmq_la-Poller.lo -MD -MP -MF .deps/libjzmq_la-Poller.Tpo -c Poller.cpp -o libjzmq_la-Poller.o >/dev/null 2>&1
mv -f .deps/libjzmq_la-Poller.Tpo .deps/libjzmq_la-Poller.Plo
/bin/bash ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.   -D_REENTRANT -D_THREAD_SAFE  -I/usr/local/include   -I/usr/lib/jvm/java-6-openjdk/include -I/usr/lib/jvm/java-6-openjdk/include/linux -Wall -g -O2 -MT libjzmq_la-util.lo -MD -MP -MF .deps/libjzmq_la-util.Tpo -c -o libjzmq_la-util.lo `test -f 'util.cpp' || echo './'`util.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -D_REENTRANT -D_THREAD_SAFE -I/usr/local/include -I/usr/lib/jvm/java-6-openjdk/include -I/usr/lib/jvm/java-6-openjdk/include/linux -Wall -g -O2 -MT libjzmq_la-util.lo -MD -MP -MF .deps/libjzmq_la-util.Tpo -c util.cpp  -fPIC -DPIC -o .libs/libjzmq_la-util.o
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -D_REENTRANT -D_THREAD_SAFE -I/usr/local/include -I/usr/lib/jvm/java-6-openjdk/include -I/usr/lib/jvm/java-6-openjdk/include/linux -Wall -g -O2 -MT libjzmq_la-util.lo -MD -MP -MF .deps/libjzmq_la-util.Tpo -c util.cpp -o libjzmq_la-util.o >/dev/null 2>&1
mv -f .deps/libjzmq_la-util.Tpo .deps/libjzmq_la-util.Plo
/bin/bash ../libtool --tag=CXX   --mode=link g++ -Wall -g -O2 -version-info 0:0:0 -Wl,--as-needed -Wl,-z,defs -L/usr/local/lib -lzmq   -o libjzmq.la -rpath /usr/lib libjzmq_la-ZMQ.lo libjzmq_la-Context.lo libjzmq_la-Socket.lo libjzmq_la-Poller.lo libjzmq_la-util.lo    -lzmq 
libtool: link: g++ -shared -nostdlib /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/crti.o /usr/lib/gcc/i486-linux-gnu/4.4.3/crtbeginS.o  .libs/libjzmq_la-ZMQ.o .libs/libjzmq_la-Context.o .libs/libjzmq_la-Socket.o .libs/libjzmq_la-Poller.o .libs/libjzmq_la-util.o   -L/usr/local/lib /usr/local/lib/libzmq.so -L/usr/lib/gcc/i486-linux-gnu/4.4.3 -L/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/i486-linux-gnu/4.4.3/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/i486-linux-gnu/4.4.3/crtendS.o /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/crtn.o  -Wl,--as-needed -Wl,-z -Wl,defs   -Wl,-soname -Wl,libjzmq.so.0 -o .libs/libjzmq.so.0.0.0
libtool: link: (cd ".libs" && rm -f "libjzmq.so.0" && ln -s "libjzmq.so.0.0.0" "libjzmq.so.0")
libtool: link: (cd ".libs" && rm -f "libjzmq.so" && ln -s "libjzmq.so.0.0.0" "libjzmq.so")
libtool: link: ar cru .libs/libjzmq.a  libjzmq_la-ZMQ.o libjzmq_la-Context.o libjzmq_la-Socket.o libjzmq_la-Poller.o libjzmq_la-util.o
libtool: link: ranlib .libs/libjzmq.a
libtool: link: ( cd ".libs" && rm -f "libjzmq.la" && ln -s "../libjzmq.la" "libjzmq.la" )
/usr/bin/jar cf  zmq.jar org/zeromq/*.class
make[3]: Leaving directory `/tmp/jzmq/src'
make[2]: Leaving directory `/tmp/jzmq/src'
Making all in perf
make[2]: Entering directory `/tmp/jzmq/perf'
/usr/bin/make  all-am
make[3]: Entering directory `/tmp/jzmq/perf'
CLASSPATH=.:./.:$CLASSPATH /usr/bin/javac -d . -classpath ../src   local_lat.java local_thr.java remote_lat.java remote_thr.java
echo timestamp > classdist_noinst.stamp
/usr/bin/jar cf  zmq-perf.jar *.class
make[3]: Leaving directory `/tmp/jzmq/perf'
make[2]: Leaving directory `/tmp/jzmq/perf'
make[2]: Entering directory `/tmp/jzmq'
make[2]: Nothing to be done for `all-am'.
make[2]: Leaving directory `/tmp/jzmq'
make[1]: Leaving directory `/tmp/jzmq'
touch build-stamp
 fakeroot debian/rules binary
dh_testdir
dh_testroot
dh_prep
dh_installdirs
/usr/bin/make DESTDIR=/tmp/jzmq/debian/tmp install
make[1]: Entering directory `/tmp/jzmq'
Making install in src
make[2]: Entering directory `/tmp/jzmq/src'
/usr/bin/make  install-am
make[3]: Entering directory `/tmp/jzmq/src'
make[4]: Entering directory `/tmp/jzmq/src'
test -z "/usr/lib" || /bin/mkdir -p "/tmp/jzmq/debian/tmp/usr/lib"
 /bin/bash ../libtool   --mode=install /usr/bin/install -c   libjzmq.la '/tmp/jzmq/debian/tmp/usr/lib'
libtool: install: /usr/bin/install -c .libs/libjzmq.so.0.0.0 /tmp/jzmq/debian/tmp/usr/lib/libjzmq.so.0.0.0
libtool: install: (cd /tmp/jzmq/debian/tmp/usr/lib && { ln -s -f libjzmq.so.0.0.0 libjzmq.so.0 || { rm -f libjzmq.so.0 && ln -s libjzmq.so.0.0.0 libjzmq.so.0; }; })
libtool: install: (cd /tmp/jzmq/debian/tmp/usr/lib && { ln -s -f libjzmq.so.0.0.0 libjzmq.so || { rm -f libjzmq.so && ln -s libjzmq.so.0.0.0 libjzmq.so; }; })
libtool: install: /usr/bin/install -c .libs/libjzmq.lai /tmp/jzmq/debian/tmp/usr/lib/libjzmq.la
libtool: install: /usr/bin/install -c .libs/libjzmq.a /tmp/jzmq/debian/tmp/usr/lib/libjzmq.a
libtool: install: chmod 644 /tmp/jzmq/debian/tmp/usr/lib/libjzmq.a
libtool: install: ranlib /tmp/jzmq/debian/tmp/usr/lib/libjzmq.a
libtool: install: warning: remember to run `libtool --finish /usr/lib'
test -z "/usr/share/java" || /bin/mkdir -p "/tmp/jzmq/debian/tmp/usr/share/java"
 /usr/bin/install -c -m 644 zmq.jar '/tmp/jzmq/debian/tmp/usr/share/java'
make[4]: Leaving directory `/tmp/jzmq/src'
make[3]: Leaving directory `/tmp/jzmq/src'
make[2]: Leaving directory `/tmp/jzmq/src'
Making install in perf
make[2]: Entering directory `/tmp/jzmq/perf'
/usr/bin/make  install-am
make[3]: Entering directory `/tmp/jzmq/perf'
make[4]: Entering directory `/tmp/jzmq/perf'
make[4]: Nothing to be done for `install-exec-am'.
make[4]: Nothing to be done for `install-data-am'.
make[4]: Leaving directory `/tmp/jzmq/perf'
make[3]: Leaving directory `/tmp/jzmq/perf'
make[2]: Leaving directory `/tmp/jzmq/perf'
make[2]: Entering directory `/tmp/jzmq'
make[3]: Entering directory `/tmp/jzmq'
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
make[3]: Leaving directory `/tmp/jzmq'
make[2]: Leaving directory `/tmp/jzmq'
make[1]: Leaving directory `/tmp/jzmq'
dh_testdir
dh_testroot
dh_install
dh_installchangelogs
dh_installdocs
dh_lintian
dh_link
dh_compress
dh_fixperms
dh_makeshlibs
dh_installdeb
dh_shlibdeps

dpkg-shlibdeps: error: no dependency information found for /usr/local/lib/libzmq.so.0 (used by debian/jzmq/usr/lib/libjzmq.so.0.0.0).
dh_shlibdeps: dpkg-shlibdeps -Tdebian/jzmq.substvars debian/jzmq/usr/lib/libjzmq.so.0.0.0 returned exit code 2
make: *** [binary-arch] Error 9
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2

Any help at all would be appreciated so much before I lose my mind over this. ;]

Does not build on Windows

After getting all dependencies from cygwin, build failed.

configure could not find jni_md.h.

Looks like it does not have a case for win32:

case "${host_os}" in _solaris_) CPPFLAGS="$CPPFLAGS -I${JAVA_HOME}/include/solaris" ;; _openbsd_) CPPFLAGS="$CPPFLAGS -I${JAVA_HOME}/include/win32" ;; _linux_) CPPFLAGS="$CPPFLAGS -I${JAVA_HOME}/include/linux" ;; _darwin_) # Darwin does not need an extra -I path ;; *) AC_MSG_ERROR([don't know how to find jni_md.h on this platform]) ;; esac

Should not we have a case for win?

Thanks

Is there any plan to add the support for MultiPart in jzmq?

I am trying to use the Pub/Sub model in our high loading system, but find the filter's performance of client side is very poor, I find the current JZMQ doesn't support the multipart message, so the filter must parse every incoming message and confirm if it is the needed, I guess this problem can be resolved if the JZMQ can support the multipart message, because the parsing message body is not needed in that situation. So do you have any plan to add the support of MultiPart in JZMQ? Thanks a lot.

setsocketopt seems to be missing

Hi,

just tried to test pub/sub with jzmq. And if I got the example correctly ZMQ.Socket should have a method named setsocketopt.

With pyzmq this would look like this: socket.setsocketopt(zmq.SUBSCRIBE, "xyz")

Is this not yet implemented or am I looking at the wrong direction?

Cheers

Jochen

configure issue on mac osx 10.6

I did run ./autoconf.sh


./configure ...

checking dynamic linker characteristics... darwin10.6.0 dyld
checking how to hardcode library paths into programs... immediate
./configure: line 15180: syntax error near unexpected token newline' ./configure: line 15180: PKG_CHECK_MODULES('


The offending bit of code

if test "x$zeromq_prefix" = "xdetect"; then
PKG_CHECK_MODULES(
ZeroMQ, libzmq, zeromq_prefix=pkgconfig, zeromq_prefix=)
if test "x$zeromq_prefix" = "xpkgconfig"; then
CPPFLAGS="$CPPFLAGS ${ZeroMQ_CFLAGS}"
LDFLAGS="$LDFLAGS ${ZeroMQ_LIBS}"
fi
fi

build failed with zeromq master branch

Socket.cpp:108: error: ‘ZMQ_HWM’ was not declared in this scope
Socket.cpp:109: error: ‘ZMQ_SWAP’ was not declared in this scope
Socket.cpp:113: error: ‘ZMQ_MCAST_LOOP’ was not declared in this scope
Socket.cpp: In function ‘void Java_org_zeromq_ZMQ_00024Socket_setLongSockopt(JNIEnv_, jobject, jint, jlong)’:
Socket.cpp:190: error: ‘ZMQ_HWM’ was not declared in this scope
Socket.cpp:191: error: ‘ZMQ_SWAP’ was not declared in this scope
Socket.cpp:195: error: ‘ZMQ_MCAST_LOOP’ was not declared in this scope
/Users/xiaobo/Documents/Projects/compute/External/JavaZMQ/../../usr/include/zmq.h: In function ‘jboolean Java_org_zeromq_ZMQ_00024Socket_send(JNIEnv_, jobject, jbyteArray, jint)’:
/Users/xiaobo/Documents/Projects/compute/External/JavaZMQ/../../usr/include/zmq.h:222: error: too few arguments to function ‘int zmq_send(void_, const void_, size_t, int)’
Socket.cpp:356: error: at this point in file
/Users/xiaobo/Documents/Projects/compute/External/JavaZMQ/../../usr/include/zmq.h: In function ‘jbyteArray Java_org_zeromq_ZMQ_00024Socket_recv(JNIEnv_, jobject, jint)’:
/Users/xiaobo/Documents/Projects/compute/External/JavaZMQ/../../usr/include/zmq.h:223: error: too few arguments to function ‘int zmq_recv(void_, void_, size_t, int)’
Socket.cpp:407: error: at this point in file
make[2]: *** [libjzmq_la-Socket.lo] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1

java IO performance improvement - http://www.zeromq.org/deleted:whitepapers:java#toc1

Part of the reason why java is much slower in that whitepaper is because a byte array is allocated for each io operation.
It is neglibile for small data but with big data (4kb to 64kb), the performance could be greatly improved by skipping the allocation and simply copying the data to the byte array.

E.g a ping-pong handler:

byte[] buffer = new byte[8196];
while(true)
{
int offset = 0;
int len = jzmq.receive(buffer, offset);
// ...

 jzmq.send(buffer, offset, len, 0);

}

This is traditionally how data is written/read to/from java sockets/streams.

jzmq poller performance

Hi,
I wrote this test case to check the performance:

package alfred.mdp;

import org.junit.Test;
import org.zeromq.ZMQ;

import java.util.UUID;

import static org.junit.Assert.assertTrue;

/**
 */
public class ZeroMQPerformanceTest {

    private static final int N_MESSAGES = 100000;
    private static final String ADDR = "inproc://reqrep";
    private static final int POLLER_TIMEOUT = 250;

    @Test
    public void performanceTestWithPoller() {
        ZMQ.Context context = ZMQ.context(1);

        ZMQ.Socket in = context.socket(ZMQ.XREQ);
        in.bind(ADDR);

        ZMQ.Socket out = context.socket(ZMQ.XREP);
        out.connect(ADDR);

        ZMQ.Poller poller = context.poller();
        poller.register(out, ZMQ.Poller.POLLIN);
        poller.register(in, ZMQ.Poller.POLLIN);

        for (int i = 0; i < N_MESSAGES; i++) {
            byte[] req = UUID.randomUUID().toString().getBytes();
            assertTrue(in.send(req, 0));
        }

        for (int i = 0; i < N_MESSAGES; i++) {
            if (poller.poll(POLLER_TIMEOUT) > 0 && poller.pollin(0)) {
                out.recv(0);//id
                byte[] reqTmp = out.recv(0);
            }
        }
        long start = System.currentTimeMillis();
        for (int i = 0; i < N_MESSAGES; i++) {
            byte[] req = UUID.randomUUID().toString().getBytes();
            assertTrue(in.send(req, 0));
        }
        System.out.println("performanceTestWithPoller send:" + (System.currentTimeMillis() - start));
        start = System.currentTimeMillis();
        for (int i = 0; i < N_MESSAGES; i++) {
            if (poller.poll(POLLER_TIMEOUT) > 0 && poller.pollin(0)) {
                out.recv(0);//id
                byte[] reqTmp = out.recv(0);
            }
        }
        System.out.println("performanceTestWithPoller receive:" + (System.currentTimeMillis() - start));
    }

    @Test
    public void performanceTest() {
        ZMQ.Context context = ZMQ.context(1);

        ZMQ.Socket in = context.socket(ZMQ.XREQ);
        in.bind(ADDR);

        ZMQ.Socket out = context.socket(ZMQ.XREP);
        out.connect(ADDR);

        for (int i = 0; i < N_MESSAGES; i++) {
            byte[] req = UUID.randomUUID().toString().getBytes();
            assertTrue(in.send(req, 0));
        }

        for (int i = 0; i < N_MESSAGES; i++) {
            out.recv(0);//id
            byte[] reqTmp = out.recv(0);
        }
        long start = System.currentTimeMillis();
        for (int i = 0; i < N_MESSAGES; i++) {
            byte[] req = UUID.randomUUID().toString().getBytes();
            assertTrue(in.send(req, 0));
        }
        System.out.println("performanceTest send:" + (System.currentTimeMillis() - start));
        start = System.currentTimeMillis();
        for (int i = 0; i < N_MESSAGES; i++) {
            out.recv(0);//id
            byte[] reqTmp = out.recv(0);
        }
        System.out.println("performanceTest receive:" + (System.currentTimeMillis() - start));
    }
}

my results are:
performanceTestWithPoller send:787
performanceTestWithPoller receive:1338
performanceTest send:784
performanceTest receive:78

so why are there these differences on receive elapsed time?
is possible it's twenty times slower?

thanks in adv. for help.

Giuseppe

TCP binding Exception

I have run ZMQTest with success.
In test method testReqRep(), I have changed the socket address like this:
...
ZMQ.Socket in = context.socket(ZMQ.REQ);
in.bind("tcp://127.0.0.1:10001");

    ZMQ.Socket out = context.socket(ZMQ.REP);
    out.connect("tcp://127.0.0.1:10001");

...
that is, "inproc://..." is changed to ""tcp://...".

And then, I got the following exception:
...
org.zeromq.ZMQException:
at org.zeromq.ZMQ$Socket.bind(Native Method)
at org.zeromq.ZMQTest.testReqRep(ZMQTest.java:45)
...

Specfile doesn't work for multi-core machines

Hello.

The spec file (jzmq.spec) invokes make with smp flags on multi-code machines:

%{__make} %{?_smp_mflags}

However this doesn't work on actual multi-code machines (tested with Centos 5.6 on a VM which had 4 CPUs allocated to it) because of some weird dependency issue in the order of compiling. Rather than debugging (lazyness is a virtue ;-)), just getting rid of the smp flags solves the problem. I propose to change the spec file to this:

%{__make}

This solves the issue and there is not that much C++ code that needs to be compiled for this to be an issue.

Best regards,
Attila Balazs

Not build on AIX

I tried to build jzmq on my AIX box today.

./autogen.sh run fine after upgrading automake and autoconf

./configure reported couldn't link to -lzmq. After run without success with different options, I copied libzmq.a from /usr/local/lib to to /usr/lib and it worked

But now when I enter make, it throws the error: Cannot find a rule to create target org/zeromq/ZMQ.class from dependencies and stop.

Any idea how to solve the problem?

ZMQ_TYPE type

Hi,

it seems that jzmq uses int64_t for ZMQ_TYPE (Socket.cpp:103). The type for ZMQ_TYPE should be int based on ZeroMQ options.cpp:141.

Maven error: IndexOutOfBoundsException

I didn't find any report about this error...

After compile and install jzmq package i try to execute JUnit test in this repository and the maven result was always the IndexOutOfBoundsException:

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.ArrayList.rangeCheck(ArrayList.java:571)
    at java.util.ArrayList.get(ArrayList.java:349)
    at org.codehaus.mojo.build.CreateMojo.getScmBranch(CreateMojo.java:637)
    at org.codehaus.mojo.build.CreateMojo.execute(CreateMojo.java:464)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

After some debug I concluded that this issue is given by usage of buildnumber-maven-plugin (plugin. So, I disable that plugin (in the pom.xml file) and everything is ok ( by now.... )
I didn't have much time to see why,

ZMQ.cpp:35: error: ‘ZMQ_VERSION’ was not declared in this scope

    $ ./autogen.sh
    $ ./configure JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home"
    $ ./make
    Making all in src
    CLASSPATH=.:./.:$CLASSPATH /usr/bin/javac -d .    org/zeromq/ZMQ.java
    echo timestamp > classdist_noinst.stamp
    CLASSPATH=.:./.:$CLASSPATH /usr/bin/javah -jni -classpath . org.zeromq.ZMQ
    CLASSPATH=.:./.:$CLASSPATH /usr/bin/javah -jni -classpath . org.zeromq.ZMQ
    CLASSPATH=.:./.:$CLASSPATH /usr/bin/javah -jni -classpath . org.zeromq.ZMQ
    CLASSPATH=.:./.:$CLASSPATH /usr/bin/javah -jni -classpath . org.zeromq.ZMQ
    make  all-am
    /bin/sh ../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.   -D_REENTRANT -D_THREAD_SAFE  -I/usr/local/Cellar/zeromq/2.0.8/include   -I/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/include -Wall -g -O2 -MT libjzmq_la-ZMQ.lo -MD -MP -MF .deps/libjzmq_la-ZMQ.Tpo -c -o libjzmq_la-ZMQ.lo `test -f 'ZMQ.cpp' || echo './'`ZMQ.cpp
    libtool: compile:  g++ -DHAVE_CONFIG_H -I. -D_REENTRANT -D_THREAD_SAFE -I/usr/local/Cellar/zeromq/2.0.8/include -I/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/include -Wall -g -O2 -MT libjzmq_la-ZMQ.lo -MD -MP -MF .deps/libjzmq_la-ZMQ.Tpo -c ZMQ.cpp  -fno-common -DPIC -o .libs/libjzmq_la-ZMQ.o
    ZMQ.cpp: In function ‘jint Java_org_zeromq_ZMQ_version_1full(JNIEnv*, _jclass*)’:
    ZMQ.cpp:35: error: ‘ZMQ_VERSION’ was not declared in this scope
    ZMQ.cpp: In function ‘jint Java_org_zeromq_ZMQ_version_1major(JNIEnv*, _jclass*)’:
    ZMQ.cpp:44: error: ‘ZMQ_VERSION_MAJOR’ was not declared in this scope
    ZMQ.cpp: In function ‘jint Java_org_zeromq_ZMQ_version_1minor(JNIEnv*, _jclass*)’:
    ZMQ.cpp:53: error: ‘ZMQ_VERSION_MINOR’ was not declared in this scope
    ZMQ.cpp: In function ‘jint Java_org_zeromq_ZMQ_version_1patch(JNIEnv*, _jclass*)’:
    ZMQ.cpp:62: error: ‘ZMQ_VERSION_PATCH’ was not declared in this scope
    ZMQ.cpp: In function ‘jint Java_org_zeromq_ZMQ_make_1version(JNIEnv*, _jclass*, jint, jint, jint)’:
    ZMQ.cpp:74: error: ‘ZMQ_MAKE_VERSION’ was not declared in this scope
    make[2]: *** [libjzmq_la-ZMQ.lo] Error 1
    make[1]: *** [all] Error 2
    make: *** [all-recursive] Error 1

JVM Dump on distributed stress

I'm not sure if this is the right place for bugs, but twice I've managed to get a JVM dump when running a distributed stress against my very thing jzmq bound app. I'll start here and if I need to move it down the stack to zmq, please let me know.

I'm writing a handler for mongrel2, which basically just calls my zero-mq socket when there is an http connection. I reply with an "OK" or "ERROR" message. I run this at about 3000 requests per second in a single jvm (driving traffic from two sources). After about a half million hits, the jvm spits out this stack trace which, to be frank, i don't find very helpful. There is no other error info that i can find. Hopefully someone can help me interpret this.

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fd0dee9933c, pid=21909, tid=140535053760256
#
# JRE version: 6.0_20-b20
# Java VM: OpenJDK 64-Bit Server VM (19.0-b09 mixed mode linux-amd64 compressed oops)
# Derivative: IcedTea6 1.9.5
# Distribution: Ubuntu 10.10, package 6b20-1.9.5-0ubuntu1
# Problematic frame:
# C  [libzmq.so.0+0x2333c]  _ZN3zmq8reader_t4readEP9zmq_msg_t+0xc
#
# If you would like to submit a bug report, please include
# instructions how to reproduce the bug and visit:
#   https://bugs.launchpad.net/ubuntu/+source/openjdk-6/
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  T H R E A D  ---------------

Current thread (0x00007fd0d8046000):  JavaThread "pool-1-thread-1" [_thread_in_native, id=21928, stack(0x00007fd0dde53000,0x00007fd0ddf54000)]

siginfo:si_signo=SIGSEGV: si_errno=0, si_code=1 (SEGV_MAPERR), si_addr=0x0000000000000035

Registers:
RAX=0x00007fd0d8038d30, RBX=0x00007fd0d80217c0, RCX=0x00007fd0e6588f8c, RDX=0x0000000000000025
RSP=0x00007fd0ddf524d0, RBP=0x0000000000000000, RSI=0x00007fd0ddf52560, RDI=0x00007fd0d80217c0
R8 =0x0000000000000000, R9 =0x0000000000000000, R10=0x0000000000000040, R11=0x0000000000000000
R12=0x00007fd0ddf52560, R13=0x0000000000000002, R14=0x0000000000000000, R15=0x00007fd0ddf536a8
RIP=0x00007fd0dee9933c, EFL=0x0000000000010202, CSGSFS=0x0000000000000033, ERR=0x0000000000000004
  TRAPNO=0x000000000000000e

Register to memory mapping:

RAX=0x00007fd0d8038d30
0x00007fd0d8038d30 is pointing to unknown location

RBX=0x00007fd0d80217c0
0x00007fd0d80217c0 is pointing to unknown location

RCX=0x00007fd0e6588f8c
0x00007fd0e6588f8c: recv+0x6c in /lib/libpthread.so.0 at 0x00007fd0e657a000

RDX=0x0000000000000025
0x0000000000000025 is pointing to unknown location

RSP=0x00007fd0ddf524d0
0x00007fd0ddf524d0 is pointing into the stack for thread: 0x00007fd0d8046000
"pool-1-thread-1" prio=10 tid=0x00007fd0d8046000 nid=0x55a8 runnable [0x00007fd0ddf52000]
   java.lang.Thread.State: RUNNABLE

RBP=0x0000000000000000
0x0000000000000000 is pointing to unknown location

RSI=0x00007fd0ddf52560
0x00007fd0ddf52560 is pointing into the stack for thread: 0x00007fd0d8046000
"pool-1-thread-1" prio=10 tid=0x00007fd0d8046000 nid=0x55a8 runnable [0x00007fd0ddf52000]
   java.lang.Thread.State: RUNNABLE

RDI=0x00007fd0d80217c0
0x00007fd0d80217c0 is pointing to unknown location

R8 =0x0000000000000000
0x0000000000000000 is pointing to unknown location

R9 =0x0000000000000000
0x0000000000000000 is pointing to unknown location

R10=0x0000000000000040
0x0000000000000040 is pointing to unknown location

R11=0x0000000000000000
0x0000000000000000 is pointing to unknown location

R12=0x00007fd0ddf52560
0x00007fd0ddf52560 is pointing into the stack for thread: 0x00007fd0d8046000
"pool-1-thread-1" prio=10 tid=0x00007fd0d8046000 nid=0x55a8 runnable [0x00007fd0ddf52000]
   java.lang.Thread.State: RUNNABLE

R13=0x0000000000000002
0x0000000000000002 is pointing to unknown location

R14=0x0000000000000000
0x0000000000000000 is pointing to unknown location

R15=0x00007fd0ddf536a8
0x00007fd0ddf536a8 is pointing into the stack for thread: 0x00007fd0d8046000
"pool-1-thread-1" prio=10 tid=0x00007fd0d8046000 nid=0x55a8 runnable [0x00007fd0ddf52000]
   java.lang.Thread.State: RUNNABLE


Top of Stack: (sp=0x00007fd0ddf524d0)
0x00007fd0ddf524d0:   00007fd0d80410c0 0000000000000005
0x00007fd0ddf524e0:   00007fd0d803e6e0 00007fd0dee939fb
0x00007fd0ddf524f0:   000000000159dc08 00007fd0d803e580
0x00007fd0ddf52500:   00000000ffffffff 000000000000000b
0x00007fd0ddf52510:   00007fd0ddf52560 00007fd0deea0f12
0x00007fd0ddf52520:   000000000000002e 000000000000002e
0x00007fd0ddf52530:   00007fd0d80461c8 00007fd0ddf536a8
0x00007fd0ddf52540:   00007fd0d803e580 0000000000000000
0x00007fd0ddf52550:   0000000000000000 00007fd0df0b9c31
0x00007fd0ddf52560:   0000000000000020 00007fd0e0e10000
0x00007fd0ddf52570:   00000001f05c264a 0000001500000046
0x00007fd0ddf52580:   00000007d6a10a08 40c7ebc702ee4a00
0x00007fd0ddf52590:   000000000000002e 000000000000002e
0x00007fd0ddf525a0:   00007fd0ddf52610 0000000000000000
0x00007fd0ddf525b0:   000000000000002e 00000007d6a109f0
0x00007fd0ddf525c0:   00007fd0d8046000 00007fd0e0dfa148
0x00007fd0ddf525d0:   0000000782e0b8a0 0000000000000070
0x00007fd0ddf525e0:   0000000700000001 00000007d6a0f5ac
0x00007fd0ddf525f0:   0000000778aabd20 00007fd0e0e4f5ec
0x00007fd0ddf52600:   00007fd0e0e4f6d0 00007fd0ddf52658
0x00007fd0ddf52610:   0000000778aabd20 00007fd0e0e4f8dc
0x00007fd0ddf52620:   00000007d6a0fdb0 0000000000000000
0x00007fd0ddf52630:   00007fd0ddf52658 00007fd0ddf526a0
0x00007fd0ddf52640:   00007fd0ddf526a0 00007fd0e0da1d34
0x00007fd0ddf52650:   00000007d74383f8 0000000782e1c160
0x00007fd0ddf52660:   00007fd0ddf52660 0000000778b583d6
0x00007fd0ddf52670:   00007fd0ddf52708 0000000778b5fea8
0x00007fd0ddf52680:   0000000000000000 0000000778b584e0
0x00007fd0ddf52690:   00007fd0ddf52658 00007fd0ddf52700
0x00007fd0ddf526a0:   00007fd0ddf52750 00007fd0e0da185a
0x00007fd0ddf526b0:   0000000000000000 0000000000000000
0x00007fd0ddf526c0:   0000000000000000 0000000000000000 

Instructions: (pc=0x00007fd0dee9933c)
0x00007fd0dee9932c:   90 90 90 90 53 48 89 fb 48 83 ec 10 48 8b 57 28
0x00007fd0dee9933c:   8b 7a 10 48 8b 4a 08 4c 8b 4a 48 4c 63 c7 4b 8d 

Stack: [0x00007fd0dde53000,0x00007fd0ddf54000],  sp=0x00007fd0ddf524d0,  free space=1021k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libzmq.so.0+0x2333c]  _ZN3zmq8reader_t4readEP9zmq_msg_t+0xc

[error occurred during error reporting (printing native stack), id 0xb]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J  org.zeromq.ZMQ$Socket.recv(I)[B
J  com.doapps.services.metrics.RequestMetricHandler$1.run()V
j  java.util.concurrent.ThreadPoolExecutor.runWorker(Ljava/util/concurrent/ThreadPoolExecutor$Worker;)V+46
j  java.util.concurrent.ThreadPoolExecutor$Worker.run()V+5
j  java.lang.Thread.run()V+11
v  ~StubRoutines::call_stub

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x00007fd0d8049800 JavaThread "pool-1-thread-3" [_thread_in_native, id=21930, stack(0x00007fd0ddc51000,0x00007fd0ddd52000)]
  0x00007fd0d8047800 JavaThread "pool-1-thread-2" [_thread_in_native, id=21929, stack(0x00007fd0ddd52000,0x00007fd0dde53000)]
=>0x00007fd0d8046000 JavaThread "pool-1-thread-1" [_thread_in_native, id=21928, stack(0x00007fd0dde53000,0x00007fd0ddf54000)]
  0x000000000159c000 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=21925, stack(0x00007fd0df3ce000,0x00007fd0df4cf000)]
  0x0000000001599800 JavaThread "CompilerThread1" daemon [_thread_blocked, id=21924, stack(0x00007fd0df4cf000,0x00007fd0df5d0000)]
  0x0000000001596800 JavaThread "CompilerThread0" daemon [_thread_blocked, id=21923, stack(0x00007fd0df5d0000,0x00007fd0df6d1000)]
  0x0000000001595000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=21922, stack(0x00007fd0df6d1000,0x00007fd0df7d2000)]
  0x0000000001570000 JavaThread "Finalizer" daemon [_thread_blocked, id=21920, stack(0x00007fd0dfa76000,0x00007fd0dfb77000)]
  0x000000000156e000 JavaThread "Reference Handler" daemon [_thread_blocked, id=21919, stack(0x00007fd0dfb77000,0x00007fd0dfc78000)]
  0x0000000001501000 JavaThread "main" [_thread_blocked, id=21910, stack(0x00007fd0e6aab000,0x00007fd0e6bac000)]

Other Threads:
  0x0000000001567800 VMThread [stack: 0x00007fd0dfc78000,0x00007fd0dfd79000] [id=21914]
  0x00007fd0d8004800 WatcherThread [stack: 0x00007fd0df2cd000,0x00007fd0df3ce000] [id=21926]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 PSYoungGen      total 7168K, used 5998K [0x00000007d64b0000, 0x00000007d6bd0000, 0x0000000800000000)
  eden space 7040K, 84% used [0x00000007d64b0000,0x00000007d6a7bbb8,0x00000007d6b90000)
  from space 128K, 50% used [0x00000007d6b90000,0x00000007d6ba0000,0x00000007d6bb0000)
  to   space 128K, 0% used [0x00000007d6bb0000,0x00000007d6bb0000,0x00000007d6bd0000)
 PSOldGen        total 85376K, used 384K [0x0000000782e00000, 0x0000000788160000, 0x00000007d64b0000)
  object space 85376K, 0% used [0x0000000782e00000,0x0000000782e60070,0x0000000788160000)
 PSPermGen       total 21248K, used 3820K [0x0000000778800000, 0x0000000779cc0000, 0x0000000782e00000)
  object space 21248K, 17% used [0x0000000778800000,0x0000000778bbb0e0,0x0000000779cc0000)

Dynamic libraries:
00400000-00409000 r-xp 00000000 08:17 786398                             /usr/lib/jvm/java-6-openjdk/jre/bin/java
00608000-00609000 r--p 00008000 08:17 786398                             /usr/lib/jvm/java-6-openjdk/jre/bin/java
00609000-0060a000 rw-p 00009000 08:17 786398                             /usr/lib/jvm/java-6-openjdk/jre/bin/java
014f8000-01d1a000 rw-p 00000000 00:00 0                                  [heap]
778800000-779cc0000 rw-p 00000000 00:00 0 
779cc0000-782e00000 rw-p 00000000 00:00 0 
782e00000-788160000 rw-p 00000000 00:00 0 
788160000-7d64b0000 rw-p 00000000 00:00 0 
7d64b0000-7d6bd0000 rw-p 00000000 00:00 0 
7d6bd0000-7d8e60000 ---p 00000000 00:00 0 
7d8e60000-800000000 rw-p 00000000 00:00 0 
7fd0d8000000-7fd0d8bd1000 rw-p 00000000 00:00 0 
7fd0d8bd1000-7fd0dc000000 ---p 00000000 00:00 0 
7fd0ddc51000-7fd0ddc54000 ---p 00000000 00:00 0 
7fd0ddc54000-7fd0ddd52000 rw-p 00000000 00:00 0 
7fd0ddd52000-7fd0ddd55000 ---p 00000000 00:00 0 
7fd0ddd55000-7fd0dde53000 rw-p 00000000 00:00 0 
7fd0dde53000-7fd0dde56000 ---p 00000000 00:00 0 
7fd0dde56000-7fd0ddf54000 rw-p 00000000 00:00 0 
7fd0ddf54000-7fd0ddf55000 ---p 00000000 00:00 0 
7fd0ddf55000-7fd0de755000 rw-p 00000000 00:00 0 
7fd0de755000-7fd0de758000 r-xp 00000000 08:17 539833                     /lib/libuuid.so.1.3.0
7fd0de758000-7fd0de958000 ---p 00003000 08:17 539833                     /lib/libuuid.so.1.3.0
7fd0de958000-7fd0de959000 r--p 00003000 08:17 539833                     /lib/libuuid.so.1.3.0
7fd0de959000-7fd0de95a000 rw-p 00004000 08:17 539833                     /lib/libuuid.so.1.3.0
7fd0de95a000-7fd0de96f000 r-xp 00000000 08:17 524064                     /lib/libgcc_s.so.1
7fd0de96f000-7fd0deb6e000 ---p 00015000 08:17 524064                     /lib/libgcc_s.so.1
7fd0deb6e000-7fd0deb6f000 r--p 00014000 08:17 524064                     /lib/libgcc_s.so.1
7fd0deb6f000-7fd0deb70000 rw-p 00015000 08:17 524064                     /lib/libgcc_s.so.1
7fd0deb70000-7fd0dec58000 r-xp 00000000 08:17 528473                     /usr/lib/libstdc++.so.6.0.14
7fd0dec58000-7fd0dee57000 ---p 000e8000 08:17 528473                     /usr/lib/libstdc++.so.6.0.14
7fd0dee57000-7fd0dee5f000 r--p 000e7000 08:17 528473                     /usr/lib/libstdc++.so.6.0.14
7fd0dee5f000-7fd0dee61000 rw-p 000ef000 08:17 528473                     /usr/lib/libstdc++.so.6.0.14
7fd0dee61000-7fd0dee76000 rw-p 00000000 00:00 0 
7fd0dee76000-7fd0deeb5000 r-xp 00000000 08:17 587726                     /usr/local/lib/libzmq.so.0.0.0
7fd0deeb5000-7fd0df0b4000 ---p 0003f000 08:17 587726                     /usr/local/lib/libzmq.so.0.0.0
7fd0df0b4000-7fd0df0b7000 r--p 0003e000 08:17 587726                     /usr/local/lib/libzmq.so.0.0.0
7fd0df0b7000-7fd0df0b8000 rw-p 00041000 08:17 587726                     /usr/local/lib/libzmq.so.0.0.0
7fd0df0b8000-7fd0df0bc000 r-xp 00000000 08:17 590598                     /usr/local/lib/libjzmq.so.0.0.0
7fd0df0bc000-7fd0df2bb000 ---p 00004000 08:17 590598                     /usr/local/lib/libjzmq.so.0.0.0
7fd0df2bb000-7fd0df2bc000 r--p 00003000 08:17 590598                     /usr/local/lib/libjzmq.so.0.0.0
7fd0df2bc000-7fd0df2bd000 rw-p 00004000 08:17 590598                     /usr/local/lib/libjzmq.so.0.0.0
7fd0df2bd000-7fd0df2c1000 r--s 0007c000 08:17 688768                     /usr/lib/jvm/java-6-openjdk/jre/lib/jsse.jar
7fd0df2c1000-7fd0df2c2000 r--s 00002000 08:17 590604                     /usr/local/share/java/zmq.jar
7fd0df2c2000-7fd0df2c5000 r--s 0000f000 08:17 688746                     /usr/lib/jvm/java-6-openjdk/jre/lib/ext/pulse-java.jar
7fd0df2c5000-7fd0df2cd000 r--s 00066000 08:17 2580                       /usr/share/java/gnome-java-bridge.jar
7fd0df2cd000-7fd0df2ce000 ---p 00000000 00:00 0 
7fd0df2ce000-7fd0df3ce000 rw-p 00000000 00:00 0 
7fd0df3ce000-7fd0df3d1000 ---p 00000000 00:00 0 
7fd0df3d1000-7fd0df4cf000 rw-p 00000000 00:00 0 
7fd0df4cf000-7fd0df4d2000 ---p 00000000 00:00 0 
7fd0df4d2000-7fd0df5d0000 rw-p 00000000 00:00 0 
7fd0df5d0000-7fd0df5d3000 ---p 00000000 00:00 0 
7fd0df5d3000-7fd0df6d1000 rw-p 00000000 00:00 0 
7fd0df6d1000-7fd0df6d4000 ---p 00000000 00:00 0 
7fd0df6d4000-7fd0df7d2000 rw-p 00000000 00:00 0 
7fd0df7d2000-7fd0dfa76000 r--p 00000000 08:17 523290                     /usr/lib/locale/locale-archive
7fd0dfa76000-7fd0dfa79000 ---p 00000000 00:00 0 
7fd0dfa79000-7fd0dfb77000 rw-p 00000000 00:00 0 
7fd0dfb77000-7fd0dfb7a000 ---p 00000000 00:00 0 
7fd0dfb7a000-7fd0dfc78000 rw-p 00000000 00:00 0 
7fd0dfc78000-7fd0dfc79000 ---p 00000000 00:00 0 
7fd0dfc79000-7fd0e017d000 rw-p 00000000 00:00 0 
7fd0e017d000-7fd0e017f000 r--s 0001d000 08:17 688784                     /usr/lib/jvm/java-6-openjdk/jre/lib/plugin.jar
7fd0e017f000-7fd0e0184000 r--s 00044000 08:17 688783                     /usr/lib/jvm/java-6-openjdk/jre/lib/netx.jar
7fd0e0184000-7fd0e01b6000 rw-p 00000000 00:00 0 
7fd0e01b6000-7fd0e0345000 r--s 038bb000 08:17 688807                     /usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar
7fd0e0345000-7fd0e036d000 rw-p 00000000 00:00 0 
7fd0e036d000-7fd0e036e000 ---p 00000000 00:00 0 
7fd0e036e000-7fd0e046e000 rw-p 00000000 00:00 0 
7fd0e046e000-7fd0e046f000 ---p 00000000 00:00 0 
7fd0e046f000-7fd0e056f000 rw-p 00000000 00:00 0 
7fd0e056f000-7fd0e0570000 ---p 00000000 00:00 0 
7fd0e0570000-7fd0e067b000 rw-p 00000000 00:00 0 
7fd0e067b000-7fd0e06c3000 rw-p 00000000 00:00 0 
7fd0e06c3000-7fd0e06ed000 rw-p 00000000 00:00 0 
7fd0e06ed000-7fd0e095f000 rw-p 00000000 00:00 0 
7fd0e095f000-7fd0e096a000 rw-p 00000000 00:00 0 
7fd0e096a000-7fd0e09b2000 rw-p 00000000 00:00 0 
7fd0e09b2000-7fd0e09dc000 rw-p 00000000 00:00 0 
7fd0e09dc000-7fd0e0c4d000 rw-p 00000000 00:00 0 
7fd0e0c4d000-7fd0e0c51000 rw-p 00000000 00:00 0 
7fd0e0c51000-7fd0e0c63000 ---p 00000000 00:00 0 
7fd0e0c63000-7fd0e0d9b000 rw-p 00000000 00:00 0 
7fd0e0d9b000-7fd0e0d9c000 rw-p 00000000 00:00 0 
7fd0e0d9c000-7fd0e100c000 rwxp 00000000 00:00 0 
7fd0e100c000-7fd0e3d9c000 rw-p 00000000 00:00 0 
7fd0e3d9c000-7fd0e3da3000 r-xp 00000000 08:17 786435                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/libzip.so
7fd0e3da3000-7fd0e3fa2000 ---p 00007000 08:17 786435                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/libzip.so
7fd0e3fa2000-7fd0e3fa3000 r--p 00006000 08:17 786435                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/libzip.so
7fd0e3fa3000-7fd0e3fa4000 rw-p 00007000 08:17 786435                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/libzip.so
7fd0e3fa4000-7fd0e3fb0000 r-xp 00000000 08:17 540405                     /lib/libnss_files-2.12.1.so
7fd0e3fb0000-7fd0e41af000 ---p 0000c000 08:17 540405                     /lib/libnss_files-2.12.1.so
7fd0e41af000-7fd0e41b0000 r--p 0000b000 08:17 540405                     /lib/libnss_files-2.12.1.so
7fd0e41b0000-7fd0e41b1000 rw-p 0000c000 08:17 540405                     /lib/libnss_files-2.12.1.so
7fd0e41b1000-7fd0e41bb000 r-xp 00000000 08:17 539862                     /lib/libnss_nis-2.12.1.so
7fd0e41bb000-7fd0e43ba000 ---p 0000a000 08:17 539862                     /lib/libnss_nis-2.12.1.so
7fd0e43ba000-7fd0e43bb000 r--p 00009000 08:17 539862                     /lib/libnss_nis-2.12.1.so
7fd0e43bb000-7fd0e43bc000 rw-p 0000a000 08:17 539862                     /lib/libnss_nis-2.12.1.so
7fd0e43bc000-7fd0e43c4000 r-xp 00000000 08:17 540402                     /lib/libnss_compat-2.12.1.so
7fd0e43c4000-7fd0e45c3000 ---p 00008000 08:17 540402                     /lib/libnss_compat-2.12.1.so
7fd0e45c3000-7fd0e45c4000 r--p 00007000 08:17 540402                     /lib/libnss_compat-2.12.1.so
7fd0e45c4000-7fd0e45c5000 rw-p 00008000 08:17 540402                     /lib/libnss_compat-2.12.1.so
7fd0e45c5000-7fd0e45cd000 r-xp 00000000 08:17 786463                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/native_threads/libhpi.so
7fd0e45cd000-7fd0e47cc000 ---p 00008000 08:17 786463                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/native_threads/libhpi.so
7fd0e47cc000-7fd0e47cd000 r--p 00007000 08:17 786463                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/native_threads/libhpi.so
7fd0e47cd000-7fd0e47ce000 rw-p 00008000 08:17 786463                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/native_threads/libhpi.so
7fd0e47ce000-7fd0e47e5000 r-xp 00000000 08:17 540404                     /lib/libnsl-2.12.1.so
7fd0e47e5000-7fd0e49e4000 ---p 00017000 08:17 540404                     /lib/libnsl-2.12.1.so
7fd0e49e4000-7fd0e49e5000 r--p 00016000 08:17 540404                     /lib/libnsl-2.12.1.so
7fd0e49e5000-7fd0e49e6000 rw-p 00017000 08:17 540404                     /lib/libnsl-2.12.1.so
7fd0e49e6000-7fd0e49e8000 rw-p 00000000 00:00 0 
7fd0e49e8000-7fd0e4a13000 r-xp 00000000 08:17 786434                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/libjava.so
7fd0e4a13000-7fd0e4c12000 ---p 0002b000 08:17 786434                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/libjava.so
7fd0e4c12000-7fd0e4c13000 r--p 0002a000 08:17 786434                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/libjava.so
7fd0e4c13000-7fd0e4c16000 rw-p 0002b000 08:17 786434                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/libjava.so
7fd0e4c16000-7fd0e4c24000 r-xp 00000000 08:17 786419                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/libverify.so
7fd0e4c24000-7fd0e4e23000 ---p 0000e000 08:17 786419                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/libverify.so
7fd0e4e23000-7fd0e4e25000 r--p 0000d000 08:17 786419                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/libverify.so
7fd0e4e25000-7fd0e4e26000 rw-p 0000f000 08:17 786419                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/libverify.so
7fd0e4e26000-7fd0e4e2d000 r-xp 00000000 08:17 539171                     /lib/librt-2.12.1.so
7fd0e4e2d000-7fd0e502c000 ---p 00007000 08:17 539171                     /lib/librt-2.12.1.so
7fd0e502c000-7fd0e502d000 r--p 00006000 08:17 539171                     /lib/librt-2.12.1.so
7fd0e502d000-7fd0e502e000 rw-p 00007000 08:17 539171                     /lib/librt-2.12.1.so
7fd0e502e000-7fd0e50b0000 r-xp 00000000 08:17 539860                     /lib/libm-2.12.1.so
7fd0e50b0000-7fd0e52af000 ---p 00082000 08:17 539860                     /lib/libm-2.12.1.so
7fd0e52af000-7fd0e52b0000 r--p 00081000 08:17 539860                     /lib/libm-2.12.1.so
7fd0e52b0000-7fd0e52b1000 rw-p 00082000 08:17 539860                     /lib/libm-2.12.1.so
7fd0e52b1000-7fd0e5b25000 r-xp 00000000 08:17 786437                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server/libjvm.so
7fd0e5b25000-7fd0e5d24000 ---p 00874000 08:17 786437                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server/libjvm.so
7fd0e5d24000-7fd0e5d9a000 r--p 00873000 08:17 786437                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server/libjvm.so
7fd0e5d9a000-7fd0e5db5000 rw-p 008e9000 08:17 786437                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server/libjvm.so
7fd0e5db5000-7fd0e5dee000 rw-p 00000000 00:00 0 
7fd0e5dee000-7fd0e5f68000 r-xp 00000000 08:17 539849                     /lib/libc-2.12.1.so
7fd0e5f68000-7fd0e6167000 ---p 0017a000 08:17 539849                     /lib/libc-2.12.1.so
7fd0e6167000-7fd0e616b000 r--p 00179000 08:17 539849                     /lib/libc-2.12.1.so
7fd0e616b000-7fd0e616c000 rw-p 0017d000 08:17 539849                     /lib/libc-2.12.1.so
7fd0e616c000-7fd0e6171000 rw-p 00000000 00:00 0 
7fd0e6171000-7fd0e6173000 r-xp 00000000 08:17 540407                     /lib/libdl-2.12.1.so
7fd0e6173000-7fd0e6373000 ---p 00002000 08:17 540407                     /lib/libdl-2.12.1.so
7fd0e6373000-7fd0e6374000 r--p 00002000 08:17 540407                     /lib/libdl-2.12.1.so
7fd0e6374000-7fd0e6375000 rw-p 00003000 08:17 540407                     /lib/libdl-2.12.1.so
7fd0e6375000-7fd0e6379000 r-xp 00000000 08:17 786417                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/jli/libjli.so
7fd0e6379000-7fd0e6578000 ---p 00004000 08:17 786417                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/jli/libjli.so
7fd0e6578000-7fd0e6579000 r--p 00003000 08:17 786417                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/jli/libjli.so
7fd0e6579000-7fd0e657a000 rw-p 00004000 08:17 786417                     /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/jli/libjli.so
7fd0e657a000-7fd0e6592000 r-xp 00000000 08:17 539851                     /lib/libpthread-2.12.1.so
7fd0e6592000-7fd0e6791000 ---p 00018000 08:17 539851                     /lib/libpthread-2.12.1.so
7fd0e6791000-7fd0e6792000 r--p 00017000 08:17 539851                     /lib/libpthread-2.12.1.so
7fd0e6792000-7fd0e6793000 rw-p 00018000 08:17 539851                     /lib/libpthread-2.12.1.so
7fd0e6793000-7fd0e6797000 rw-p 00000000 00:00 0 
7fd0e6797000-7fd0e67ad000 r-xp 00000000 08:17 527679                     /lib/libz.so.1.2.3.4
7fd0e67ad000-7fd0e69ad000 ---p 00016000 08:17 527679                     /lib/libz.so.1.2.3.4
7fd0e69ad000-7fd0e69ae000 r--p 00016000 08:17 527679                     /lib/libz.so.1.2.3.4
7fd0e69ae000-7fd0e69af000 rw-p 00017000 08:17 527679                     /lib/libz.so.1.2.3.4
7fd0e69af000-7fd0e69cf000 r-xp 00000000 08:17 539861                     /lib/ld-2.12.1.so
7fd0e69eb000-7fd0e69f5000 rw-p 00000000 00:00 0 
7fd0e69f5000-7fd0e6aab000 rw-p 00000000 00:00 0 
7fd0e6aab000-7fd0e6aae000 ---p 00000000 00:00 0 
7fd0e6aae000-7fd0e6bb1000 rw-p 00000000 00:00 0 
7fd0e6bc2000-7fd0e6bc3000 r--s 00003000 00:14 2509151                    /home/ncampion/.m2/repository/com/googlecode/json-simple/json-simple/1.1/json-simple-1.1.jar
7fd0e6bc3000-7fd0e6bcb000 rw-s 00000000 08:17 658761                     /tmp/hsperfdata_ncampion/21909
7fd0e6bcb000-7fd0e6bcc000 rw-p 00000000 00:00 0 
7fd0e6bcc000-7fd0e6bcd000 r--p 00000000 00:00 0 
7fd0e6bcd000-7fd0e6bcf000 rw-p 00000000 00:00 0 
7fd0e6bcf000-7fd0e6bd0000 r--p 00020000 08:17 539861                     /lib/ld-2.12.1.so
7fd0e6bd0000-7fd0e6bd1000 rw-p 00021000 08:17 539861                     /lib/ld-2.12.1.so
7fd0e6bd1000-7fd0e6bd2000 rw-p 00000000 00:00 0 
7fff73b15000-7fff73b36000 rw-p 00000000 00:00 0                          [stack]
7fff73b37000-7fff73b38000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

VM Arguments:
jvm_args: -Djava.library.path=/usr/local/lib -Dfile.encoding=UTF-8 
java_command: com.doapps.services.metrics.RequestMetricHandler
Launcher Type: SUN_STANDARD

Environment Variables:
PATH=/usr/local/lib/android/android-sdk-linux_x86/tools:/usr/local/lib/android/android-sdk-linux_x86/platform-tools:/home/ncampion/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
USERNAME=ncampion
LD_LIBRARY_PATH=/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server:/usr/lib/jvm/java-6-openjdk/jre/lib/amd64:/usr/lib/jvm/java-6-openjdk/jre/../lib/amd64:/usr/lib/xulrunner-1.9.2.13
SHELL=/bin/bash
DISPLAY=:0.0

Signal Handlers:
SIGSEGV: [libjvm.so+0x712740], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGBUS: [libjvm.so+0x712740], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGFPE: [libjvm.so+0x5d4060], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGPIPE: [libjvm.so+0x5d4060], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGXFSZ: [libjvm.so+0x5d4060], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGILL: [libjvm.so+0x5d4060], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGUSR1: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000
SIGUSR2: [libjvm.so+0x5d3770], sa_mask[0]=0x00000004, sa_flags=0x10000004
SIGHUP: [libjvm.so+0x5d61e0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGINT: [libjvm.so+0x5d61e0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGTERM: [libjvm.so+0x5d61e0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGQUIT: [libjvm.so+0x5d61e0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004


---------------  S Y S T E M  ---------------

OS:Ubuntu 10.10 (maverick)
uname:Linux 2.6.35-25-generic #44-Ubuntu SMP Fri Jan 21 17:40:44 UTC 2011 x86_64
libc:glibc 2.12.1 NPTL 2.12.1 
rlimit: STACK 8192k, CORE 0k, NPROC infinity, NOFILE 1024, AS infinity
load average:2.77 1.94 1.51

/proc/meminfo:
MemTotal:        8193500 kB
MemFree:           51960 kB
Buffers:          368260 kB
Cached:          3264692 kB
SwapCached:            0 kB
Active:          5131028 kB
Inactive:        2411276 kB
Active(anon):    3920368 kB
Inactive(anon):    80592 kB
Active(file):    1210660 kB
Inactive(file):  2330684 kB
Unevictable:          32 kB
Mlocked:              32 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:              5252 kB
Writeback:             0 kB
AnonPages:       3909364 kB
Mapped:           247864 kB
Shmem:             91632 kB
Slab:             296720 kB
SReclaimable:     249276 kB
SUnreclaim:        47444 kB
KernelStack:        4832 kB
PageTables:        44748 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     4096748 kB
Committed_AS:    7036200 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      333620 kB
VmallocChunk:   34359400592 kB
HardwareCorrupted:     0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:      140160 kB
DirectMap2M:     8247296 kB
DirectMap1G:           0 kB


CPU:total 3 (3 cores per cpu, 1 threads per core) family 16 model 4 stepping 2, cmov, cx8, fxsr, mmx, sse, sse2, sse3, popcnt, mmxext, 3dnow, 3dnowext, lzcnt, sse4a

Memory: 4k page, physical 8193500k(51960k free), swap 0k(0k free)

vm_info: OpenJDK 64-Bit Server VM (19.0-b09) for linux-amd64 JRE (1.6.0_20-b20), built on Jan 27 2011 21:59:04 by "buildd" with gcc 4.4.5

time: Wed Feb 23 14:02:58 2011
elapsed time: 1159 seconds

Test failure using zeromq 2.1.8


Test set: org.zeromq.ZMQQueueTest

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.057 sec <<< FAILURE!
testQueue(org.zeromq.ZMQQueueTest) Time elapsed: 0.052 sec <<< FAILURE!
java.lang.AssertionError: array lengths differed, expected.length=8 actual.length=4
at org.junit.Assert.fail(Assert.java:91)
at org.junit.internal.ComparisonCriteria.assertArraysAreSameLength(ComparisonCriteria.java:70)
at org.junit.internal.ComparisonCriteria.arrayEquals(ComparisonCriteria.java:34)
at org.junit.Assert.internalArrayEquals(Assert.java:414)
at org.junit.Assert.assertArrayEquals(Assert.java:200)
at org.junit.Assert.assertArrayEquals(Assert.java:213)
at org.zeromq.ZMQQueueTest.testQueue(ZMQQueueTest.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
at $Proxy0.invoke(Unknown Source)
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)

context.term() hangs even all the sockets created in the context are closed.

First I just want to thank you for the work of java binding of zmq, an amazing product!

I am using zeromq-2.1.4 and jzmq snapshot of 04/17/2011 on Mac OSX. I am trying to use a thread pool to receive message. However, I have difficulties to shut the thread pool down and it always hangs when I call context.term(). I have code attached.

I have read the doc regarding how to close the context cleanly, and I did close the connection before context.term(). But it doesn't seem to work for me.

Question 1: when connect.close is called, what happens to the thread running connection.recv(0)? should it break first? Ideally, I see recv() throw error and unblock the thread is much easier to handle. Also, the doc said the recv will be able to get the signal and unblock itself. but it doesn't seem to work for java binding???

Question 2: should each context be create for each thread (threadlocal)? I tried, and doesn't seem to work all the time, the behavior is rather unpredictable, i.e. most time either error out as mentioned below or hang, but 1 out of ten actually succeed).

Question 3: The doc does mention it is bug that context.term will hange (http://zguide.zeromq.org/page:all#Making-a-Clean-Exit) but it kind alludes there is a workaround. Is this going to be fixed? Can context.term just unblock blocking calls of the socket and close all the connections underlying, so we don't have a chicken or egg problem here (e.g. recv(0) will block unless context.term() is called, but context.term() will block unless connection.close is called, and what happen to the recv(0)?).

---- code -----

Here is a simplified test I wrote:
public class TestWorker {

private static final int BLOCK_FLAG = 0;
ZMQ.Socket socket;
ZMQ.Context context;
@BeforeMethod
public void beforeMethod() {
    context = ZMQ.context(1);
    socket = context.socket(ZMQ.PULL);
    socket.connect("tcp://localhost:5557");
}

@Test
public void threadPoolTest() throws InterruptedException {
    ExecutorService executorService = Executors.newFixedThreadPool(3);
    final AtomicBoolean isRunning = new AtomicBoolean(true);
    //submit running task
    for (int i = 0; i < 3; i++) {
        executorService.submit(new Callable<Void>() {
            public Void call() throws Exception {
                 while (isRunning.get()) {
                     byte[] data = socket.recv(BLOCK_FLAG); //block
                     System.out.println(new String(data));
                 }
                return null;   //thread is stopped.
            }
        });
    }
    Thread.sleep(5000L);//let's sleep for 5 sec so that everything is initialized.
    isRunning.set(false);//trying to stop the thread pool.
    socket.close();
    context.term();//NOTE: this never get unblocked. Or sometime just throw errors.
    executorService.shutdown(); //never reach here.
}

}
The program usually hangs at term.

--- If error occur, they are like the following, and then program exist.
ad file descriptor
nbytes != -1 (mailbox.cpp:242)
Bad file descriptor
nbytes != -1 (mailbox.cpp:242)
Bad file descriptor
nbytes != -1 (mailbox.cpp:242)

Implementing zmq_getsockopt

I was wondering if somebody could implement the zmq_getsockopt function. It would make determining if a message is multi-part possible.

jzmq failed to compile for windows on msvc

I have followed http://www.zeromq.org/bindings:java for windows compilation on msvc 2010, but failed.

  1. source code does not come with [jzmq]\include folder as supposed.
    Error 1 error C1083: Cannot open include file: 'zmq.h': No such file or directory
  2. after i anyway copied the include folder from zeromq-2.1.10 to jzmq and tried to recompile, it failed again with another error:
    Error 2 error LNK1181: cannot open input file 'libzmq.lib'

I don't understand why such an error could occur.

Context can be finalised prematurely

Socket objects have no reference to context object they belong to. This can cause gc to finalise the context even though the associated sockets are still being used. This in turn results in all sockets failing with ETERM.

Native library embedding fails on Windows when libzmq is compiled as a dynamic library

Right now the jzmq.dll fails to load when using embedded libraries, unless you modify the ZeroMQ Visual Studio Project to change libzmq.dll to a static library and link jzmq.dll with the static library.

Currently the embedded library logic does not add libzmq.dlll to the JAR. Nor does it attempt to unpack libzmq.dll before attempting to load jzmq.dll which fails because of the libzmq.dll dependency.

Native library embedding relies on os.name which is a mess on Windows

Right now the native library embedding does not work on Windows because we only bundle the DLL up for the version of Windows you compiled the JAR on.

For non Windows operating systems, this should be sufficient, but on Windows the JNLP os.name definition is a mess.
http://lopica.sourceforge.net/os.html

Either the embedded library logic should strip the Windows variant extension off to and just search for x86/Windows or amd64/Windows, or the embedded library logic should replace os.name with something else to locate the embedded library.

Assertion failed: zmq_assert(size> = 2)

Hello,

Could anyone tell me what this error is due?
Assertion failed: zmq_assert (size> = 2) (zmq_init.cpp)

zeromq config : version 3.0.0
jzmq config : version 2.1.0

thanks for your help,

Y@nn

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.