[zeromq-dev] How to detect if a remote socket has closed
Pieter Hintjens
ph at imatix.com
Tue Aug 17 15:34:33 CEST 2010
On Tue, Aug 17, 2010 at 3:15 PM, <David.Briant at ubs.com> wrote:
> LOL. things never "just work" !!!
>
> I'm finding that I'm hanging on socket creation a lot. Is that usual?
Nope, that assertion means something is broken, perhaps the build.
I'm asking Martin S. over on the IRC channel...
> I'm running the zmq loop in a different thread and queuing the creation to that thread and waiting until creation is done (do while notCreated(): sleep 0.01 in python). I'm using the call back api in IOLoop to do the queuing.
Are you accessing the same 0MQ socket from two threads?
> My recovery strategy is:
>
> Once I know there's a failure search for a remote connection that provides the same service, if I can't find one report back to the UI. this is more general than having a bunch of servers because a) the user might need to do the restart (in this case the crashed excel), b) the topology might not be known before hand (the user might be writing a "server" in excel that only needs to be around for a few minutes to get the particular job done).
Sounds like you need (a) heartbeats and (b) a routing mechanism that
favors local services but will search for remote ones if necessary.
You can do both these fairly simply on top of 0MQ IMO. However if you
want to design this properly you're going to have to learn more about
how 0MQ works, how the different socket types work.
-
Pieter Hintjens
iMatix - www.imatix.com
More information about the zeromq-dev
mailing list