[OPENSSL] BIO_read fails

RCF support and general discussion.
Post Reply
iiakhilesh
Posts: 4
Joined: Mon Jan 20, 2014 5:27 am

[OPENSSL] BIO_read fails

Post by iiakhilesh »

Hi Jarl,

I am using openssl with RCF but at times my program gives an exception in retryreadwrite method inOpenSslEncryptionFilter class but without giving any reason.
"Exception : OpenSSL error: %1"

Why this unnamed exception and what causes it?

jarl
Posts: 238
Joined: Mon Oct 03, 2011 4:53 am
Contact:

Re: [OPENSSL] BIO_read fails

Post by jarl »

Are you able to reproduce this error? If so, if you put a breakpoint in this code in OpenSslEncryptionFilter.cpp:

Code: Select all

        else
        {
            mErr = -1;

            std::string opensslErrors = getOpenSslErrors();
            Exception e( _RcfError_OpenSslError(opensslErrors) );
            RCF_THROW(e);
        }
, you can then step through getOpenSslErrors() , and see if you can figure out what's going on. From your error message, it looks like getOpenSslErrors() is returning an empty string, which may in turn be caused by a failure in the OpenSSL ERR_get_errors() function.
Kind Regards

Jarl Lindrud
Delta V Software
http://www.deltavsoft.com

iiakhilesh
Posts: 4
Joined: Mon Jan 20, 2014 5:27 am

Re: [OPENSSL] BIO_read fails

Post by iiakhilesh »

Hi Jarl,

Yes I am able to reproduce this error at random times.
I have tried debugging it also and the failure happens in ERR_print_errors method.

I am using android with libcrypto_static.a,libssl_static.a static libs.

If you have any idea why this failure happens in printing the error causing an unnamed error to be thrown, please share with me.

Thanks,
Akhilesh

jarl
Posts: 238
Joined: Mon Oct 03, 2011 4:53 am
Contact:

Re: [OPENSSL] BIO_read fails

Post by jarl »

Hi Akhilesh,

It looks like for some reason, the code in this situation is unable to extract a meaningful error message from OpenSSL.

One thing you can try, is to periodically disconnect the RcfClient<>:

Code: Select all

					
		RcfClient<I_Echo> client( ... );
		client.getClientStub().disconnect();
This will close the TCP connection and dispose of the OpenSSL state that is associated with it. On the next remote call you make, a new TCP connection is established and the OpenSSL state will be re-created. It's possible that this will help to avoid the error happening in the first place.
Kind Regards

Jarl Lindrud
Delta V Software
http://www.deltavsoft.com

terry_yu2
Posts: 1
Joined: Mon Mar 30, 2015 10:24 am

Re: [OPENSSL] BIO_read fails

Post by terry_yu2 »

Hi Akhilesh,

Can you share ur libcrypto_static.a,libssl_static.a static libs and ur Android.mk setting with me, I can't link it with openssl support! :? :?

Millions of thanx!

Post Reply