Bug 1024832 - C# client conecting on SSL raises unhandled exception
C# client conecting on SSL raises unhandled exception
Status: CLOSED ERRATA
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: qpid-cpp (Show other bugs)
Development
Unspecified Windows
medium Severity medium
: 3.0
: ---
Assigned To: Cliff Jansen
Petra Svobodová
:
: 1029780 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-30 09:41 EDT by Petra Svobodová
Modified: 2014-09-24 11:09 EDT (History)
5 users (show)

See Also:
Fixed In Version: qpid-cpp-0.22-30
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-09-24 11:09:00 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Petra Svobodová 2013-10-30 09:41:21 EDT
Description of problem:
C# client running via SSL raises unhandled exception with message

Unhandled Exception: System.AccessViolationException: Attempted to read or write
 protected memory. This is often an indication that other memory is corrupt.
   at qpid.messaging.Connection.{dtor}(Connection* )
   at qpid.messaging.Connection.__delDtor(Connection* , UInt32 )
   at Org.Apache.Qpid.Messaging.Connection.!Connection()
   at Org.Apache.Qpid.Messaging.Connection.Dispose(Boolean )
   at Org.Apache.Qpid.Messaging.Connection.Finalize()

The issue occurs in two cases:
1. The client attempts to connect a broker, authentication fails and the exception is raised before closing the client.

2. The client attempts to connect a broker, the connection is successful, sends (or receives) messages and the exception is raised before closing the client.

Version-Release number of selected component (if applicable):
qpid-cpp-win-3.22.23.1-1

How reproducible:
100% in described cases

Steps to Reproduce:
1. Compile C++ and C# examples.

2. On the linux machine create nss database and generate SSL certificates:
# mkdir qpid_nss_db
# cd qpid_nss_db/
# echo password > ssl_pw_file.txt
# certutil -N -d . -f ssl_pw_file.txt
# certutil -S -d . -n rootCA -s "CN=rootCA" -t "CT,," -x -m 1000 -v 120 -f ssl_pw_file.txt
# certutil -S -n "<server_cert_name>" -s "CN="<hostname> -c rootCA -t ",," -m 1001 -v 120 -d . -f ssl_pw_file.txt
# certutil -S -n client -s "CN=client" -t ",," -m 1002 -v 120 -c rootCA -d . -f ssl_pw_file.txt

3. Create a directory, export certificate of authority into .cer format and client certificate into .pfx format; create a new password file:
# mkdir windir
# certutil -L -d . -n rootCA -f ssl_pw_file.txt -a > windir/qrootCA.cer
# pk12util -d qpid_nss_db -n client  -k ssl_pw_file.txt -w windir/win_pw_file.txt -o windir/client_from_nss.pfx

4. Copy the windir folder on the Windows machine and.

5. Install rootCA.cer certificate into Trusted Root Certification Authorities.

1st case:
---------
6a]. Run a broker with configuration:
  # cat /etc/qpid/qpidd.conf
ssl-require-client-authentication=no
ssl-sasl-no-dict=no
log-to-file=/var/lib/qpidd/qpidd.log
ssl-port=5671
truncate=yes
log-enable=debug+
ssl-cert-password-file=/var/lib/qpidd/qpid_nss_db/ssl_pw_file.txt                                                   
ssl-cert-name=<server_cert_name>                                                           auth=no                                                                                                             
ssl-cert-db=/var/lib/qpidd/qpid_nss_db

7a] From Windows machine run csharp.example.spout example:
csharp.example.spout.exe --broker <hostname>:5671 --connection-options "{transport:ssl}" amq.topic

2nd case:
---------
6b] Run a broker with configuration:
# cat /etc/qpid/qpidd.conf
ssl-require-client-authentication=yes
ssl-sasl-no-dict=no
log-to-file=/var/lib/qpidd/qpidd.log
ssl-port=5671
truncate=yes
log-enable=debug+
ssl-cert-password-file=/var/lib/qpidd/qpid_nss_db/ssl_pw_file.txt
ssl-cert-name=<server_cert-name>
ssl-cert-db=/var/lib/qpidd/qpid_nss_db

7b] Set environment variables: 
set QPID_SSL_CERT_FILENAME=<path to .pfx certificate> 
set QPID_SSL_CERT_PASSWORD_FILE=<path to win_pw_file.txt>
set QPID_SSL_CERT_NAME=client
 
8b] Run csharp.example.spout example:
csharp.example.spout.exe --broker <hostname>:5671 --connection-options "{transport:ssl}" amq.topic

Actual results:
1st case:
Connection is established, the message is delivered to the broker and the unhandled exception is raised before client's end.

2nd case:
Authentication fails and the unhandled exception is raised before client's end.

Expected results:
No unhandled exceptions should be raised in the both cases.
Comment 4 Chuck Rolke 2013-10-31 16:07:50 EDT
A call stack trace from Visual Studio 2008, 32-bit, Debug

 	crypt32.dll!000007fefd926dbf() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for crypt32.dll]	
 	crypt32.dll!000007fefd926d93() 	
 	qpidclientd.dll!qpid::client::windows::SslConnector::~SslConnector()  Line 188	C++
 	qpidclientd.dll!qpid::client::windows::SslConnector::`scalar deleting destructor'()  + 0x31 bytes	C++
 	qpidclientd.dll!boost::checked_delete<qpid::client::Connector>(qpid::client::Connector * x=0x000000000048da20)  Line 34 + 0x30 bytes	C++
 	qpidclientd.dll!boost::scoped_ptr<qpid::client::Connector>::~scoped_ptr<qpid::client::Connector>()  Line 81	C++
 	qpidclientd.dll!qpid::client::ConnectionImpl::~ConnectionImpl()  Line 208 + 0x47 bytes	C++
 	qpidclientd.dll!qpid::client::ConnectionImpl::`scalar deleting destructor'()  + 0x31 bytes	C++
 	qpidclientd.dll!qpid::client::ConnectionImpl::release()  Line 389 + 0x39 bytes	C++
 	qpidclientd.dll!boost::_mfi::mf0<void,qpid::client::ConnectionImpl>::operator()(qpid::client::ConnectionImpl * p=0x000000000048d000)  Line 50	C++
 	qpidclientd.dll!boost::_bi::list1<boost::arg<1> >::operator()<boost::_mfi::mf0<void,qpid::client::ConnectionImpl>,boost::_bi::list1<qpid::client::ConnectionImpl * __ptr64 & __ptr64> >(boost::_bi::type<void> __formal={...}, boost::_mfi::mf0<void,qpid::client::ConnectionImpl> & f={...}, boost::_bi::list1<qpid::client::ConnectionImpl * &> & a={...}, boost::_bi::type<void> __formal={...})  Line 254	C++
 	qpidclientd.dll!boost::_bi::bind_t<void,boost::_mfi::mf0<void,qpid::client::ConnectionImpl>,boost::_bi::list1<boost::arg<1> > >::operator()<qpid::client::ConnectionImpl * __ptr64>(qpid::client::ConnectionImpl * & a1=0x000000000048d000)  Line 33	C++
 	qpidclientd.dll!boost::detail::sp_counted_impl_pd<qpid::client::ConnectionImpl * __ptr64,boost::_bi::bind_t<void,boost::_mfi::mf0<void,qpid::client::ConnectionImpl>,boost::_bi::list1<boost::arg<1> > > >::dispose()  Line 149	C++
 	qpidclientd.dll!boost::detail::sp_counted_base::release()  Line 103	C++
 	qpidclientd.dll!boost::detail::shared_count::~shared_count()  Line 309	C++
 	qpidclientd.dll!boost::shared_ptr<qpid::client::ConnectionImpl>::~shared_ptr<qpid::client::ConnectionImpl>()  + 0x31 bytes	C++
 	qpidclientd.dll!qpid::client::Connection::~Connection()  Line 53 + 0x3a bytes	C++
 	qpidmessagingd.dll!qpid::client::amqp0_10::ConnectionImpl::~ConnectionImpl()  + 0x63 bytes	C++
 	qpidmessagingd.dll!qpid::client::amqp0_10::ConnectionImpl::`vbase destructor'()  + 0x34 bytes	C++
 	qpidmessagingd.dll!qpid::client::amqp0_10::ConnectionImpl::`scalar deleting destructor'()  + 0x38 bytes	C++
 	qpidmessagingd.dll!qpid::RefCounted::released()  Line 48 + 0x53 bytes	C++
 	qpidmessagingd.dll!qpid::RefCounted::release()  Line 42 + 0x45 bytes	C++
 	qpidmessagingd.dll!qpid::intrusive_ptr_release(const qpid::RefCounted * p=0x0000000000484f08)  Line 54 + 0x2d bytes	C++
 	qpidmessagingd.dll!qpid::messaging::PrivateImplRef<qpid::messaging::Connection>::dtor(qpid::messaging::Connection & t={...})  Line 88 + 0x70 bytes	C++
 	qpidmessagingd.dll!qpid::messaging::Connection::~Connection()  Line 41 + 0x2d bytes	C++
>	hello_world.exe!main(int argc=4, char * * argv=0x0000000000482b90)  Line 52 + 0x55 bytes	C++
 	hello_world.exe!__tmainCRTStartup()  Line 586 + 0x19 bytes	C
 	hello_world.exe!mainCRTStartup()  Line 403	C
 	kernel32.dll!00000000776c652d() 	
 	ntdll.dll!00000000778fc541()
Comment 6 Chuck Rolke 2013-12-06 12:08:52 EST
*** Bug 1029780 has been marked as a duplicate of this bug. ***
Comment 9 Petra Svobodová 2014-01-08 05:05:47 EST
C# and C++ clients on Windows shut down cleanly now; the issue did not occur.

Verified on packages qpid-cpp-win-3.22.31.1-1 on Windows 7, Windows Server 2003, Windows Server 2008 on x86 and x64; on Windows XP-x86  and Windows Server 2008 R2.

--> VERIFIED
Comment 10 errata-xmlrpc 2014-09-24 11:09:00 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2014-1296.html

Note You need to log in before you can comment on or make changes to this bug.