[zeromq-dev] REQ-REP pattern: client (REQ) started before server (REP) (java binding)

Pieter Hintjens ph at imatix.com
Tue Oct 5 14:30:33 CEST 2010


Czesc Krzysztof!

First of all, inproc is not a disconnected transport.  See
http://zguide.zeromq.org/chapter:all#toc21

If you test this with inproc you must connect, then bind.  It's good
discipline to (in C at least) put asserts around 0MQ calls so that
errors show up.  I've no idea how you do that in Java but at least
check the return codes from bind/connect.

When you use tcp: the client should connect if the server starts up
after it, and if you have a test case that proves this does not work,
you should report as an issue.  (Best to also verify the C version to
know whether it's a problem in the Java binding or 0MQ).

-Pieter

On Tue, Oct 5, 2010 at 1:15 PM, Marcinowicz, Krzysztof
<Krzysztof.Marcinowicz at compuware.com> wrote:
> Hi Pieter,
>
> I think client doesn't try to reconnect, it looks like this:
>
> 1) When started as two processes:
>
> [Client] created
> [Client] contected to tcp://127.0.0.1:5555
> [Client] request sent: true
>
>
> [Server] bound to tcp://127.0.0.1:5555
>
> After send client buffers not yet sent message (this is why send() returns true) and is waiting for response. But server never gets the request message.
>
>
> 2) When started as threads in one process:
>
> [Client] created
> [Server] bound to inproc://test-endpoint
>
> Now client doesn't connect to 'inproc://test-endpoint' - I think because the endpoint doesn't exist before server starts, but client isn't trying to reconnect.
>
>
>
> May you access the source code? The links to pastebin.com don't work as I expected.
>
> http://pastebin.com/embed_js.php?i=34Wrz7Hf
>
> http://pastebin.com/embed_js.php?i=D36Xmd6t
>
> http://pastebin.com/embed_js.php?i=HZZDk57h
>
>
>
> -----Original Message-----
> From: zeromq-dev-bounces at lists.zeromq.org [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Pieter Hintjens
> Sent: Tuesday, October 05, 2010 12:29 PM
> To: ZeroMQ development list
> Subject: Re: [zeromq-dev] REQ-REP pattern: client (REQ) started before server (REP) (java binding)
>
> Hi Krzysztof,
>
> It's definitely not normal.  The tcp transport is 'disconnected' in
> that the client will continue to try to connect if it can't find the
> server immediately.
>
> Where is client hanging?
>
> -Pieter
>
>
>
> On Tue, Oct 5, 2010 at 9:32 AM, Marcinowicz, Krzysztof
> <Krzysztof.Marcinowicz at compuware.com> wrote:
>> This an excerpt from ØMQ - The Guide:
>>
>> "For fun, try starting the client and then starting the server, see how it
>> all still works, then think for a second what this means."
>>
>> And this is my problem. I use Java binding and have this scenario not
>> working.
>>
>> When the server starts first and the then client - it works fine. But the in
>> the opposite case the client hangs.
>>
>> I think it is not expected behavior. Does anybody faced such a problem?
>>
>>
>>
>> Server process:
>>
>> <script src="http://pastebin.com/embed_js.php?i=34Wrz7Hf"></script>
>>
>> Client process:
>>
>> <script src="http://pastebin.com/embed_js.php?i=D36Xmd6t"></script>
>>
>> Server and Client in one process:
>>
>> <script src="http://pastebin.com/embed_js.php?i=HZZDk57h"></script>
>>
>> WinXP, latest (synchronized this morning ~9:00 October 5, 2010) zeromq2.git
>> and jzmq.git built with Visual C++ 2008 Express Edition
>>
>> The contents of this e-mail are intended for the named addressee only. It
>> contains information that may be confidential. Unless you are the named
>> addressee or an authorized designee, you may not copy or use it, or disclose
>> it to anyone else. If you received it in error please notify us immediately
>> and then destroy it.
>>
>> Compuware sp. z o.o. (registration number KRS 595) is a company registered
>> in Poland whose registered office is at Ul. Dmowskiego 12,80-264 Gdansk
>> Rejestr handlowy KRS 0000000595 Sadu Rejonowego Gdansk-Polnoc w Gdansku VII
>> Wydzial Gospodarczy Kapital zakladowy 1.140.000 zl oplacony gotówka; NIP:
>> 584-20-88-050; REGON: 191352920
>>
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>>
>
>
>
> --
> -
> Pieter Hintjens
> iMatix - www.imatix.com
> _______________________________________________
> 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
>
>



-- 
-
Pieter Hintjens
iMatix - www.imatix.com



More information about the zeromq-dev mailing list