Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_ssl memory leak #53706

Closed
mdickinson opened this issue Aug 3, 2010 · 3 comments
Closed

test_ssl memory leak #53706

mdickinson opened this issue Aug 3, 2010 · 3 comments
Assignees
Labels
extension-modules C modules in the Modules dir performance Performance or resource usage

Comments

@mdickinson
Copy link
Member

BPO 9497
Nosy @mdickinson
Files
  • test_ssl_leak_report.txt
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/mdickinson'
    closed_at = <Date 2010-08-03.18:55:33.803>
    created_at = <Date 2010-08-03.17:50:11.153>
    labels = ['extension-modules', 'performance']
    title = 'test_ssl memory leak'
    updated_at = <Date 2010-08-03.18:55:33.800>
    user = 'https://github.com/mdickinson'

    bugs.python.org fields:

    activity = <Date 2010-08-03.18:55:33.800>
    actor = 'mark.dickinson'
    assignee = 'mark.dickinson'
    closed = True
    closed_date = <Date 2010-08-03.18:55:33.803>
    closer = 'mark.dickinson'
    components = ['Extension Modules']
    creation = <Date 2010-08-03.17:50:11.153>
    creator = 'mark.dickinson'
    dependencies = []
    files = ['18348']
    hgrepos = []
    issue_num = 9497
    keywords = []
    message_count = 3.0
    messages = ['112637', '112645', '112651']
    nosy_count = 2.0
    nosy_names = ['mark.dickinson', 'janssen']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'resource usage'
    url = 'https://bugs.python.org/issue9497'
    versions = ['Python 2.6', 'Python 3.1', 'Python 2.7', 'Python 3.2']

    @mdickinson
    Copy link
    Member Author

    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
    ...

    @mdickinson mdickinson added the performance Performance or resource usage label Aug 3, 2010
    @mdickinson
    Copy link
    Member Author

    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.

    @mdickinson
    Copy link
    Member Author

    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.]

    @mdickinson mdickinson added the extension-modules C modules in the Modules dir label Aug 3, 2010
    @mdickinson mdickinson self-assigned this Aug 3, 2010
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    extension-modules C modules in the Modules dir performance Performance or resource usage
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant