classification
Title: test_ssl memory leak
Type: resource usage Stage: resolved
Components: Extension Modules Versions: Python 3.1, Python 3.2, Python 2.7, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: mark.dickinson Nosy List: janssen, mark.dickinson
Priority: normal Keywords:

Created on 2010-08-03 17:50 by mark.dickinson, last changed 2010-08-03 18:55 by mark.dickinson. This issue is now closed.

Files
File name Uploaded Description Edit
test_ssl_leak_report.txt mark.dickinson, 2010-08-03 17:50
Messages (3)
msg112637 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-08-03 17:50
On OS X 10.6, with a 64-bit build of Python, regrtest -L is showing leaks from test_ssl.  Here are the first few lines of the output;  I've also attached the full output.

newton:py3k dickinsm$ ./python.exe -m test.regrtest -L test_ssl
[1/1] test_ssl
1 test OK.
leaks Report Version:  2.0
Process:         python.exe [36421]
Path:            /Users/dickinsm/python/svn/py3k/python.exe
Load Address:    0x100000000
Identifier:      python.exe
Version:         ??? (???)
Code Type:       X86-64 (Native)
Parent Process:  bash [80529]

Date/Time:       2010-08-03 18:48:10.072 +0100
OS Version:      Mac OS X 10.6.4 (10F569)
Report Version:  6

Process 36421: 8194 nodes malloced for 15049 KB
Process 36421: 106 leaks for 4080 total leaked bytes.
Leak: 0x10173df50  size=272  zone: DefaultMallocZone_0x1002f7000        string '/C=US/ST=Delaware/L=Wilmington/O=Python Software Foundation/OU=SSL/CN=somemachine.python.org'
Leak: 0x10171c0c0  size=192  zone: DefaultMallocZone_0x1002f7000        
      0x31898130 0x0609300b 0x06045503 0x53550213                       0..1.0...U....US
      0x0f301131 0x04550306 0x44081308 0x77616c65                       1.0...U....Delaw
      0x31657261 0x06113013 0x07045503 0x69570a13                       are1.0...U....Wi
      0x6e696d6c 0x6e6f7467 0x21302331 0x04550306                       lmington1#0!..U.
      0x501a130a 0x6f687479 0x6f53206e 0x61777466                       ...Python Softwa
      0x46206572 0x646e756f 0x6f697461 0x300c316e                       re Foundation1.0
      0x5503060a 0x03130b04 0x314c5353 0x061d301f                       ...U....SSL1.0..
      0x03045503 0x6f731613 0x616d656d 0x6e696863                       .U....somemachin
      ...
Leak: 0x10171e7a0  size=192  zone: DefaultMallocZone_0x1002f7000        
      0x31898130 0x0609300b 0x06045503 0x53550213                       0..1.0...U....US
      0x0f301131 0x04550306 0x44081308 0x77616c65                       1.0...U....Delaw
      0x31657261 0x06113013 0x07045503 0x69570a13                       are1.0...U....Wi
      0x6e696d6c 0x6e6f7467 0x21302331 0x04550306                       lmington1#0!..U.
      0x501a130a 0x6f687479 0x6f53206e 0x61777466                       ...Python Softwa
      0x46206572 0x646e756f 0x6f697461 0x300c316e                       re Foundation1.0
      0x5503060a 0x03130b04 0x314c5353 0x061d301f                       ...U....SSL1.0..
      0x03045503 0x6f731613 0x616d656d 0x6e696863                       .U....somemachin
      ...
msg112645 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-08-03 18:17
From a bit of experimentation, ssl._ssl._test_decode_cert seems to be the call that's leaking.  I haven't studied the source to see if I can pinpoint the cause yet.
msg112651 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-08-03 18:55
The fix turned out to be as simple as adding a single X509_free call to _test_decode_cert.

Fixed in revisions r83677 (py3k), r83679 (release31-maint), r83680 (release27-maint) and r83686 (release26-maint).  [The last with Barry's approval.]
History
Date User Action Args
2010-08-03 18:55:33mark.dickinsonsetstatus: open -> closed

assignee: mark.dickinson
components: + Extension Modules
versions: + Python 2.6, Python 3.1, Python 2.7
resolution: fixed
messages: + msg112651
stage: needs patch -> resolved
2010-08-03 18:17:05mark.dickinsonsetmessages: + msg112645
2010-08-03 17:50:11mark.dickinsoncreate