On 5/19/14, 5:44 AM, Gordon Sim wrote:
On 05/15/2014 04:11 PM, Hari Pyla wrote:
Hi,
  I am setting the SSL client environment variables for a C++ client and
I ran into the following issue.
When I set them at the command line and run the client program things
works as expected. However, when I try to set them programmatically
prior(in program order) to opening a connection, qpid seems to ignore
the environment variables. I was wondering if there is anyway to specify
the environment variables programmatically in the qpid C++ client.

The issue here is that the variables relating to finding and opening the certificate db are needed when initialising the NSS library, and this is not specific to any connection. At present the NSS library is initialised when the qpid client library is loaded.

Hi Gordon,
I guess another artifact of such an initialization process is that if a process forks a child process and if the child attempts to create a new connection then it would fail in the child process. This precludes a qid client from creating multiple processes which in turn can create connections to the broker. See below example. Is this currently a limitation of qpid C++ client. My current work around to this issue is to clone qpid client process with CLONE_VM flags set so all the newly created process share the same virtual address pages of the qpid client library.

===example===

#include <qpid/messaging/Connection.h>
#include<cstdlib>
#include<iostream>
#include<stdlib.h>

using namespace qpid::messaging;

int foo()
{
    const char* url = "localhost:5672";
std::string connectionOptions = "{username:test,password:test,transport:ssl}";

    Connection connection(url, connectionOptions);

     try
     {
        connection.open();
     }

    catch (const std::exception& e)
    {
        std::cout << e.what() << "\n";
    }

    connection.close();
    return 0;
}

int main()
{
    int retval = -1;

    retval = fork();
    if (retval == 0)
        foo();
    else
        sleep(5);

    return 0;
}

===error message===
On C++ qpid broker:
May 26 20:50:00 qa1 qpidd[21500]: 2014-05-26 20:50:00 [System] error Error reading socket: Success(0)

On C++ qpid client:
2014-05-26 20:50:00 [Security] warning Connect failed: Failed: NSS error [-8023] (/builddir/build/BUILD/qpid-0.28-rc2/cpp/src/qpid/sys/ssl/SslSocket.cpp:156)
2014-05-26 20:50:00 [Client] warning Connection  closed

Thanks,
-Hari


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to