Bug 489540 - Memory leak in SASL client code.
Summary: Memory leak in SASL client code.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: qpid-cpp
Version: 1.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: 1.3
: ---
Assignee: Ted Ross
QA Contact: Frantisek Reznicek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-03-10 16:25 UTC by Alan Conway
Modified: 2015-11-16 00:07 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Opening client connections with authentication mechanisms involving passwords caused a very small amount of memory to be leaked for each connection setup. With this update, management of the memory used in the authentication mechanism is handled properly and memory leaks no longer occur.
Clone Of:
Environment:
Last Closed: 2010-10-14 16:15:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2010:0773 0 normal SHIPPED_LIVE Moderate: Red Hat Enterprise MRG Messaging and Grid Version 1.3 2010-10-14 15:56:44 UTC

Description Alan Conway 2009-03-10 16:25:53 UTC
Description of problem:

An ACL test added to cluster_test exposed a memory leak in the SASL client library.

Steps to Reproduce:

Remove the #if 0 around QPID_AUTO_TEST_CASE(testAcl) {} in qpid/src/tests/cluster_test.cpp and run make check TESTS=cluster_test
  
Actual results:

Memory leak. Looks like we need thread local storage 

Expected results:


Additional info:

This comment from sasl.h seems relevant. We may need thread-local storage, note that qpid/sys/Thread.h defines a macro QPID_TSS which expands to the appropriate thread-local modifier for gcc or windows.

/* get a sasl_secret_t (plaintext password with length)
 * inputs:
 *  conn          -- connection context
 *  context       -- context from callback structure
 *  id            -- callback id
 * outputs:
 *  psecret       -- set to NULL to cancel
 *                   set to password structure which must persist until
 *                   next call to getsecret in same connection, but middleware
 *                   will erase password data when it's done with it.
 * returns SASL_OK
 */
typedef int sasl_getsecret_t(sasl_conn_t *conn, void *context, int id,
			     sasl_secret_t **psecret);


The existing SASL test should be converted into a unit test. It can follow the pattern in cluster_test, using BrokerFixture instead of ClusterFixture.  This will give valgrind coverage of both client and broker code.

Comment 2 Ted Ross 2009-11-03 15:58:17 UTC
Fixed upstream (by aconway) in revision 832134.

Comment 4 Ted Ross 2010-10-08 21:39:47 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
cause: opening client connections with authentication mechanisms involving passwords.
consequence: a very small amount of memory is leaked for each connection setup.
fix: code was added to manage the memory used in the authentication mechanism
result: memory is freed properly

Comment 5 Martin Prpič 2010-10-10 07:42:23 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,4 +1 @@
-cause: opening client connections with authentication mechanisms involving passwords.
+Opening client connections with authentication mechanisms involving passwords caused a very small amount of memory to be leaked for each connection setup. With this update, management of the memory used in the authentication mechanism is handled properly and memory leaks no longer occur.-consequence: a very small amount of memory is leaked for each connection setup.
-fix: code was added to manage the memory used in the authentication mechanism
-result: memory is freed properly

Comment 7 errata-xmlrpc 2010-10-14 16:15:17 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2010-0773.html


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