[New-bugs-announce] [issue28588] Memory leak in OpenSSL thread state

Christian Heimes report at bugs.python.org
Wed Nov 2 08:01:29 EDT 2016


New submission from Christian Heimes:

Quote from https://github.com/curl/curl/issues/964

---
I wrote to Matt Caswell from openssl.org about this memleah, and he answered:
OpenSSL maintains a separate error queue for each thread. On each queue there can be
multiple errors. ERR_get_state() does not add any errors to the queue it
merely returns the ERR_STATE (i.e. the queue) for the current thread.
If the current thread has no queue then ERR_get_state() will create one.

ERR_clear_error() removes all the errors that are on the current
thread's queue. It does not deallocate the current thread's queue.

ERR_remove_thread_state() deallocates the specified thread's queue.

The mem leaks you are seeing are almost certainly because the queues for
your app's threads have not been deallocated.
---

The memory leak only affects OpenSSL 1.0.2 and older. OpenSSL 1.1.0 takes care of threading, locking and thread local resources itself.

----------
assignee: christian.heimes
components: Extension Modules, SSL
messages: 279922
nosy: christian.heimes
priority: normal
severity: normal
stage: test needed
status: open
title: Memory leak in OpenSSL thread state
type: resource usage
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28588>
_______________________________________


More information about the New-bugs-announce mailing list