[zeromq-dev] JeroMQ crashes application
Lucas Hope
lucas.r.hope at gmail.com
Fri Aug 16 03:22:25 CEST 2013
Hi there,
While it may not be fast enough for your application, a solution which
worked for me was to use a concurrent blocking
queue<http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/BlockingQueue.html>as
a pipe/bridge between the threads you don't have full control of (the
producers) and a single consumer thread whose sole task is to consume the
queue elements and republish them on a ZMQ socket.
The construct worked quite well, but was not used in any sort of production
environment. Just an idea. :-)
Luke
On Fri, Aug 16, 2013 at 12:52 AM, Michael Keselman <
michael.keselman at gmail.com> wrote:
> Pieter,
>
> I have two use cases:
> 1) short-living threads within my application (under 10 milliseconds)
> 2) threads that are initiated and managed by an outside application which
> calls my code. My code is executed also in a few milliseconds timeframe
>
> in either case the I have a few msec to connect and publish a message. If
> when I tried to open a socket within those few milliseconds, JeroMQ crashed
> with the following stack trace after ~90,000 calls.
> Exception in thread "Transaction1461542403" *zmq.ZError$IOException*:*
> java.io.IOException*: Unable to establish loopback connection
>
> Tue Aug 13 13:45:13 PDT 2013 at zmq.Signaler.make_fdpair(*
> Signaler.java:87*)
>
> Tue Aug 13 13:45:13 PDT 2013 at zmq.Signaler.<init>(*Signaler.java:48*
> )
>
> Tue Aug 13 13:45:13 PDT 2013 at zmq.Mailbox.<init>(*Mailbox.java:55*)
>
> Tue Aug 13 13:45:13 PDT 2013 at zmq.SocketBase.<init>(*
> SocketBase.java:92*)
>
> Tue Aug 13 13:45:13 PDT 2013 at zmq.XPub.<init>(*XPub.java:89*)
>
> Tue Aug 13 13:45:13 PDT 2013 at zmq.Pub.<init>(*Pub.java:35*)
>
> Tue Aug 13 13:45:13 PDT 2013 at zmq.SocketBase.create(*
> SocketBase.java:119*)
>
> Tue Aug 13 13:45:13 PDT 2013 at zmq.Ctx.create_socket(*Ctx.java:304*)
>
> Tue Aug 13 13:45:13 PDT 2013 at org.jeromq.ZMQ$Socket.<init>(*
> ZMQ.java:238*)
>
> Tue Aug 13 13:45:13 PDT 2013 at org.jeromq.ZMQ$Context.socket(*
> ZMQ.java:193*)
>
> .....
>
> .....
>
> At the moment I solved the problem by implementing a connection pool with
> a number of connected sockets. Once my code needs to publish a message, I
> grab one socket from the pool, publish and return the socket back to the
> pool. So far it seems to be working well, but I'm not sure whether it is
> the correct and best approach or not.
>
> Thx
>
> > Hi Michael.
>
> > 1. How long is "short-lived"?
> > 2. Are you saying JeroMQ is crashing when you do this?
>
> > -Pieter
>
> > On Wed, Aug 14, 2013 at 5:23 PM, Michael Keselman
> <michael.keselman at gmail.com> wrote:
> > According to the Guide, sockets are not threadsafe and shouldn't be
> shared
> > among threads. My application creates multiple short-living threads and
> > needs to publishing messages from each one. My novice approach was to
> have a
> > shared context and create a new socket in each thread. What is a
> recommended
> > design for such environment?
> >
> > Thx
> >
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
--
---------------------------------------------------
Dr Lucas Hope - lucas.r.hope at skype
Machine Learning and Software Engineering Consultant
Melbourne, Australia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130816/4af485b8/attachment.htm>
More information about the zeromq-dev
mailing list