You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by "lei.dai@airlink-software.com" <le...@airlink-software.com> on 2016/11/04 10:54:11 UTC

[Qpid C++ Broker] Why broker link state retains connecting when I setup Broker Federation in windows using qpid-route ?

Hello, everybody !

I'm new in qpid and want to setup Broker Federation in windows.
I downloaded and built Qpid C++ Broker in windows. I can send messages with qpid-send to a broker and receive them with qpid-receive from the same broker, but failed when I use federation. The appearance is that the route was created but link state was not Operational but always Connecting, and I could not receive message from destination broker when I sent message to source broker.

Maybe there is some trouble in my configurations or my using but I don't know.
Is there anyone has some ideas ?
Thanks in advance.

What I have done is:
1. Download and build Qpid C++ Broker and Qpid Proton.
    Version infos:
         Qpid C++ Broker  1.35.0 (configured using CMake with default parameters)
         Qpid Proton 0.14.0 (also tried 0.15.0 but got same result)
         Windows 7
         Visual Studio 2010 (Win32 used)

2. Create root CA certificate and sign a server certificate with it, and then import all of them into windows as trusted.

3. Start 2 broker instances in one PC on different ports.
    instance A: tcp port 5672, ssl port 5671
    instance B: tcp port 5682, ssl port 5681
    both of them use the server certificate imported into windows.
    
    other parameters:
          protocol-defaults=amqp1.0,amqp0-10
          auth=no
    
    Up to here, I can use qpid-send and qpid-receive to transfer messages with either of them.

4. Use qpid-route to add a dynamic route like this:
    >qpid-route dynamic add 172.16.28.144:5682 172.16.28.144:5672 amq.topic
    >qpid-route route list 172.16.28.144:5682
    172.16.28.144:5682 172.16.28.144:5672 amq.topic <dynamic>
    
    It seems that the route was created successfully. But when I check the link state:
    >qpid-route link list 172.16.28.144:5682

Host            Port    Transport Durable  State             Last Error
=============================================================================
172.16.28.144   5672    tcp          N     Connecting

    The result is almost the same when I set transport to ssl.
    >qpid-route -t ssl dynamic add 172.16.28.144:5682 172.16.28.144:5672 amq.topic
    >qpid-route link list 172.16.28.144:5682

Host            Port    Transport Durable  State             Last Error
=============================================================================
172.16.28.144   5672    ssl          N     Connecting

    The state was always Connecting and didn't changed even after several minutes.
    And if I check the connections using netstat, I didn't find any connection with port 5672 or 5682.

5. I don't know if there is some trouble with the link list, but the fact is I cannot transfer messages through the route.
    receiver client:
        >qpid-receive.exe -b 172.16.28.144:5682 -a amq.topic -f
    sender client:
        >qpid-send -b 172.16.28.144:5672 -a amq.topic --content-string aaa
    But no message was received.

6. When I check the logs from the brokers, I mentioned that, if I use tcp transport, some system errors appeared:
    [in broker 172.16.28.144:5682]
    2016-11-04 17:05:13 [System] error Connection qpid.tcp:172.16.28.144:5672 No protocol received after 10s, closing
    [in broker 172.16.28.144:5672]
    2016-11-04 17:05:13 [System] error Connection qpid.172.16.28.144:5672-172.16.28.144:54192 No protocol received after 10s, closing
    


Lei Dai


Re: Re: [Qpid C++ Broker] Why broker link state retains connecting when I setup Broker Federation in windows using qpid-route ?

Posted by "lei.dai@airlink-software.com" <le...@airlink-software.com>.
After some tracing, I found that these points are probably related to the problem.

1.When use federation, one broker will connect to another, and once the connection is established, broker will send an INIT message for negotiation.

2.In linux version, all the network operations, including connect, read and write, are asynchronous.
   So the INIT message is sent in the connected callback called by the network IO worker threads.
   But in windows version, connect is implemented synchronously, thus the INIT message is not sent even if the connection is established,
   because no connected callback will be called.

3.When the connection is established, the link state should be set to Operational, but the precondition is that
   when LinkRegistry::notifyConnection is called, the Link object must be in the pendingLinks list.
   For the same reason as [2], in linux version it will be no problem because the Link object is put into the pendingLinks by the connecting thread
   and LinkRegistry::notifyConnection will be called later by the network IO worker threads.
   But in windows version, because of the synchronous connect operation, LinkRegistry::notifyConnection will be called by the connecting thread
   before the Link object  is put into pendingLinks. So the link state will not be set to Operational.

Therefore, I tried to modify the source code, add a temporary thread to do the connection and call AsynchIO::notifyPendingWrite
(which will call the idle callback to send the INIT message) after the synchoronous connect operation succeeds.
Now the federation works on windows when use tcp, but when use ssl it still doesn't work.
It seems that ssl negotiation is more complex than tcp, and I have no time to read the source code yet.

But my modification is only a temporary solution because I didn't add any asynchronous connecting function to the IocpPoller, 
and if the correct modification is made, AsynchIO::notifyPendingWrite (or the idle callback) should be called automatically, I think.

So, at the end, is there anyone who did test the federation functions on windows?
Or the federation is not designed to work on windows yet?
Or should I contact the developers' mailing list to ask this question? ;)

Regards,


Lei Dai

Re: Re: [Qpid C++ Broker] Why broker link state retains connecting when I setup Broker Federation in windows using qpid-route ?

Posted by "lei.dai@airlink-software.com" <le...@airlink-software.com>.
Thanks for your hint but maybe it's not the reason I think.
Because I didn't configure qpid to do client authentication, so there is no need to provide the client certificate even if SSL is used.
And in fact the result was same in both SSL mode and non-SSL mode (without SSL parameters).

I'm now reading the source code and doing some tracing.
And I hope to find the reason sometime if I'm lucky enough...... (- -;)

Regards,


Lei Dai
 
From: Chris Richardson
Date: 2016-11-14 17:57
To: users
Subject: Re: Re: [Qpid C++ Broker] Why broker link state retains connecting when I setup Broker Federation in windows using qpid-route ?
I had some trouble setting this up too and one of my mistakes was that I
was using server-only certificates (as you state you are doing in your
original post). When a broker establishes a link it uses its configured
cert as a _client_ cert, so the cert must be valid for that purpose also.
 
HTH
 
 
On 13 November 2016 at 05:08, lei.dai@airlink-software.com <
lei.dai@airlink-software.com> wrote:
 
> Hi,
>
> Thank you for the reply.
>
> As you said, I tried to set "auth=on" and provide an ACL with only one
> line "acl allow all all", but got the same result.
> I also tried to read the logs, and found that when use linux version,
> there are logs like:
>
> 2016-11-11 18:27:34 [Broker] info [0x7f13f308e700]
> /home/alex/qpid-cpp-1.35.0/src/qpid/broker/Link.cpp:240: Inter-broker
> link established to 172.16.28.144:5672
> 2016-11-11 18:27:34 [Model] debug [0x7f13f308e700]
> /home/alex/qpid-cpp-1.35.0/src/qpid/broker/amqp_0_10/Connection.cpp:329:
> Create connection. user:@QPID rhost:qpid.tcp:172.16.28.144:5672
> 2016-11-11 18:27:34 [System] debug [0x7f13f308e700]
> /home/alex/qpid-cpp-1.35.0/src/qpid/sys/AsynchIOHandler.cpp:102: SENT
> [qpid.tcp:172.16.28.144:5672]: INIT(0-10)
>
> But when use windows version, these logs disappeared.
> It seems that the destination node didn't send protocol negotiation to the
> source node for some reasons in windows, but I don't know what the reasons
> are.
> Now I'm trying to read the source code of Qpid C++ Broker but it's a
> little difficult to me...
>
> Regards,
>
>
> Lei Dai
>
>
 
 
-- 
 
*Chris Richardson*, System Architect
cr@fourc.eu
 
 
*FourC AS, Vestre Rosten 81, Trekanten, NO-7075 Tiller, Norwaywww.fourc.eu
<http://www.fourc.eu/>*
 
*Follow us on LinkedIn <http://bit.ly/fourcli>, Facebook
<http://bit.ly/fourcfb>, Google+ <http://bit.ly/fourcgp> and Twitter
<http://bit.ly/fourctw>!*

Re: Re: [Qpid C++ Broker] Why broker link state retains connecting when I setup Broker Federation in windows using qpid-route ?

Posted by Chris Richardson <cr...@fourc.eu>.
I had some trouble setting this up too and one of my mistakes was that I
was using server-only certificates (as you state you are doing in your
original post). When a broker establishes a link it uses its configured
cert as a _client_ cert, so the cert must be valid for that purpose also.

HTH


On 13 November 2016 at 05:08, lei.dai@airlink-software.com <
lei.dai@airlink-software.com> wrote:

> Hi,
>
> Thank you for the reply.
>
> As you said, I tried to set "auth=on" and provide an ACL with only one
> line "acl allow all all", but got the same result.
> I also tried to read the logs, and found that when use linux version,
> there are logs like:
>
> 2016-11-11 18:27:34 [Broker] info [0x7f13f308e700]
> /home/alex/qpid-cpp-1.35.0/src/qpid/broker/Link.cpp:240: Inter-broker
> link established to 172.16.28.144:5672
> 2016-11-11 18:27:34 [Model] debug [0x7f13f308e700]
> /home/alex/qpid-cpp-1.35.0/src/qpid/broker/amqp_0_10/Connection.cpp:329:
> Create connection. user:@QPID rhost:qpid.tcp:172.16.28.144:5672
> 2016-11-11 18:27:34 [System] debug [0x7f13f308e700]
> /home/alex/qpid-cpp-1.35.0/src/qpid/sys/AsynchIOHandler.cpp:102: SENT
> [qpid.tcp:172.16.28.144:5672]: INIT(0-10)
>
> But when use windows version, these logs disappeared.
> It seems that the destination node didn't send protocol negotiation to the
> source node for some reasons in windows, but I don't know what the reasons
> are.
> Now I'm trying to read the source code of Qpid C++ Broker but it's a
> little difficult to me...
>
> Regards,
>
>
> Lei Dai
>
>


-- 

*Chris Richardson*, System Architect
cr@fourc.eu


*FourC AS, Vestre Rosten 81, Trekanten, NO-7075 Tiller, Norwaywww.fourc.eu
<http://www.fourc.eu/>*

*Follow us on LinkedIn <http://bit.ly/fourcli>, Facebook
<http://bit.ly/fourcfb>, Google+ <http://bit.ly/fourcgp> and Twitter
<http://bit.ly/fourctw>!*

Re: Re: [Qpid C++ Broker] Why broker link state retains connecting when I setup Broker Federation in windows using qpid-route ?

Posted by "lei.dai@airlink-software.com" <le...@airlink-software.com>.
Hi,

Thank you for the reply.

As you said, I tried to set "auth=on" and provide an ACL with only one line "acl allow all all", but got the same result.
I also tried to read the logs, and found that when use linux version, there are logs like:

2016-11-11 18:27:34 [Broker] info [0x7f13f308e700] /home/alex/qpid-cpp-1.35.0/src/qpid/broker/Link.cpp:240: Inter-broker link established to 172.16.28.144:5672
2016-11-11 18:27:34 [Model] debug [0x7f13f308e700] /home/alex/qpid-cpp-1.35.0/src/qpid/broker/amqp_0_10/Connection.cpp:329: Create connection. user:@QPID rhost:qpid.tcp:172.16.28.144:5672
2016-11-11 18:27:34 [System] debug [0x7f13f308e700] /home/alex/qpid-cpp-1.35.0/src/qpid/sys/AsynchIOHandler.cpp:102: SENT [qpid.tcp:172.16.28.144:5672]: INIT(0-10)

But when use windows version, these logs disappeared.
It seems that the destination node didn't send protocol negotiation to the source node for some reasons in windows, but I don't know what the reasons are.
Now I'm trying to read the source code of Qpid C++ Broker but it's a little difficult to me...

Regards,


Lei Dai


Re: [Qpid C++ Broker] Why broker link state retains connecting when I setup Broker Federation in windows using qpid-route ?

Posted by acartcat <Ca...@cat.com>.
Hi,
   I'm no expert but I think the problem is to do with "auth".  By default
anonymous federation links are not allowed so you can either implement some
SASL or set "auth=on" and provide an ACL with allow all.  The ACL file is
the simple solution if you are working with the Windows version of Qpid.
Turn on logging or trace for the broker to see more detail on why the
connection is failing.
Cheers



--
View this message in context: http://qpid.2158936.n2.nabble.com/Qpid-C-Broker-Why-broker-link-state-retains-connecting-when-I-setup-Broker-Federation-in-windows-usi-tp7653311p7653860.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org